fix: resolve absolute path of ScriptDir

This commit is contained in:
Maxim Slipenko 2025-03-11 20:28:41 +03:00
parent af57165c89
commit 27e2f54653
3 changed files with 48 additions and 41 deletions

@ -357,77 +357,77 @@ msgstr ""
msgid "Error while running app"
msgstr ""
#: pkg/build/build.go:153
#: pkg/build/build.go:156
msgid "Failed to prompt user to view build script"
msgstr ""
#: pkg/build/build.go:157
#: pkg/build/build.go:160
msgid "Building package"
msgstr ""
#: pkg/build/build.go:228
#: pkg/build/build.go:231
msgid "Downloading sources"
msgstr ""
#: pkg/build/build.go:250
#: pkg/build/build.go:253
msgid "Building package metadata"
msgstr ""
#: pkg/build/build.go:272
#: pkg/build/build.go:275
msgid "Compressing package"
msgstr ""
#: pkg/build/build.go:426
#: pkg/build/build.go:434
msgid ""
"Your system's CPU architecture doesn't match this package. Do you want to "
"build anyway?"
msgstr ""
#: pkg/build/build.go:440
#: pkg/build/build.go:448
msgid "This package is already installed"
msgstr ""
#: pkg/build/build.go:464
#: pkg/build/build.go:472
msgid "Installing build dependencies"
msgstr ""
#: pkg/build/build.go:505
#: pkg/build/build.go:513
msgid "Installing dependencies"
msgstr ""
#: pkg/build/build.go:540
#: pkg/build/build.go:548
msgid "The checksums array must be the same length as sources"
msgstr ""
#: pkg/build/build.go:591
#: pkg/build/build.go:599
msgid "Would you like to remove the build dependencies?"
msgstr ""
#: pkg/build/build.go:654
#: pkg/build/build.go:662
msgid "Executing prepare()"
msgstr ""
#: pkg/build/build.go:664
#: pkg/build/build.go:672
msgid "Executing build()"
msgstr ""
#: pkg/build/build.go:694 pkg/build/build.go:714
#: pkg/build/build.go:702 pkg/build/build.go:722
msgid "Executing %s()"
msgstr ""
#: pkg/build/build.go:773
#: pkg/build/build.go:781
msgid "Error installing native packages"
msgstr ""
#: pkg/build/build.go:797
#: pkg/build/build.go:805
msgid "Error installing package"
msgstr ""
#: pkg/build/build.go:857
#: pkg/build/build.go:864
msgid "AutoProv is not implemented for this package format, so it's skipped"
msgstr ""
#: pkg/build/build.go:868
#: pkg/build/build.go:875
msgid "AutoReq is not implemented for this package format, so it's skipped"
msgstr ""

@ -371,27 +371,27 @@ msgstr "Показать справку"
msgid "Error while running app"
msgstr "Ошибка при запуске приложения"
#: pkg/build/build.go:153
#: pkg/build/build.go:156
msgid "Failed to prompt user to view build script"
msgstr "Не удалось предложить пользователю просмотреть скрипт сборки"
#: pkg/build/build.go:157
#: pkg/build/build.go:160
msgid "Building package"
msgstr "Сборка пакета"
#: pkg/build/build.go:228
#: pkg/build/build.go:231
msgid "Downloading sources"
msgstr "Скачивание источников"
#: pkg/build/build.go:250
#: pkg/build/build.go:253
msgid "Building package metadata"
msgstr "Сборка метаданных пакета"
#: pkg/build/build.go:272
#: pkg/build/build.go:275
msgid "Compressing package"
msgstr "Сжатие пакета"
#: pkg/build/build.go:426
#: pkg/build/build.go:434
msgid ""
"Your system's CPU architecture doesn't match this package. Do you want to "
"build anyway?"
@ -399,52 +399,52 @@ msgstr ""
"Архитектура процессора вашей системы не соответствует этому пакету. Вы все "
"равно хотите выполнить сборку?"
#: pkg/build/build.go:440
#: pkg/build/build.go:448
msgid "This package is already installed"
msgstr "Этот пакет уже установлен"
#: pkg/build/build.go:464
#: pkg/build/build.go:472
msgid "Installing build dependencies"
msgstr "Установка зависимостей сборки"
#: pkg/build/build.go:505
#: pkg/build/build.go:513
msgid "Installing dependencies"
msgstr "Установка зависимостей"
#: pkg/build/build.go:540
#: pkg/build/build.go:548
msgid "The checksums array must be the same length as sources"
msgstr "Массив контрольных сумм должен быть той же длины, что и источники"
#: pkg/build/build.go:591
#: pkg/build/build.go:599
msgid "Would you like to remove the build dependencies?"
msgstr "Хотели бы вы удалить зависимости сборки?"
#: pkg/build/build.go:654
#: pkg/build/build.go:662
msgid "Executing prepare()"
msgstr "Исполнение prepare()"
#: pkg/build/build.go:664
#: pkg/build/build.go:672
msgid "Executing build()"
msgstr "Исполнение build()"
#: pkg/build/build.go:694 pkg/build/build.go:714
#: pkg/build/build.go:702 pkg/build/build.go:722
msgid "Executing %s()"
msgstr "Исполнение %s()"
#: pkg/build/build.go:773
#: pkg/build/build.go:781
msgid "Error installing native packages"
msgstr "Ошибка при установке нативных пакетов"
#: pkg/build/build.go:797
#: pkg/build/build.go:805
msgid "Error installing package"
msgstr "Ошибка при установке пакета"
#: pkg/build/build.go:857
#: pkg/build/build.go:864
msgid "AutoProv is not implemented for this package format, so it's skipped"
msgstr ""
"AutoProv не реализовано для этого формата пакета, поэтому будет пропущено"
#: pkg/build/build.go:868
#: pkg/build/build.go:875
msgid "AutoReq is not implemented for this package format, so it's skipped"
msgstr ""
"AutoReq не реализовано для этого формата пакета, поэтому будет пропущено"

@ -111,7 +111,10 @@ func (b *Builder) BuildPackage(ctx context.Context) ([]string, []string, error)
return nil, nil, err
}
dirs := b.getDirs(basePkg)
dirs, err := b.getDirs(basePkg)
if err != nil {
return nil, nil, err
}
builtPaths := make([]string, 0)
@ -379,14 +382,19 @@ func (b *Builder) executeFirstPass(
}
// Функция getDirs возвращает соответствующие директории для скрипта
func (b *Builder) getDirs(basePkg string) types.Directories {
func (b *Builder) getDirs(basePkg string) (types.Directories, error) {
scriptPath, err := filepath.Abs(b.opts.Script)
if err != nil {
return types.Directories{}, err
}
baseDir := filepath.Join(b.config.GetPaths(b.ctx).PkgsDir, basePkg) // Определяем базовую директорию
return types.Directories{
BaseDir: baseDir,
SrcDir: filepath.Join(baseDir, "src"),
PkgDir: filepath.Join(baseDir, "pkg"),
ScriptDir: filepath.Dir(b.opts.Script),
}
ScriptDir: filepath.Dir(scriptPath),
}, nil
}
// Функция executeSecondPass выполняет скрипт сборки второй раз без каких-либо ограничений. Возвращается декодер,
@ -844,7 +852,6 @@ func (b *Builder) buildPkgMetadata(
if err != nil {
return nil, err
}
slog.Info("contents", "contents", contents)
pkgInfo.Overridables.Contents = contents
if len(vars.AutoProv) == 1 && decoder.IsTruthy(vars.AutoProv[0]) {