fix installing multiple packages #58

Merged
xpamych merged 1 commits from Maks1mS/ALR:fix/50 into master 2025-03-26 07:14:18 +00:00
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{
"ubuntu-24.04",
"alt-sisyphus",
"archlinux",
//"alpine",
"opensuse-leap",
"redos-8",
// "alt-sisyphus",
// "archlinux",
// "alpine",
// "opensuse-leap",
// "redos-8",
}
var COMMON_SYSTEMS []string = []string{
@ -155,6 +155,7 @@ func dockerMultipleRun(t *testing.T, name string, ids []string, f func(t *testin
Volumes: []string{
"./alr:/usr/bin/alr",
},
Privileged: true,
},
)
assert.NoError(t, e2e.StartAndWaitReady(runnable))

@ -1,5 +1,7 @@
FROM ubuntu:24.10
RUN apt update && apt install -y ca-certificates
RUN useradd -m -s /bin/bash alr-user
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates sudo
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
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"
msgstr ""
#: pkg/build/build.go:517
#: pkg/build/build.go:521
msgid "Installing dependencies"
msgstr ""
#: pkg/build/build.go:598
#: pkg/build/build.go:602
msgid "Would you like to remove the build dependencies?"
msgstr ""
#: pkg/build/build.go:661
#: pkg/build/build.go:665
msgid "Executing prepare()"
msgstr ""
#: pkg/build/build.go:671
#: pkg/build/build.go:675
msgid "Executing build()"
msgstr ""
#: pkg/build/build.go:701 pkg/build/build.go:721
#: pkg/build/build.go:705 pkg/build/build.go:725
msgid "Executing %s()"
msgstr ""
#: pkg/build/build.go:780
#: pkg/build/build.go:784
msgid "Error installing native packages"
msgstr ""
#: pkg/build/build.go:804
#: pkg/build/build.go:808
msgid "Error installing package"
msgstr ""
#: pkg/build/build.go:863
#: pkg/build/build.go:867
msgid "AutoProv is not implemented for this package format, so it's skipped"
msgstr ""
#: pkg/build/build.go:874
#: pkg/build/build.go:878
msgid "AutoReq is not implemented for this package format, so it's skipped"
msgstr ""

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

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