]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
change builder smaller
authorBastian Dehn <hhaalo@arcor.de>
Wed, 30 Sep 2026 14:15:23 +0000 (16:15 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 30 Sep 2026 14:15:23 +0000 (16:15 +0200)
builder/Containerfile.template
src/lib/flac.sh
src/lib/mp3.sh
src/lib/opus.sh
src/lib/vorbis.sh
tests/flac.bats
tests/mp3.bats
tests/opus.bats
tests/vorbis.bats

index 77d28fe10a9363020780f37017a10738ad190816..c4706daa2d09effd2f557ba279ac367d9a4f2333 100644 (file)
@@ -18,12 +18,6 @@ RUN apt-get update \
        bats-support \
        bats-assert \
        shellcheck \
-       flac \
-       lame \
-       eyed3 \
-       opus-tools \
-       vorbis-tools \
-       parallel \
        && apt-get clean \
        && rm --recursive --force /var/lib/apt/lists/*
 COPY run /app/run
index 3acf7c6cc368da17eec02efcb38513f29f8c26b8..7a07b1f066c889ea49b6def0fc473ed8eed598a6 100644 (file)
@@ -1,14 +1,5 @@
 #!/bin/bash
 
-flac_errlog()
-{
-       local lastexit=$?
-       local msg="$1"
-
-       echo "❌ ERROR: $msg"
-       return $lastexit
-}
-
 flac_add_picture()
 {
        local work_path="$1"
@@ -29,20 +20,8 @@ flac_add_picture()
        done
 }
 
-flac_check_programs()
-{
-       command -v metaflac > /dev/null \
-               || flac_errlog "command metaflac not found" \
-               || return $?
-}
-
 flac_encode()
 {
        local work_path="$1"
-       [ -n "$work_path" ] \
-               || flac_errlog "missing work path" \
-               || return $?
        flac_add_picture "$work_path"
-}
-
-flac_check_programs || return $?
\ No newline at end of file
+}
\ No newline at end of file
index 4174645a66d5eeccbb011a037d7b5ff641cb4a22..979d8fe4669a7ef4495a26a8a401ba3ec49ef417 100644 (file)
@@ -11,9 +11,6 @@ mp3_errlog()
 
 mp3_check_programs()
 {
-       command -v flac > /dev/null \
-               || mp3_errlog "command flac not found" \
-               || return $?
        command -v lame > /dev/null \
                || mp3_errlog "command lame not found" \
                || return $?
@@ -125,6 +122,7 @@ mp3_encode()
                mp3_encode_flac "{}"
 }
 
+[ "$TEST_MODE" == "ON" ] && return 0
 mp3_check_programs || return $?
 export -f mp3_encode_flac
 export -f mp3_flacmetadata_to_mp3_tag
\ No newline at end of file
index 5dc52f6749a61236cb198a2cc7bdd0f10895b37e..48b2e08a77c507ad36c0fd880789a9df32382de4 100644 (file)
@@ -50,5 +50,6 @@ opus_encode()
                opus_encode_flac "{}"
 }
 
+[ "$TEST_MODE" == "ON" ] && return 0
 opus_check_programs || return $?
 export -f opus_encode_flac
\ No newline at end of file
index 612fbd01378d2fffaf4025641aff26dcf7482898..33646374ce26733e77b1c20218d1c669ae2bf9ac 100644 (file)
@@ -11,12 +11,6 @@ vorbis_errlog()
 
 vorbis_check_programs()
 {
-       command -v flac > /dev/null \
-               || vorbis_errlog "command flac not found" \
-               || return $?
-       command -v metaflac > /dev/null \
-               || vorbis_errlog "command metaflac not found" \
-               || return $?
        command -v oggenc > /dev/null \
                || vorbis_errlog "command oggenc not found" \
                || return $?
@@ -122,6 +116,7 @@ vorbis_encode()
                vorbis_encode_flac "{}"
 }
 
+[ "$TEST_MODE" == "ON" ] && return 0
 vorbis_check_programs || return $?
 export -f vorbis_write_number_to_byte
 export -f vorbis_cover_to_metadata
index af592f55e08748bb4cd7378e60b201e5e9e52f57..d3ee989e6373c7682bb9b2cd0648373b5b89bea9 100755 (executable)
@@ -4,6 +4,7 @@ setup() {
        bats_load_library 'bats-support'
        bats_load_library 'bats-assert'
        export METAFLAC_LOG="build/metaflac.log"
+       export TEST_MODE="ON"
        source "src/lib/flac.sh"
 }
 
@@ -20,26 +21,6 @@ teardown_file() {
        rm --recursive --force "build/tests"
 }
 
-# bats test_tags=flac:check_programs
-@test "failed: check programs missing metaflac" {
-       command() {
-               [ "$2" != "metaflac" ] || return 1
-       }
-
-       run flac_check_programs
-
-       assert_failure
-       assert_line --index 0 "❌ ERROR: command metaflac not found"
-}
-
-# bats test_tags=flac:params
-@test "failed: mising work path" {
-       run flac_encode
-
-       assert_failure
-       assert_line --index 0 "❌ ERROR: missing work path"
-}
-
 # bats test_tags=flac:addpicture
 @test "success: add picture to flac" {
        echo "testfile" > "build/tests/output/file.flac"
index e5ab7772107f325522c394d7a684db3ffe7e4373..e9dca9aa7731bfa50f921f63dd9c134dfc9a8a27 100755 (executable)
@@ -3,21 +3,10 @@
 setup() {
        bats_load_library 'bats-support'
        bats_load_library 'bats-assert'
+       export TEST_MODE="ON"
        source "src/lib/mp3.sh"
 }
 
-# bats test_tags=mp3:check_programs
-@test "failed: check programs missing flac" {
-       command() {
-               [ "$2" != "flac" ] || return 1
-       }
-
-       run mp3_check_programs
-
-       assert_failure
-       assert_line --index 0 "❌ ERROR: command flac not found"
-}
-
 # bats test_tags=mp3:check_programs
 @test "failed: check programs missing lame" {
        command() {
index 28439fe22954b63cab24dd70be93728d08b15e92..bd187df01cfcf170cd581edbb73af273ee91c2c1 100755 (executable)
@@ -3,6 +3,7 @@
 setup() {
        bats_load_library 'bats-support'
        bats_load_library 'bats-assert'
+       export TEST_MODE="ON"
        source "src/lib/opus.sh"
 }
 
index eadff2289287250fa35aae0832db4492392950c1..a0d429f15e6557229618e82c58294aa8b49434a9 100755 (executable)
@@ -3,6 +3,7 @@
 setup() {
        bats_load_library 'bats-support'
        bats_load_library 'bats-assert'
+       export TEST_MODE="ON"
        source "src/lib/vorbis.sh"
 }
 
@@ -14,30 +15,6 @@ teardown_file() {
        rm --recursive --force "build/tests"
 }
 
-# bats test_tags=vorbis:check_programs
-@test "failed: check programs missing flac" {
-       command() {
-               [ "$2" != "flac" ] || return 1
-       }
-
-       run vorbis_check_programs
-
-       assert_failure
-       assert_line --index 0 "❌ ERROR: command flac not found"
-}
-
-# bats test_tags=vorbis:check_programs
-@test "failed: check programs missing metaflac" {
-       command() {
-               [ "$2" != "metaflac" ] || return 1
-       }
-
-       run vorbis_check_programs
-
-       assert_failure
-       assert_line --index 0 "❌ ERROR: command metaflac not found"
-}
-
 # bats test_tags=vorbis:check_programs
 @test "failed: check programs missing oggenc" {
        command() {