use gzip
for runner embedding (#2067)
This commit is contained in:
parent
62976087c6
commit
dc88cc3981
4 changed files with 18 additions and 13 deletions
|
@ -84,7 +84,7 @@ compress_libs() {
|
|||
echo "Compressing payloads to reduce overall binary size..."
|
||||
pids=""
|
||||
for lib in ${BUILD_DIR}/lib/*.${LIB_EXT}* ; do
|
||||
bzip2 -v9 ${lib} &
|
||||
gzip --best ${lib} &
|
||||
pids+=" $!"
|
||||
done
|
||||
echo
|
||||
|
|
|
@ -23,7 +23,7 @@ function init_vars {
|
|||
} else {
|
||||
$script:CUDA_LIB_DIR=$env:CUDA_LIB_DIR
|
||||
}
|
||||
$script:BZIP2=(get-command -ea 'silentlycontinue' bzip2).path
|
||||
$script:GZIP=(get-command -ea 'silentlycontinue' gzip).path
|
||||
$script:DUMPBIN=(get-command -ea 'silentlycontinue' dumpbin).path
|
||||
}
|
||||
|
||||
|
@ -69,14 +69,14 @@ function install {
|
|||
}
|
||||
|
||||
function compress_libs {
|
||||
if ($script:BZIP2 -eq $null) {
|
||||
write-host "bzip2 not installed, not compressing files"
|
||||
if ($script:GZIP -eq $null) {
|
||||
write-host "gzip not installed, not compressing files"
|
||||
return
|
||||
}
|
||||
write-host "Compressing dlls..."
|
||||
$libs = dir "${script:buildDir}/lib/*.dll"
|
||||
foreach ($file in $libs) {
|
||||
& "$script:BZIP2" -v9 $file
|
||||
& "$script:GZIP" --best $file
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package llm
|
||||
|
||||
import (
|
||||
"compress/bzip2"
|
||||
"compress/gzip"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
@ -182,9 +182,12 @@ func extractDynamicLibs(workDir, glob string) ([]string, error) {
|
|||
}
|
||||
src := io.Reader(srcFile)
|
||||
filename := file
|
||||
if strings.HasSuffix(file, ".bz2") {
|
||||
src = bzip2.NewReader(src)
|
||||
filename = strings.TrimSuffix(filename, ".bz2")
|
||||
if strings.HasSuffix(file, ".gz") {
|
||||
src, err = gzip.NewReader(src)
|
||||
if err != nil {
|
||||
return fmt.Errorf("decompress payload %s: %v", file, err)
|
||||
}
|
||||
filename = strings.TrimSuffix(filename, ".gz")
|
||||
}
|
||||
|
||||
destFile := filepath.Join(targetDir, filepath.Base(filename))
|
||||
|
@ -229,9 +232,12 @@ func extractPayloadFiles(workDir, glob string) error {
|
|||
}
|
||||
src := io.Reader(srcFile)
|
||||
filename := file
|
||||
if strings.HasSuffix(file, ".bz2") {
|
||||
src = bzip2.NewReader(src)
|
||||
filename = strings.TrimSuffix(filename, ".bz2")
|
||||
if strings.HasSuffix(file, ".gz") {
|
||||
src, err = gzip.NewReader(src)
|
||||
if err != nil {
|
||||
return fmt.Errorf("decompress payload %s: %v", file, err)
|
||||
}
|
||||
filename = strings.TrimSuffix(filename, ".gz")
|
||||
}
|
||||
|
||||
destFile := filepath.Join(workDir, filepath.Base(filename))
|
||||
|
|
|
@ -28,7 +28,6 @@ fi
|
|||
|
||||
if [ -n "${CMAKE_VERSION}" ]; then
|
||||
curl -s -L https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-$(uname -m).tar.gz | tar -zx -C /usr --strip-components 1
|
||||
dnf install -y bzip2
|
||||
fi
|
||||
|
||||
if [ -n "${GOLANG_VERSION}" ]; then
|
||||
|
|
Loading…
Reference in a new issue