Исправление работоспособности pre-commit.yaml 2
Some checks failed
Pre-commit / pre-commit (push) Failing after 5m42s

This commit is contained in:
2025-08-26 22:25:03 +03:00
parent aa42ab0607
commit 1089e8a3f3
4 changed files with 13 additions and 10 deletions

View File

@@ -19,6 +19,7 @@ package build
import (
"fmt"
"io"
"log/slog"
"os"
"path/filepath"
"regexp"
@@ -51,8 +52,9 @@ func prepareDirs(dirs types.Directories) error {
// Пробуем удалить базовую директорию, если она существует
err := os.RemoveAll(dirs.BaseDir)
if err != nil {
// Если не можем удалить (например, принадлежит root), игнорируем
// и попробуем создать новые директории
// Если не можем удалить (например, принадлежит root), логируем и продолжаем
// Новые директории будут созданы или перезаписаны
slog.Debug("Failed to remove base directory", "path", dirs.BaseDir, "error", err)
}
// Создаем директории с правильным владельцем для /tmp/alr с setgid битом

View File

@@ -206,11 +206,7 @@ func (r aurResult) GenerateInstallCommands() string {
// install-license команды
for _, license := range r.LicenseFiles {
if license == "LICENSE" || license == "./LICENSE" {
commands = append(commands, fmt.Sprintf("\tinstall-license %s %s/LICENSE", license, r.Name))
} else {
commands = append(commands, fmt.Sprintf("\tinstall-license %s %s/LICENSE", license, r.Name))
}
}
// install-manual команды
@@ -302,7 +298,6 @@ func parseSources(pkgbuild string) []string {
source = strings.ReplaceAll(source, "${pkgname}", "${name}")
// Обрабатываем другие переменные (упрощенно)
source = strings.ReplaceAll(source, "$_commit", "${_commit}")
source = strings.ReplaceAll(source, "${_commit}", "${_commit}")
sources = append(sources, source)
}
}

View File

@@ -62,8 +62,8 @@ func (dc *DownloadCache) New(ctx context.Context, id string) (string, error) {
}
}
// Используем специальную функцию для создания каталогов
err = utils.EnsureTempDirWithRootOwner(itemPath, 0o755)
// Используем специальную функцию для создания каталогов с setgid битом
err = utils.EnsureTempDirWithRootOwner(itemPath, 0o2775)
if err != nil {
return "", err
}

View File

@@ -82,6 +82,12 @@ func TestNew(t *testing.T) {
fi, err := os.Stat(dir)
if err != nil {
t.Errorf("stat: expected no error, got %s", err)
return
}
if fi == nil {
t.Errorf("Expected file info to not be nil")
return
}
if !fi.IsDir() {