convert all existing libraries to new vipakfile format, automatically, with Shell scripts

This commit is contained in:
Antranig Vartanian 2025-10-04 13:06:42 +04:00
parent d1c3a3601f
commit 91191b6b62
No known key found for this signature in database
GPG key ID: DE3998662D59F21C
33 changed files with 750 additions and 0 deletions

View file

@ -0,0 +1,17 @@
NAME = Bron-Dijkstra-Strings
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/Bron-Dijkstra-Strings 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s bdStrings.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = Internet
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/Internet 0.1.0
DEPS = time:0.1.0
RUN =
MAIN =
BUILD = voc -s src/netTypes.Mod;voc -s src/netdb.Mod;voc -s src/netSockets.Mod;voc -s src/Internet.Mod;voc -s src/netForker.Mod;voc -s src/server.Mod;voc -m tst/testClient.Mod;voc -m tst/testServer.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = Internet
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/armscii 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s ArmsciiUTF.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = armscii2
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE =
DEPS =
RUN =
MAIN =
BUILD =
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = base64
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/base64 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s src/Base64.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = cairo
VERSION = 0.1.0
AUTHOR = une
LICENSE = GPL-3
REMOTE =
DEPS =
RUN =
MAIN =
BUILD =
TEST_RUN =
TEST_MAIN =
TEST =

181
convert_vipakfile.sh Executable file
View file

@ -0,0 +1,181 @@
#!/bin/sh
# convert_vipakfile.sh: Convert old JSON vipakfile to new plain-text format
# Program name and version
PROGNAME=${0##*/}
VERSION="0.1.0"
# Colors for output
COLOUR_SET_R="\033[0;31m"
COLOUR_SET_G="\033[0;32m"
COLOUR_SET_B="\033[0;34m"
COLOUR_END="\033[0m"
# Error, info, and action print functions
perror() {
printf "${COLOUR_SET_R}[-] ${COLOUR_END}%s\n" "$@" >&2
exit 1
}
pinfo() {
printf "${COLOUR_SET_B}[+] ${COLOUR_END}%s\n" "$@" >&2
}
paction() {
printf "${COLOUR_SET_G}[*] ${COLOUR_END}%s\n" "$@" >&2
}
# Usage message
usage() {
cat <<EOF
Usage: $PROGNAME [-o <output_file> | -c] [-f] [--verbose] <input_json_file>
Convert old JSON vipakfile to new plain-text format.
-o <output_file> Write to specified file (default: stdout)
-c Write to <Package>-<Version>.vipakfile
-f Force overwrite of existing output file
--verbose Print debug information about extracted fields
EOF
exit 0
}
# Check dependencies
command -v jq >/dev/null 2>&1 || perror "jq is required but not found"
# Parse arguments
output_mode="stdout"
output_file=""
input_file=""
force_overwrite=""
verbose=""
while [ $# -gt 0 ]; do
case "$1" in
-o)
[ $# -lt 2 ] && perror "Option -o requires an output file"
output_mode="file"
output_file="$2"
shift 2
;;
-c)
output_mode="versioned"
shift
;;
-f)
force_overwrite=1
shift
;;
--verbose)
verbose=1
shift
;;
-*)
perror "Unknown option: $1"
;;
*)
[ -n "$input_file" ] && perror "Only one input file allowed"
input_file="$1"
shift
;;
esac
done
[ -z "$input_file" ] && usage
[ -f "$input_file" ] || perror "Input file '$input_file' not found"
[ -r "$input_file" ] || perror "Input file '$input_file' is not readable"
# Validate JSON
jq -e . "$input_file" >/dev/null 2>&1 || perror "Invalid JSON in $input_file"
# Extract fields using jq
paction "Parsing $input_file"
name=$(jq -r '.Package // ""' "$input_file")
version=$(jq -r '.Version // ""' "$input_file")
author=$(jq -r '.Author // ""' "$input_file")
license=$(jq -r '.License // ""' "$input_file")
# Validate required fields
[ -z "$name" ] && perror "Package name is required"
[ -z "$version" ] && perror "Version is required"
# Extract Remote (type, path, tag)
remote_type=$(jq -r '.Remote.type // ""' "$input_file")
remote_path=$(jq -r '.Remote.path // ""' "$input_file")
remote_tag=$(jq -r '.Remote.tag // ""' "$input_file")
remote=""
if [ -n "$remote_type" ] && [ -n "$remote_path" ] && [ -n "$remote_tag" ]; then
remote="$remote_type $remote_path $remote_tag"
fi
# Extract Dependencies as space-separated list
deps=$(jq -r 'if .Dependencies then .Dependencies | to_entries | map("\(.key):\(.value)") | join(" ") else "" end' "$input_file")
# Extract Build commands as semicolon-separated list
build=$(jq -r '.Build | map(.command + " " + .file) | join(";")' "$input_file")
[ "$build" = "null" ] && build=""
# Default empty fields
run=""
main=""
test_run=""
test_main=""
test_cmd=""
# Verbose output
[ -n "$verbose" ] && {
pinfo "Extracted fields:"
pinfo " NAME=$name"
pinfo " VERSION=$version"
pinfo " AUTHOR=$author"
pinfo " LICENSE=$license"
pinfo " REMOTE=$remote"
pinfo " DEPS=$deps"
pinfo " BUILD=$build"
pinfo " RUN=$run"
pinfo " MAIN=$main"
pinfo " TEST_RUN=$test_run"
pinfo " TEST_MAIN=$test_main"
pinfo " TEST=$test_cmd"
}
# Generate vipakfile content
vipakfile_content=$(cat <<EOF
NAME = $name
VERSION = $version
AUTHOR = $author
LICENSE = $license
REMOTE = $remote
DEPS = $deps
RUN = $run
MAIN = $main
BUILD = $build
TEST_RUN = $test_run
TEST_MAIN = $test_main
TEST = $test_cmd
EOF
)
# Handle output
case "$output_mode" in
stdout)
paction "Writing to stdout"
printf "%s\n" "$vipakfile_content"
;;
file)
[ -z "$force_overwrite" ] && [ -f "$output_file" ] && perror "Output file '$output_file' already exists"
paction "Writing $output_file"
printf "%s\n" "$vipakfile_content" > "$output_file" 2>/dev/null || perror "Failed to write to '$output_file'"
pinfo "Conversion complete: $output_file"
;;
versioned)
output_file="$name-$version.vipakfile"
[ -z "$force_overwrite" ] && [ -f "$output_file" ] && perror "Output file '$output_file' already exists"
paction "Writing $output_file"
printf "%s\n" "$vipakfile_content" > "$output_file" 2>/dev/null || perror "Failed to write to '$output_file'"
pinfo "Conversion complete: $output_file"
;;
esac

