2 Commits

Author SHA1 Message Date
42f0d5e575 Исправление дублирования "alr" в названии пакета
All checks were successful
Pre-commit / pre-commit (push) Successful in 5m6s
Create Release / changelog (push) Successful in 3m7s
2025-09-21 13:43:36 +03:00
7b9404a058 Исправление обработки зависимостей на debian-based
All checks were successful
Pre-commit / pre-commit (push) Successful in 5m28s
Create Release / changelog (push) Successful in 3m6s
2025-09-21 12:36:48 +03:00
2 changed files with 12 additions and 4 deletions

View File

@@ -176,8 +176,13 @@ func getBasePkgInfo(vars *alrsh.Package, input interface {
OsInfoProvider
},
) *nfpm.Info {
repo := input.Repository()
// Избегаем дублирования "alr-" префикса
if strings.HasPrefix(repo, "alr-") {
repo = repo[4:] // убираем "alr-" префикс
}
return &nfpm.Info{
Name: fmt.Sprintf("%s+alr-%s", vars.Name, input.Repository()),
Name: fmt.Sprintf("%s+alr-%s", vars.Name, repo),
Arch: cpu.Arch(),
Version: vars.Version,
Release: overrides.ReleasePlatformSpecific(vars.Release, input.OSRelease()),

View File

@@ -140,16 +140,19 @@ func (a *APT) ListInstalled(opts *Opts) (map[string]string, error) {
}
func (a *APT) IsInstalled(pkg string) (bool, error) {
cmd := exec.Command("dpkg-query", "-l", pkg)
cmd := exec.Command("dpkg-query", "-f", "${Status}", "-W", pkg)
output, err := cmd.CombinedOutput()
if err != nil {
if exitErr, ok := err.(*exec.ExitError); ok {
// Exit code 1 means the package is not installed
// Код выхода 1 означает что пакет не найден
if exitErr.ExitCode() == 1 {
return false, nil
}
}
return false, fmt.Errorf("apt: isinstalled: %w, output: %s", err, output)
}
return true, nil
status := strings.TrimSpace(string(output))
// Проверяем что пакет действительно установлен (статус должен содержать "install ok installed")
return strings.Contains(status, "install ok installed"), nil
}