From c2d48c1a13afc87762cc60753c82fde6c726f54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=A5=D1=80?= =?UTF-8?q?=D0=B0=D0=BC=D0=BE=D0=B2?= Date: Sat, 6 Dec 2025 13:08:13 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC?= =?UTF-8?q?=D0=B0=20=D0=B4=D1=83=D0=B1=D0=BB=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9=20=D0=BF=D0=B0=D0=BA=D0=B5=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=20=D1=81=20=D0=BF=D0=BE=D0=B4=D0=BF=D0=B0=D0=BA=D0=B5=D1=82?= =?UTF-8?q?=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Изменения: - Заменён вызов InstallALRPackages на InstallPkgs в upgrade.go - Переименована функция mapUptatesInfoToPackages в mapUpdatesToPackageNames - Добавлена дедупликация подпакетов по полному имени (package+repo) - Теперь возвращаются строки с именами пакетов вместо объектов Package --- pkg/alrsh/package_gen.go | 16 ---------------- upgrade.go | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/pkg/alrsh/package_gen.go b/pkg/alrsh/package_gen.go index 834deb8..0fca143 100644 --- a/pkg/alrsh/package_gen.go +++ b/pkg/alrsh/package_gen.go @@ -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 . - // DO NOT EDIT MANUALLY. This file is generated. package alrsh diff --git a/upgrade.go b/upgrade.go index c242479..842c7b7 100644 --- a/upgrade.go +++ b/upgrade.go @@ -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 {