1 Commits

Author SHA1 Message Date
c2d48c1a13 Исправлена проблема дублирования обновлений пакетов с подпакетами
Some checks failed
Pre-commit / pre-commit (push) Failing after 8m9s
Create Release / changelog (push) Successful in 3m30s
Изменения:
- Заменён вызов InstallALRPackages на InstallPkgs в upgrade.go
- Переименована функция mapUptatesInfoToPackages в mapUpdatesToPackageNames
- Добавлена дедупликация подпакетов по полному имени (package+repo)
- Теперь возвращаются строки с именами пакетов вместо объектов Package
2025-12-06 13:08:13 +03:00
2 changed files with 13 additions and 22 deletions

View File

@@ -1,19 +1,3 @@
// ALR - Any Linux Repository
// Copyright (C) 2025 The ALR Authors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// DO NOT EDIT MANUALLY. This file is generated.
package alrsh

View File

@@ -114,7 +114,7 @@ func UpgradeCmd() *cli.Command {
}
if len(updates) > 0 {
err = builder.InstallALRPackages(
_, err = builder.InstallPkgs(
ctx,
&build.BuildArgs{
Opts: &types.BuildOpts{
@@ -124,7 +124,7 @@ func UpgradeCmd() *cli.Command {
Info: deps.Info,
PkgFormat_: build.GetPkgFormat(deps.Manager),
},
mapUptatesInfoToPackages(updates),
mapUpdatesToPackageNames(updates),
)
if err != nil {
return cliutils.FormatCliExit(gotext.Get("Error checking for updates"), err)
@@ -138,12 +138,19 @@ func UpgradeCmd() *cli.Command {
}
}
func mapUptatesInfoToPackages(updates []UpdateInfo) []alrsh.Package {
var pkgs []alrsh.Package
func mapUpdatesToPackageNames(updates []UpdateInfo) []string {
seen := make(map[string]bool)
var pkgNames []string
for _, info := range updates {
pkgs = append(pkgs, *info.Package)
fullName := fmt.Sprintf("%s+%s", info.Package.Name, info.Package.Repository)
if !seen[fullName] {
seen[fullName] = true
pkgNames = append(pkgNames, fullName)
}
}
return pkgs
return pkgNames
}
type UpdateInfo struct {