fix: remove debug logs and fix cache clearing
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
||||
<text x="33.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
||||
<text x="33.5" y="14">coverage</text>
|
||||
<text x="86" y="15" fill="#010101" fill-opacity=".3">17.6%</text>
|
||||
<text x="86" y="14">17.6%</text>
|
||||
<text x="86" y="15" fill="#010101" fill-opacity=".3">17.5%</text>
|
||||
<text x="86" y="14">17.5%</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 926 B After Width: | Height: | Size: 926 B |
30
fix.go
30
fix.go
@ -20,6 +20,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -57,7 +58,6 @@ func FixCmd() *cli.Command {
|
||||
paths := cfg.GetPaths()
|
||||
|
||||
slog.Info(gotext.Get("Clearing cache directory"))
|
||||
// Remove all nested directories of paths.CacheDir
|
||||
|
||||
dir, err := os.Open(paths.CacheDir)
|
||||
if err != nil {
|
||||
@ -71,7 +71,13 @@ func FixCmd() *cli.Command {
|
||||
}
|
||||
|
||||
for _, entry := range entries {
|
||||
err = os.RemoveAll(filepath.Join(paths.CacheDir, entry))
|
||||
fullPath := filepath.Join(paths.CacheDir, entry)
|
||||
|
||||
if err := makeWritableRecursive(fullPath); err != nil {
|
||||
slog.Debug("Failed to make path writable", "path", fullPath, "error", err)
|
||||
}
|
||||
|
||||
err = os.RemoveAll(fullPath)
|
||||
if err != nil {
|
||||
return cliutils.FormatCliExit(gotext.Get("Unable to remove cache item (%s)", entry), err)
|
||||
}
|
||||
@ -101,3 +107,23 @@ func FixCmd() *cli.Command {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func makeWritableRecursive(path string) error {
|
||||
return filepath.WalkDir(path, func(path string, d fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
info, err := d.Info()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
newMode := info.Mode() | 0o200
|
||||
if d.IsDir() {
|
||||
newMode |= 0o100
|
||||
}
|
||||
|
||||
return os.Chmod(path, newMode)
|
||||
})
|
||||
}
|
||||
|
@ -200,7 +200,6 @@ func buildPkgMetadata(
|
||||
preferedContents *[]string,
|
||||
) (*nfpm.Info, error) {
|
||||
pkgInfo := getBasePkgInfo(vars, input)
|
||||
slog.Warn("vars.Description", "vars.Description", vars.Description, "vars.Description.Resolved", vars.Description.Resolved())
|
||||
pkgInfo.Description = vars.Description.Resolved()
|
||||
pkgInfo.Platform = "linux"
|
||||
pkgInfo.Homepage = vars.Homepage.Resolved()
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/leonelquinteros/gotext"
|
||||
"github.com/urfave/cli/v2"
|
||||
@ -45,12 +44,10 @@ func HandleExitCoder(err error) {
|
||||
slog.Error(err.Error())
|
||||
}
|
||||
}
|
||||
debug.PrintStack()
|
||||
cli.OsExiter(exitErr.ExitCode())
|
||||
return
|
||||
}
|
||||
|
||||
debug.PrintStack()
|
||||
slog.Error(err.Error())
|
||||
cli.OsExiter(1)
|
||||
}
|
||||
|
@ -58,11 +58,11 @@ msgstr ""
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: fix.go:38
|
||||
#: fix.go:39
|
||||
msgid "Attempt to fix problems with ALR"
|
||||
msgstr ""
|
||||
|
||||
#: fix.go:59
|
||||
#: fix.go:60
|
||||
msgid "Clearing cache directory"
|
||||
msgstr ""
|
||||
|
||||
@ -74,15 +74,15 @@ msgstr ""
|
||||
msgid "Unable to read cache directory contents"
|
||||
msgstr ""
|
||||
|
||||
#: fix.go:76
|
||||
#: fix.go:82
|
||||
msgid "Unable to remove cache item (%s)"
|
||||
msgstr ""
|
||||
|
||||
#: fix.go:80
|
||||
#: fix.go:86
|
||||
msgid "Rebuilding cache"
|
||||
msgstr ""
|
||||
|
||||
#: fix.go:84
|
||||
#: fix.go:90
|
||||
msgid "Unable to create new cache directory"
|
||||
msgstr ""
|
||||
|
||||
@ -224,15 +224,15 @@ msgstr ""
|
||||
msgid "Building package metadata"
|
||||
msgstr ""
|
||||
|
||||
#: internal/build/script_executor.go:276
|
||||
#: internal/build/script_executor.go:275
|
||||
msgid "Executing prepare()"
|
||||
msgstr ""
|
||||
|
||||
#: internal/build/script_executor.go:285
|
||||
#: internal/build/script_executor.go:284
|
||||
msgid "Executing build()"
|
||||
msgstr ""
|
||||
|
||||
#: internal/build/script_executor.go:314 internal/build/script_executor.go:334
|
||||
#: internal/build/script_executor.go:313 internal/build/script_executor.go:333
|
||||
msgid "Executing %s()"
|
||||
msgstr ""
|
||||
|
||||
@ -336,7 +336,7 @@ msgstr ""
|
||||
msgid "OPTIONS"
|
||||
msgstr ""
|
||||
|
||||
#: internal/cliutils/utils.go:72
|
||||
#: internal/cliutils/utils.go:69
|
||||
msgid ""
|
||||
"This command is deprecated and would be removed in the future, use \"%s\" "
|
||||
"instead!"
|
||||
|
@ -65,11 +65,11 @@ msgstr "Ошибка при перемещении пакета"
|
||||
msgid "Done"
|
||||
msgstr "Сделано"
|
||||
|
||||
#: fix.go:38
|
||||
#: fix.go:39
|
||||
msgid "Attempt to fix problems with ALR"
|
||||
msgstr "Попытка устранить проблемы с ALR"
|
||||
|
||||
#: fix.go:59
|
||||
#: fix.go:60
|
||||
msgid "Clearing cache directory"
|
||||
msgstr "Очистка каталога кэша"
|
||||
|
||||
@ -81,15 +81,15 @@ msgstr "Невозможно открыть каталог кэша"
|
||||
msgid "Unable to read cache directory contents"
|
||||
msgstr "Невозможно прочитать содержимое каталога кэша"
|
||||
|
||||
#: fix.go:76
|
||||
#: fix.go:82
|
||||
msgid "Unable to remove cache item (%s)"
|
||||
msgstr "Невозможно удалить элемент кэша (%s)"
|
||||
|
||||
#: fix.go:80
|
||||
#: fix.go:86
|
||||
msgid "Rebuilding cache"
|
||||
msgstr "Восстановление кэша"
|
||||
|
||||
#: fix.go:84
|
||||
#: fix.go:90
|
||||
msgid "Unable to create new cache directory"
|
||||
msgstr "Не удалось создать новый каталог кэша"
|
||||
|
||||
@ -235,15 +235,15 @@ msgstr ""
|
||||
msgid "Building package metadata"
|
||||
msgstr "Сборка метаданных пакета"
|
||||
|
||||
#: internal/build/script_executor.go:276
|
||||
#: internal/build/script_executor.go:275
|
||||
msgid "Executing prepare()"
|
||||
msgstr "Выполнение prepare()"
|
||||
|
||||
#: internal/build/script_executor.go:285
|
||||
#: internal/build/script_executor.go:284
|
||||
msgid "Executing build()"
|
||||
msgstr "Выполнение build()"
|
||||
|
||||
#: internal/build/script_executor.go:314 internal/build/script_executor.go:334
|
||||
#: internal/build/script_executor.go:313 internal/build/script_executor.go:333
|
||||
msgid "Executing %s()"
|
||||
msgstr "Выполнение %s()"
|
||||
|
||||
@ -347,7 +347,7 @@ msgstr "КАТЕГОРИЯ"
|
||||
msgid "OPTIONS"
|
||||
msgstr "ПАРАМЕТРЫ"
|
||||
|
||||
#: internal/cliutils/utils.go:72
|
||||
#: internal/cliutils/utils.go:69
|
||||
msgid ""
|
||||
"This command is deprecated and would be removed in the future, use \"%s\" "
|
||||
"instead!"
|
||||
@ -569,6 +569,10 @@ msgstr "Ошибка при проверке обновлений"
|
||||
msgid "There is nothing to do."
|
||||
msgstr "Здесь нечего делать."
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to clear contents of cache directory"
|
||||
#~ msgstr "Не удалось создать каталог кэша репозитория"
|
||||
|
||||
#~ msgid "Error iterating over packages"
|
||||
#~ msgstr "Ошибка при переборе пакетов"
|
||||
|
||||
@ -587,9 +591,6 @@ msgstr "Здесь нечего делать."
|
||||
#~ msgid "Unable to create config directory"
|
||||
#~ msgstr "Не удалось создать каталог конфигурации ALR"
|
||||
|
||||
#~ msgid "Unable to create repo cache directory"
|
||||
#~ msgstr "Не удалось создать каталог кэша репозитория"
|
||||
|
||||
#~ msgid "Unable to create package cache directory"
|
||||
#~ msgstr "Не удалось создать каталог кэша пакетов"
|
||||
|
||||
|
Reference in New Issue
Block a user