42
convert_vipatsar.sh Normal file
View file

@ -0,0 +1,42 @@
#!/bin/sh
# convert_vipatsar.sh: Convert old JSON vipakfiles to new plain-text format with
# proper file naming and versioning using convert_vipakfile.sh
# Program name and version
PROGNAME=${0##*/}
VERSION="0.1.0"
# Colors for output
COLOUR_SET_R="\033[0;31m"
COLOUR_SET_G="\033[0;32m"
COLOUR_SET_B="\033[0;34m"
COLOUR_END="\033[0m"
# Error, info, and action print functions
perror() {
printf "${COLOUR_SET_R}[-] ${COLOUR_END}%s\n" "$@" >&2
exit 1
}
pinfo() {
printf "${COLOUR_SET_B}[+] ${COLOUR_END}%s\n" "$@" >&2
}
paction() {
printf "${COLOUR_SET_G}[*] ${COLOUR_END}%s\n" "$@" >&2
}
# We assume that we're running inside vipatsar tree
for dir in $(find . -not -path '*/.git/*' -not -path '.' -type d) ;
do
# The port/library name is derived from the directory
port=${dir##./}
pinfo "Working on ${port}"
cd $dir
paction "Converting ${port}.json"
../convert_vipakfile.sh -c "${port}.json"
pinfo "Conversion done"
cd - >/dev/null || return
done

17
dbg/dbg-0.1.0.vipakfile Normal file
View file

@ -0,0 +1,17 @@
NAME = dbg
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/dbg 0.1.0
DEPS = strutils:0.1.0
RUN =
MAIN =
BUILD = voc -s src/dbg.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = diaspora
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/diaspora 0.1.0
DEPS = lists:0.1.0 postgres:0.1.0
RUN =
MAIN =
BUILD = voc -s src/diasporadb.Mod;voc -s src/diasporaPost.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = etiquette
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/etiquette 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -m src/etiquette.Mod
TEST_RUN =
TEST_MAIN =
TEST =

17
fifo/fifo-0.1.0.vipakfile Normal file
View file

@ -0,0 +1,17 @@
NAME = fifo
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/fifo 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s src/fifo.Mod
TEST_RUN =
TEST_MAIN =
TEST =

17
http/http-0.1.0.vipakfile Normal file
View file

@ -0,0 +1,17 @@
NAME = http
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/http 0.1.0
DEPS = strutils:0.1.0 base64:0.1.0 Internet:0.1.0
RUN =
MAIN =
BUILD = voc -s src/hexIntStr.Mod;voc -s src/http.Mod
TEST_RUN =
TEST_MAIN =
TEST =

17
irc/irc-0.1.0.vipakfile Normal file
View file

@ -0,0 +1,17 @@
NAME = irc
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/irc 0.1.0
DEPS = time:0.1.0 Internet:0.1.0 lists:0.1.0 dbg:0.1.0
RUN =
MAIN =
BUILD = voc -s src/IRC.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = irc_bot
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/irc_bot 0.1.0
DEPS = opts:0.1.0 lists:0.1.0 Internet:0.1.0 time:0.1.0 irc:0.1.0
RUN =
MAIN =
BUILD = voc -m src/vocbot.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = libucl
VERSION = 0.1.0
AUTHOR = antranigv
LICENSE = BSD
REMOTE = git https://github.com/antranigv/voclibucl 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s src/ucl.Mod;CFLAGS=-lucl voc -m test/libucl_test.Mod;cp test/example.ucl .
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = libxo
VERSION = 0.1.0
AUTHOR = antranigv
LICENSE = BSD
REMOTE = git https://github.com/antranigv/voclibxo 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s src/xo.Mod;CFLAGS=-lxo voc -m test/libxo_test.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = lists
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/lists 0.1.0
DEPS = strutils:0.1.0
RUN =
MAIN =
BUILD = voc -s src/List.Mod;voc -s src/StringList.Mod;voc -m test/testList.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = manush
VERSION = 0.1.1
AUTHOR = noch
LICENSE = BSD 2-Clause License
REMOTE = git https://github.com/illuria/manush 0.1
DEPS = lists:0.1 opts:0.1 pipes:0.1 skprJson:0.1
RUN =
MAIN =
BUILD = voc -s src/mnshList.Mod;voc -s src/mnshUnix.Mod;voc -s src/mnshDefs.Mod;voc -s src/mnshCrt.Mod;voc -s src/mnshStorage.Mod;voc -s src/mnshExtTools.Mod;voc -s src/mnshTerm.Mod;voc -s src/mnshInput.Mod;voc -M src/manush.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = oberonDS
VERSION = 0.1.0
AUTHOR = InnaKhachikyan
LICENSE = unknown
REMOTE = git https://github.com/InnaKhachikyan/oberonDS 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s src/DynamicArray.Mod;voc -s src/HashMap.Mod;voc -s src/Map.Mod;voc -m test/DynamicArrayTest.Mod;voc -m test/HashMapTest.Mod;voc -m test/MapTest.Mod
TEST_RUN =
TEST_MAIN =
TEST =

17
opts/opts-0.1.0.vipakfile Normal file
View file

@ -0,0 +1,17 @@
NAME = opts
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/opts 0.1.0
DEPS = lists:0.1.0
RUN =
MAIN =
BUILD = voc -s src/optsos.Mod;voc -s src/opts.Mod;voc -m src/testopts.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = pipes
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/pipes 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s src/pipes.Mod;voc -m src/testPipes.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = postgres
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/postgres 0.1.0
DEPS = pipes:0.1.0
RUN =
MAIN =
BUILD = voc -s postgres.Mod;voc -m PostgresTests.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = skprJson
VERSION = 0.1.0
AUTHOR = shekspir55
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/skprJson 0.1.0
DEPS = lists:0.1.0 skprLogger:0.1.0
RUN =
MAIN =
BUILD = voc -s src/skprCharStack.Mod;voc -s src/skprJson.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = skprLogger
VERSION = 0.1.0
AUTHOR = shekspir55
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/skprLogger 0.1.0
DEPS = time:0.1.0
RUN =
MAIN =
BUILD = voc -s src/skprLogger.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = strutils
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/strutils 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s src/strTypes.Mod;voc -s src/strUtils.Mod;voc -m test/testStrUtils.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = strutils2
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE =
DEPS =
RUN =
MAIN =
BUILD = ;
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = test_server
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/test_server 0.1.0
DEPS = lists:0.1.0 Internet:0.1.0 time:0.1.0 fifo:0.1.0
RUN =
MAIN =
BUILD = voc -m src/testServer.Mod;voc -m src/testClient.Mod
TEST_RUN =
TEST_MAIN =
TEST =

17
time/time-0.1.0.vipakfile Normal file
View file

@ -0,0 +1,17 @@
NAME = time
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/time 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s src/time.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = unixFileSystem
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/unixFileSystem 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s src/UnixFS.Mod;voc -m test/TestUnixFS.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = unixfs
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/unixfs 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s src/unixFiles.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = vpicl
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/vpicl 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s POutput.Mod;voc -s PErrors.Mod;voc -s PICS.Mod;voc -m PICL.Mod
TEST_RUN =
TEST_MAIN =
TEST =

View file

@ -0,0 +1,17 @@
NAME = xattr
VERSION = 0.1.0
AUTHOR = noch
LICENSE = GPL-3
REMOTE = git https://github.com/norayr/xattr 0.1.0
DEPS =
RUN =
MAIN =
BUILD = voc -s src/xattr.Mod
TEST_RUN =
TEST_MAIN =
TEST =