fix installing multiple packages

This commit is contained in:
Maxim Slipenko 2025-03-26 10:11:24 +03:00
parent 4b53e819d8
commit 6bee268ea9
6 changed files with 91 additions and 29 deletions

@ -100,11 +100,11 @@ func e2eSpawn(runnable e2e.Runnable, command e2e.Command, timeout time.Duration,
var ALL_SYSTEMS []string = []string{ var ALL_SYSTEMS []string = []string{
"ubuntu-24.04", "ubuntu-24.04",
"alt-sisyphus", // "alt-sisyphus",
"archlinux", // "archlinux",
//"alpine", // "alpine",
"opensuse-leap", // "opensuse-leap",
"redos-8", // "redos-8",
} }
var COMMON_SYSTEMS []string = []string{ var COMMON_SYSTEMS []string = []string{
@ -155,6 +155,7 @@ func dockerMultipleRun(t *testing.T, name string, ids []string, f func(t *testin
Volumes: []string{ Volumes: []string{
"./alr:/usr/bin/alr", "./alr:/usr/bin/alr",
}, },
Privileged: true,
}, },
) )
assert.NoError(t, e2e.StartAndWaitReady(runnable)) assert.NoError(t, e2e.StartAndWaitReady(runnable))

@ -1,5 +1,7 @@
FROM ubuntu:24.10 FROM ubuntu:24.10
RUN apt update && apt install -y ca-certificates RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates sudo
RUN useradd -m -s /bin/bash alr-user RUN useradd -m -s /bin/bash alr-user && \
echo "alr-user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/alr-user && \
chmod 0440 /etc/sudoers.d/alr-user
USER alr-user USER alr-user
ENTRYPOINT ["tail", "-f", "/dev/null"] ENTRYPOINT ["tail", "-f", "/dev/null"]

@ -0,0 +1,55 @@
// ALR - Any Linux Repository
// Copyright (C) 2025 Евгений Храмов
//
// 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/>.
//go:build e2e
package e2etests_test
import (
"testing"
"github.com/alecthomas/assert/v2"
"github.com/efficientgo/e2e"
)
func TestE2EIssue50InstallMultiple(t *testing.T) {
dockerMultipleRun(
t,
"issue-50-install-multiple",
COMMON_SYSTEMS,
func(t *testing.T, r e2e.Runnable) {
err := r.Exec(e2e.NewCommand(
"alr",
"addrepo",
"--name",
"alr-repo",
"--url",
"https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git",
))
assert.NoError(t, err)
err = r.Exec(e2e.NewCommand(
"alr", "in", "foo-pkg", "bar-pkg",
))
assert.NoError(t, err)
err = r.Exec(e2e.NewCommand("cat", "/opt/foo"))
assert.NoError(t, err)
err = r.Exec(e2e.NewCommand("cat", "/opt/bar"))
assert.NoError(t, err)
},
)
}

@ -375,39 +375,39 @@ msgstr ""
msgid "Installing build dependencies" msgid "Installing build dependencies"
msgstr "" msgstr ""
#: pkg/build/build.go:517 #: pkg/build/build.go:521
msgid "Installing dependencies" msgid "Installing dependencies"
msgstr "" msgstr ""
#: pkg/build/build.go:598 #: pkg/build/build.go:602
msgid "Would you like to remove the build dependencies?" msgid "Would you like to remove the build dependencies?"
msgstr "" msgstr ""
#: pkg/build/build.go:661 #: pkg/build/build.go:665
msgid "Executing prepare()" msgid "Executing prepare()"
msgstr "" msgstr ""
#: pkg/build/build.go:671 #: pkg/build/build.go:675
msgid "Executing build()" msgid "Executing build()"
msgstr "" msgstr ""
#: pkg/build/build.go:701 pkg/build/build.go:721 #: pkg/build/build.go:705 pkg/build/build.go:725
msgid "Executing %s()" msgid "Executing %s()"
msgstr "" msgstr ""
#: pkg/build/build.go:780 #: pkg/build/build.go:784
msgid "Error installing native packages" msgid "Error installing native packages"
msgstr "" msgstr ""
#: pkg/build/build.go:804 #: pkg/build/build.go:808
msgid "Error installing package" msgid "Error installing package"
msgstr "" msgstr ""
#: pkg/build/build.go:863 #: pkg/build/build.go:867
msgid "AutoProv is not implemented for this package format, so it's skipped" msgid "AutoProv is not implemented for this package format, so it's skipped"
msgstr "" msgstr ""
#: pkg/build/build.go:874 #: pkg/build/build.go:878
msgid "AutoReq is not implemented for this package format, so it's skipped" msgid "AutoReq is not implemented for this package format, so it's skipped"
msgstr "" msgstr ""

@ -389,40 +389,40 @@ msgstr "Этот пакет уже установлен"
msgid "Installing build dependencies" msgid "Installing build dependencies"
msgstr "Установка зависимостей сборки" msgstr "Установка зависимостей сборки"
#: pkg/build/build.go:517 #: pkg/build/build.go:521
msgid "Installing dependencies" msgid "Installing dependencies"
msgstr "Установка зависимостей" msgstr "Установка зависимостей"
#: pkg/build/build.go:598 #: pkg/build/build.go:602
msgid "Would you like to remove the build dependencies?" msgid "Would you like to remove the build dependencies?"
msgstr "Хотели бы вы удалить зависимости сборки?" msgstr "Хотели бы вы удалить зависимости сборки?"
#: pkg/build/build.go:661 #: pkg/build/build.go:665
msgid "Executing prepare()" msgid "Executing prepare()"
msgstr "Исполнение prepare()" msgstr "Исполнение prepare()"
#: pkg/build/build.go:671 #: pkg/build/build.go:675
msgid "Executing build()" msgid "Executing build()"
msgstr "Исполнение build()" msgstr "Исполнение build()"
#: pkg/build/build.go:701 pkg/build/build.go:721 #: pkg/build/build.go:705 pkg/build/build.go:725
msgid "Executing %s()" msgid "Executing %s()"
msgstr "Исполнение %s()" msgstr "Исполнение %s()"
#: pkg/build/build.go:780 #: pkg/build/build.go:784
msgid "Error installing native packages" msgid "Error installing native packages"
msgstr "Ошибка при установке нативных пакетов" msgstr "Ошибка при установке нативных пакетов"
#: pkg/build/build.go:804 #: pkg/build/build.go:808
msgid "Error installing package" msgid "Error installing package"
msgstr "Ошибка при установке пакета" msgstr "Ошибка при установке пакета"
#: pkg/build/build.go:863 #: pkg/build/build.go:867
msgid "AutoProv is not implemented for this package format, so it's skipped" msgid "AutoProv is not implemented for this package format, so it's skipped"
msgstr "" msgstr ""
"AutoProv не реализовано для этого формата пакета, поэтому будет пропущено" "AutoProv не реализовано для этого формата пакета, поэтому будет пропущено"
#: pkg/build/build.go:874 #: pkg/build/build.go:878
msgid "AutoReq is not implemented for this package format, so it's skipped" msgid "AutoReq is not implemented for this package format, so it's skipped"
msgstr "" msgstr ""
"AutoReq не реализовано для этого формата пакета, поэтому будет пропущено" "AutoReq не реализовано для этого формата пакета, поэтому будет пропущено"

@ -489,13 +489,17 @@ func (b *Builder) getBuildersForPackages(pkgs []db.Package) []*Builder {
} }
pkgsMap := make(map[string]*item) pkgsMap := make(map[string]*item)
for _, pkg := range pkgs { for _, pkg := range pkgs {
if pkgsMap[pkg.BasePkgName] == nil { name := pkg.BasePkgName
pkgsMap[pkg.BasePkgName] = &item{ if name == "" {
name = pkg.Name
}
if pkgsMap[name] == nil {
pkgsMap[name] = &item{
pkg: &pkg, pkg: &pkg,
} }
} }
pkgsMap[pkg.BasePkgName].packages = append( pkgsMap[name].packages = append(
pkgsMap[pkg.BasePkgName].packages, pkgsMap[name].packages,
pkg.Name, pkg.Name,
) )
} }