forked from Plemya-x/ALR
Compare commits
No commits in common. "5ca34a572a824524080455192511cd7223321659" and "4b53e819d8bec442b215b16e2c5e061efec0d425" have entirely different histories.
5ca34a572a
...
4b53e819d8
@ -11,7 +11,7 @@
|
|||||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
||||||
<text x="33.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
<text x="33.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
||||||
<text x="33.5" y="14">coverage</text>
|
<text x="33.5" y="14">coverage</text>
|
||||||
<text x="86" y="15" fill="#010101" fill-opacity=".3">19.0%</text>
|
<text x="86" y="15" fill="#010101" fill-opacity=".3">19.4%</text>
|
||||||
<text x="86" y="14">19.0%</text>
|
<text x="86" y="14">19.4%</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 926 B After Width: | Height: | Size: 926 B |
@ -1,40 +0,0 @@
|
|||||||
// 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 TestE2EBashCompletion(t *testing.T) {
|
|
||||||
dockerMultipleRun(
|
|
||||||
t,
|
|
||||||
"bash-completion",
|
|
||||||
COMMON_SYSTEMS,
|
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
|
||||||
err := r.Exec(e2e.NewCommand(
|
|
||||||
"alr", "install", "--generate-bash-completion",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
@ -101,16 +101,10 @@ 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",
|
||||||
"fedora-41",
|
"archlinux",
|
||||||
// "archlinux",
|
//"alpine",
|
||||||
// "alpine",
|
"opensuse-leap",
|
||||||
// "opensuse-leap",
|
"redos-8",
|
||||||
// "redos-8",
|
|
||||||
}
|
|
||||||
|
|
||||||
var AUTOREQ_AUTOPROV_SYSTEMS []string = []string{
|
|
||||||
"alt-sisyphus",
|
|
||||||
"fedora-41",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var COMMON_SYSTEMS []string = []string{
|
var COMMON_SYSTEMS []string = []string{
|
||||||
@ -161,7 +155,6 @@ 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,6 +1,5 @@
|
|||||||
FROM registry.altlinux.org/sisyphus/alt:latest
|
FROM registry.altlinux.org/sisyphus/alt:latest
|
||||||
RUN apt-get update && apt-get install -y ca-certificates rpm-build
|
RUN apt-get update && apt-get install -y ca-certificates
|
||||||
RUN useradd -m -s /bin/bash alr-user
|
RUN useradd -m -s /bin/bash alr-user
|
||||||
USER alr-user
|
USER alr-user
|
||||||
WORKDIR /home/alr-user
|
|
||||||
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
@ -1,8 +0,0 @@
|
|||||||
FROM fedora:41
|
|
||||||
RUN dnf install -y ca-certificates sudo rpm-build
|
|
||||||
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
|
|
||||||
WORKDIR /home/alr-user
|
|
||||||
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
|
@ -1,7 +1,5 @@
|
|||||||
FROM ubuntu:24.10
|
FROM ubuntu:24.10
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates sudo
|
RUN apt update && apt install -y ca-certificates
|
||||||
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"]
|
@ -1,40 +0,0 @@
|
|||||||
// 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 TestE2EIssue32Interactive(t *testing.T) {
|
|
||||||
dockerMultipleRun(
|
|
||||||
t,
|
|
||||||
"issue-32-interactive",
|
|
||||||
COMMON_SYSTEMS,
|
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
|
||||||
err := r.Exec(e2e.NewCommand(
|
|
||||||
"alr", "--interactive=false", "remove", "ca-certificates",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
// 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 TestE2EIssue41AutoreqSkiplist(t *testing.T) {
|
|
||||||
dockerMultipleRun(
|
|
||||||
t,
|
|
||||||
"issue-41-autoreq-skiplist",
|
|
||||||
AUTOREQ_AUTOPROV_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",
|
|
||||||
"ref",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"alr",
|
|
||||||
"build",
|
|
||||||
"-p",
|
|
||||||
"alr-repo/test-autoreq-autoprov",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sh",
|
|
||||||
"-c",
|
|
||||||
"rpm -qp --requires *.rpm | grep \"^/bin/sh$\"",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sh",
|
|
||||||
"-c",
|
|
||||||
"rpm -qp --requires *.rpm | grep \"^/bin/bash$\"",
|
|
||||||
))
|
|
||||||
assert.Error(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sh",
|
|
||||||
"-c",
|
|
||||||
"rpm -qp --requires *.rpm | grep \"^/bin/zsh$\"",
|
|
||||||
))
|
|
||||||
assert.Error(t, err)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
// 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)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
// 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 TestE2EIssue59RmCompletion(t *testing.T) {
|
|
||||||
dockerMultipleRun(
|
|
||||||
t,
|
|
||||||
"issue-59-rm-completion",
|
|
||||||
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("sh", "-c", "alr rm --generate-bash-completion | grep ^foo-pkg$"))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
err = r.Exec(e2e.NewCommand("sh", "-c", "alr rm --generate-bash-completion | grep ^bar-pkg$"))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
err = r.Exec(e2e.NewCommand("sh", "-c", "alr rm --generate-bash-completion | grep ^test-autoreq-autoprov$"))
|
|
||||||
assert.Error(t, err)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
71
install.go
71
install.go
@ -124,14 +124,8 @@ func InstallCmd() *cli.Command {
|
|||||||
},
|
},
|
||||||
BashComplete: func(c *cli.Context) {
|
BashComplete: func(c *cli.Context) {
|
||||||
cfg := config.New()
|
cfg := config.New()
|
||||||
err := cfg.Load()
|
|
||||||
if err != nil {
|
|
||||||
slog.Error(gotext.Get("Error loading config"), "err", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
db := database.New(cfg)
|
db := database.New(cfg)
|
||||||
err = db.Init(c.Context)
|
err := db.Init(c.Context)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error initialization database"), "err", err)
|
slog.Error(gotext.Get("Error initialization database"), "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
@ -162,64 +156,6 @@ func RemoveCmd() *cli.Command {
|
|||||||
Name: "remove",
|
Name: "remove",
|
||||||
Usage: gotext.Get("Remove an installed package"),
|
Usage: gotext.Get("Remove an installed package"),
|
||||||
Aliases: []string{"rm"},
|
Aliases: []string{"rm"},
|
||||||
BashComplete: func(c *cli.Context) {
|
|
||||||
cfg := config.New()
|
|
||||||
err := cfg.Load()
|
|
||||||
if err != nil {
|
|
||||||
slog.Error(gotext.Get("Error loading config"), "err", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
db := database.New(cfg)
|
|
||||||
err = db.Init(c.Context)
|
|
||||||
if err != nil {
|
|
||||||
slog.Error(gotext.Get("Error initialization database"), "err", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
installedAlrPackages := map[string]string{}
|
|
||||||
mgr := manager.Detect()
|
|
||||||
if mgr == nil {
|
|
||||||
slog.Error(gotext.Get("Unable to detect a supported package manager on the system"))
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
installed, err := mgr.ListInstalled(&manager.Opts{AsRoot: false})
|
|
||||||
if err != nil {
|
|
||||||
slog.Error(gotext.Get("Error listing installed packages"), "err", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
for pkgName, version := range installed {
|
|
||||||
matches := build.RegexpALRPackageName.FindStringSubmatch(pkgName)
|
|
||||||
if matches != nil {
|
|
||||||
packageName := matches[build.RegexpALRPackageName.SubexpIndex("package")]
|
|
||||||
repoName := matches[build.RegexpALRPackageName.SubexpIndex("repo")]
|
|
||||||
installedAlrPackages[fmt.Sprintf("%s/%s", repoName, packageName)] = version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err := db.GetPkgs(c.Context, "true")
|
|
||||||
if err != nil {
|
|
||||||
slog.Error(gotext.Get("Error getting packages"), "err", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
defer result.Close()
|
|
||||||
|
|
||||||
for result.Next() {
|
|
||||||
var pkg database.Package
|
|
||||||
err = result.StructScan(&pkg)
|
|
||||||
if err != nil {
|
|
||||||
slog.Error(gotext.Get("Error iterating over packages"), "err", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, ok := installedAlrPackages[fmt.Sprintf("%s/%s", pkg.Repository, pkg.Name)]
|
|
||||||
if !ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println(pkg.Name)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
args := c.Args()
|
args := c.Args()
|
||||||
if args.Len() < 1 {
|
if args.Len() < 1 {
|
||||||
@ -233,10 +169,7 @@ func RemoveCmd() *cli.Command {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
err := mgr.Remove(&manager.Opts{
|
err := mgr.Remove(nil, c.Args().Slice()...)
|
||||||
AsRoot: true,
|
|
||||||
NoConfirm: !c.Bool("interactive"),
|
|
||||||
}, c.Args().Slice()...)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error removing packages"), "err", err)
|
slog.Error(gotext.Get("Error removing packages"), "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -123,29 +123,15 @@ func (d *Decoder) DecodeVars(val any) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rVal := reflect.ValueOf(val).Elem()
|
rVal := reflect.ValueOf(val).Elem()
|
||||||
return d.decodeStruct(rVal)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Decoder) decodeStruct(rVal reflect.Value) error {
|
|
||||||
for i := 0; i < rVal.NumField(); i++ {
|
for i := 0; i < rVal.NumField(); i++ {
|
||||||
field := rVal.Field(i)
|
field := rVal.Field(i)
|
||||||
fieldType := rVal.Type().Field(i)
|
fieldType := rVal.Type().Field(i)
|
||||||
|
|
||||||
// Пропускаем неэкспортируемые поля
|
|
||||||
if !fieldType.IsExported() {
|
if !fieldType.IsExported() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Обрабатываем встроенные поля рекурсивно
|
|
||||||
if fieldType.Anonymous {
|
|
||||||
if field.Kind() == reflect.Struct {
|
|
||||||
if err := d.decodeStruct(field); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
name := fieldType.Name
|
name := fieldType.Name
|
||||||
tag := fieldType.Tag.Get("sh")
|
tag := fieldType.Tag.Get("sh")
|
||||||
required := false
|
required := false
|
||||||
@ -174,6 +160,7 @@ func (d *Decoder) decodeStruct(rVal reflect.Value) error {
|
|||||||
|
|
||||||
field.Set(newVal.Elem())
|
field.Set(newVal.Elem())
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,19 +162,15 @@ msgstr ""
|
|||||||
msgid "Command install expected at least 1 argument, got %d"
|
msgid "Command install expected at least 1 argument, got %d"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: install.go:163
|
#: install.go:157
|
||||||
msgid "Remove an installed package"
|
msgid "Remove an installed package"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: install.go:188
|
#: install.go:162
|
||||||
msgid "Error listing installed packages"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: install.go:226
|
|
||||||
msgid "Command remove expected at least 1 argument, got %d"
|
msgid "Command remove expected at least 1 argument, got %d"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: install.go:241
|
#: install.go:174
|
||||||
msgid "Error removing packages"
|
msgid "Error removing packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -311,6 +307,10 @@ msgstr ""
|
|||||||
msgid "List ALR repo packages"
|
msgid "List ALR repo packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: list.go:98
|
||||||
|
msgid "Error listing installed packages"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: main.go:45
|
#: main.go:45
|
||||||
msgid "Print the current ALR version and exit"
|
msgid "Print the current ALR version and exit"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -337,92 +337,92 @@ msgstr ""
|
|||||||
msgid "Error while running app"
|
msgid "Error while running app"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:157
|
#: pkg/build/build.go:156
|
||||||
msgid "Failed to prompt user to view build script"
|
msgid "Failed to prompt user to view build script"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:161
|
#: pkg/build/build.go:160
|
||||||
msgid "Building package"
|
msgid "Building package"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:209
|
#: pkg/build/build.go:208
|
||||||
msgid "The checksums array must be the same length as sources"
|
msgid "The checksums array must be the same length as sources"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:238
|
#: pkg/build/build.go:235
|
||||||
msgid "Downloading sources"
|
msgid "Downloading sources"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:260
|
#: pkg/build/build.go:257
|
||||||
msgid "Building package metadata"
|
msgid "Building package metadata"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:282
|
#: pkg/build/build.go:279
|
||||||
msgid "Compressing package"
|
msgid "Compressing package"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:441
|
#: pkg/build/build.go:438
|
||||||
msgid ""
|
msgid ""
|
||||||
"Your system's CPU architecture doesn't match this package. Do you want to "
|
"Your system's CPU architecture doesn't match this package. Do you want to "
|
||||||
"build anyway?"
|
"build anyway?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:455
|
#: pkg/build/build.go:452
|
||||||
msgid "This package is already installed"
|
msgid "This package is already installed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:479
|
#: pkg/build/build.go:476
|
||||||
msgid "Installing build dependencies"
|
msgid "Installing build dependencies"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:524
|
#: pkg/build/build.go:517
|
||||||
msgid "Installing dependencies"
|
msgid "Installing dependencies"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:605
|
#: pkg/build/build.go:598
|
||||||
msgid "Would you like to remove the build dependencies?"
|
msgid "Would you like to remove the build dependencies?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:668
|
#: pkg/build/build.go:661
|
||||||
msgid "Executing prepare()"
|
msgid "Executing prepare()"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:678
|
#: pkg/build/build.go:671
|
||||||
msgid "Executing build()"
|
msgid "Executing build()"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:708 pkg/build/build.go:728
|
#: pkg/build/build.go:701 pkg/build/build.go:721
|
||||||
msgid "Executing %s()"
|
msgid "Executing %s()"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:787
|
#: pkg/build/build.go:780
|
||||||
msgid "Error installing native packages"
|
msgid "Error installing native packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/build.go:811
|
#: pkg/build/build.go:804
|
||||||
msgid "Error installing package"
|
msgid "Error installing package"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/build/find_deps/alt_linux.go:35
|
#: pkg/build/build.go:863
|
||||||
msgid "Command not found on the system"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: pkg/build/find_deps/alt_linux.go:86
|
|
||||||
msgid "Provided dependency found"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: pkg/build/find_deps/alt_linux.go:93
|
|
||||||
msgid "Required dependency found"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: pkg/build/find_deps/empty.go:32
|
|
||||||
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/find_deps/empty.go:37
|
#: pkg/build/build.go:874
|
||||||
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 ""
|
||||||
|
|
||||||
|
#: pkg/build/findDeps.go:35
|
||||||
|
msgid "Command not found on the system"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: pkg/build/findDeps.go:82
|
||||||
|
msgid "Provided dependency found"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: pkg/build/findDeps.go:89
|
||||||
|
msgid "Required dependency found"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/repos/pull.go:79
|
#: pkg/repos/pull.go:79
|
||||||
msgid "Pulling repository"
|
msgid "Pulling repository"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -170,19 +170,15 @@ msgstr "Установить новый пакет"
|
|||||||
msgid "Command install expected at least 1 argument, got %d"
|
msgid "Command install expected at least 1 argument, got %d"
|
||||||
msgstr "Для команды install ожидался хотя бы 1 аргумент, получено %d"
|
msgstr "Для команды install ожидался хотя бы 1 аргумент, получено %d"
|
||||||
|
|
||||||
#: install.go:163
|
#: install.go:157
|
||||||
msgid "Remove an installed package"
|
msgid "Remove an installed package"
|
||||||
msgstr "Удалить установленный пакет"
|
msgstr "Удалить установленный пакет"
|
||||||
|
|
||||||
#: install.go:188
|
#: install.go:162
|
||||||
msgid "Error listing installed packages"
|
|
||||||
msgstr "Ошибка при составлении списка установленных пакетов"
|
|
||||||
|
|
||||||
#: install.go:226
|
|
||||||
msgid "Command remove expected at least 1 argument, got %d"
|
msgid "Command remove expected at least 1 argument, got %d"
|
||||||
msgstr "Для команды remove ожидался хотя бы 1 аргумент, получено %d"
|
msgstr "Для команды remove ожидался хотя бы 1 аргумент, получено %d"
|
||||||
|
|
||||||
#: install.go:241
|
#: install.go:174
|
||||||
msgid "Error removing packages"
|
msgid "Error removing packages"
|
||||||
msgstr "Ошибка при удалении пакетов"
|
msgstr "Ошибка при удалении пакетов"
|
||||||
|
|
||||||
@ -321,6 +317,10 @@ msgstr "ОШИБКА"
|
|||||||
msgid "List ALR repo packages"
|
msgid "List ALR repo packages"
|
||||||
msgstr "Список пакетов репозитория ALR"
|
msgstr "Список пакетов репозитория ALR"
|
||||||
|
|
||||||
|
#: list.go:98
|
||||||
|
msgid "Error listing installed packages"
|
||||||
|
msgstr "Ошибка при составлении списка установленных пакетов"
|
||||||
|
|
||||||
#: main.go:45
|
#: main.go:45
|
||||||
msgid "Print the current ALR version and exit"
|
msgid "Print the current ALR version and exit"
|
||||||
msgstr "Показать текущую версию ALR и выйти"
|
msgstr "Показать текущую версию ALR и выйти"
|
||||||
@ -349,31 +349,31 @@ msgstr "Показать справку"
|
|||||||
msgid "Error while running app"
|
msgid "Error while running app"
|
||||||
msgstr "Ошибка при запуске приложения"
|
msgstr "Ошибка при запуске приложения"
|
||||||
|
|
||||||
#: pkg/build/build.go:157
|
#: pkg/build/build.go:156
|
||||||
msgid "Failed to prompt user to view build script"
|
msgid "Failed to prompt user to view build script"
|
||||||
msgstr "Не удалось предложить пользователю просмотреть скрипт сборки"
|
msgstr "Не удалось предложить пользователю просмотреть скрипт сборки"
|
||||||
|
|
||||||
#: pkg/build/build.go:161
|
#: pkg/build/build.go:160
|
||||||
msgid "Building package"
|
msgid "Building package"
|
||||||
msgstr "Сборка пакета"
|
msgstr "Сборка пакета"
|
||||||
|
|
||||||
#: pkg/build/build.go:209
|
#: pkg/build/build.go:208
|
||||||
msgid "The checksums array must be the same length as sources"
|
msgid "The checksums array must be the same length as sources"
|
||||||
msgstr "Массив контрольных сумм должен быть той же длины, что и источники"
|
msgstr "Массив контрольных сумм должен быть той же длины, что и источники"
|
||||||
|
|
||||||
#: pkg/build/build.go:238
|
#: pkg/build/build.go:235
|
||||||
msgid "Downloading sources"
|
msgid "Downloading sources"
|
||||||
msgstr "Скачивание источников"
|
msgstr "Скачивание источников"
|
||||||
|
|
||||||
#: pkg/build/build.go:260
|
#: pkg/build/build.go:257
|
||||||
msgid "Building package metadata"
|
msgid "Building package metadata"
|
||||||
msgstr "Сборка метаданных пакета"
|
msgstr "Сборка метаданных пакета"
|
||||||
|
|
||||||
#: pkg/build/build.go:282
|
#: pkg/build/build.go:279
|
||||||
msgid "Compressing package"
|
msgid "Compressing package"
|
||||||
msgstr "Сжатие пакета"
|
msgstr "Сжатие пакета"
|
||||||
|
|
||||||
#: pkg/build/build.go:441
|
#: pkg/build/build.go:438
|
||||||
msgid ""
|
msgid ""
|
||||||
"Your system's CPU architecture doesn't match this package. Do you want to "
|
"Your system's CPU architecture doesn't match this package. Do you want to "
|
||||||
"build anyway?"
|
"build anyway?"
|
||||||
@ -381,64 +381,64 @@ msgstr ""
|
|||||||
"Архитектура процессора вашей системы не соответствует этому пакету. Вы все "
|
"Архитектура процессора вашей системы не соответствует этому пакету. Вы все "
|
||||||
"равно хотите выполнить сборку?"
|
"равно хотите выполнить сборку?"
|
||||||
|
|
||||||
#: pkg/build/build.go:455
|
#: pkg/build/build.go:452
|
||||||
msgid "This package is already installed"
|
msgid "This package is already installed"
|
||||||
msgstr "Этот пакет уже установлен"
|
msgstr "Этот пакет уже установлен"
|
||||||
|
|
||||||
#: pkg/build/build.go:479
|
#: pkg/build/build.go:476
|
||||||
msgid "Installing build dependencies"
|
msgid "Installing build dependencies"
|
||||||
msgstr "Установка зависимостей сборки"
|
msgstr "Установка зависимостей сборки"
|
||||||
|
|
||||||
#: pkg/build/build.go:524
|
#: pkg/build/build.go:517
|
||||||
msgid "Installing dependencies"
|
msgid "Installing dependencies"
|
||||||
msgstr "Установка зависимостей"
|
msgstr "Установка зависимостей"
|
||||||
|
|
||||||
#: pkg/build/build.go:605
|
#: pkg/build/build.go:598
|
||||||
msgid "Would you like to remove the build dependencies?"
|
msgid "Would you like to remove the build dependencies?"
|
||||||
msgstr "Хотели бы вы удалить зависимости сборки?"
|
msgstr "Хотели бы вы удалить зависимости сборки?"
|
||||||
|
|
||||||
#: pkg/build/build.go:668
|
#: pkg/build/build.go:661
|
||||||
msgid "Executing prepare()"
|
msgid "Executing prepare()"
|
||||||
msgstr "Исполнение prepare()"
|
msgstr "Исполнение prepare()"
|
||||||
|
|
||||||
#: pkg/build/build.go:678
|
#: pkg/build/build.go:671
|
||||||
msgid "Executing build()"
|
msgid "Executing build()"
|
||||||
msgstr "Исполнение build()"
|
msgstr "Исполнение build()"
|
||||||
|
|
||||||
#: pkg/build/build.go:708 pkg/build/build.go:728
|
#: pkg/build/build.go:701 pkg/build/build.go:721
|
||||||
msgid "Executing %s()"
|
msgid "Executing %s()"
|
||||||
msgstr "Исполнение %s()"
|
msgstr "Исполнение %s()"
|
||||||
|
|
||||||
#: pkg/build/build.go:787
|
#: pkg/build/build.go:780
|
||||||
msgid "Error installing native packages"
|
msgid "Error installing native packages"
|
||||||
msgstr "Ошибка при установке нативных пакетов"
|
msgstr "Ошибка при установке нативных пакетов"
|
||||||
|
|
||||||
#: pkg/build/build.go:811
|
#: pkg/build/build.go:804
|
||||||
msgid "Error installing package"
|
msgid "Error installing package"
|
||||||
msgstr "Ошибка при установке пакета"
|
msgstr "Ошибка при установке пакета"
|
||||||
|
|
||||||
#: pkg/build/find_deps/alt_linux.go:35
|
#: pkg/build/build.go:863
|
||||||
msgid "Command not found on the system"
|
|
||||||
msgstr "Команда не найдена в системе"
|
|
||||||
|
|
||||||
#: pkg/build/find_deps/alt_linux.go:86
|
|
||||||
msgid "Provided dependency found"
|
|
||||||
msgstr "Найденная предоставленная зависимость"
|
|
||||||
|
|
||||||
#: pkg/build/find_deps/alt_linux.go:93
|
|
||||||
msgid "Required dependency found"
|
|
||||||
msgstr "Найдена требуемая зависимость"
|
|
||||||
|
|
||||||
#: pkg/build/find_deps/empty.go:32
|
|
||||||
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/find_deps/empty.go:37
|
#: pkg/build/build.go:874
|
||||||
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 не реализовано для этого формата пакета, поэтому будет пропущено"
|
||||||
|
|
||||||
|
#: pkg/build/findDeps.go:35
|
||||||
|
msgid "Command not found on the system"
|
||||||
|
msgstr "Команда не найдена в системе"
|
||||||
|
|
||||||
|
#: pkg/build/findDeps.go:82
|
||||||
|
msgid "Provided dependency found"
|
||||||
|
msgstr "Найденная предоставленная зависимость"
|
||||||
|
|
||||||
|
#: pkg/build/findDeps.go:89
|
||||||
|
msgid "Required dependency found"
|
||||||
|
msgstr "Найдена требуемая зависимость"
|
||||||
|
|
||||||
#: pkg/repos/pull.go:79
|
#: pkg/repos/pull.go:79
|
||||||
msgid "Pulling repository"
|
msgid "Pulling repository"
|
||||||
msgstr "Скачивание репозитория"
|
msgstr "Скачивание репозитория"
|
||||||
|
@ -31,44 +31,79 @@ type BuildOpts struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BuildVarsPre struct {
|
type BuildVarsPre struct {
|
||||||
Version string `sh:"version,required"`
|
Version string `sh:"version,required"`
|
||||||
Release int `sh:"release,required"`
|
Release int `sh:"release,required"`
|
||||||
Epoch uint `sh:"epoch"`
|
Epoch uint `sh:"epoch"`
|
||||||
Description string `sh:"desc"`
|
Description string `sh:"desc"`
|
||||||
Homepage string `sh:"homepage"`
|
Homepage string `sh:"homepage"`
|
||||||
Maintainer string `sh:"maintainer"`
|
Maintainer string `sh:"maintainer"`
|
||||||
Architectures []string `sh:"architectures"`
|
Architectures []string `sh:"architectures"`
|
||||||
Licenses []string `sh:"license"`
|
Licenses []string `sh:"license"`
|
||||||
Provides []string `sh:"provides"`
|
Provides []string `sh:"provides"`
|
||||||
Conflicts []string `sh:"conflicts"`
|
Conflicts []string `sh:"conflicts"`
|
||||||
Depends []string `sh:"deps"`
|
Depends []string `sh:"deps"`
|
||||||
BuildDepends []string `sh:"build_deps"`
|
BuildDepends []string `sh:"build_deps"`
|
||||||
OptDepends []string `sh:"opt_deps"`
|
OptDepends []string `sh:"opt_deps"`
|
||||||
Replaces []string `sh:"replaces"`
|
Replaces []string `sh:"replaces"`
|
||||||
Sources []string `sh:"sources"`
|
Sources []string `sh:"sources"`
|
||||||
Checksums []string `sh:"checksums"`
|
Checksums []string `sh:"checksums"`
|
||||||
Backup []string `sh:"backup"`
|
Backup []string `sh:"backup"`
|
||||||
Scripts Scripts `sh:"scripts"`
|
Scripts Scripts `sh:"scripts"`
|
||||||
AutoReq []string `sh:"auto_req"`
|
AutoReq []string `sh:"auto_req"`
|
||||||
AutoProv []string `sh:"auto_prov"`
|
AutoProv []string `sh:"auto_prov"`
|
||||||
AutoReqSkipList []string `sh:"auto_req_skiplist"`
|
|
||||||
AutoProvSkipList []string `sh:"auto_prov_skiplist"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bv *BuildVarsPre) ToBuildVars() BuildVars {
|
func (bv *BuildVarsPre) ToBuildVars() BuildVars {
|
||||||
return BuildVars{
|
return BuildVars{
|
||||||
Name: "",
|
Name: "",
|
||||||
Base: "",
|
Version: bv.Version,
|
||||||
BuildVarsPre: *bv,
|
Release: bv.Release,
|
||||||
|
Epoch: bv.Epoch,
|
||||||
|
Description: bv.Description,
|
||||||
|
Homepage: bv.Homepage,
|
||||||
|
Maintainer: bv.Maintainer,
|
||||||
|
Architectures: bv.Architectures,
|
||||||
|
Licenses: bv.Licenses,
|
||||||
|
Provides: bv.Provides,
|
||||||
|
Conflicts: bv.Conflicts,
|
||||||
|
Depends: bv.Depends,
|
||||||
|
BuildDepends: bv.BuildDepends,
|
||||||
|
OptDepends: bv.OptDepends,
|
||||||
|
Replaces: bv.Replaces,
|
||||||
|
Sources: bv.Sources,
|
||||||
|
Checksums: bv.Checksums,
|
||||||
|
Backup: bv.Backup,
|
||||||
|
Scripts: bv.Scripts,
|
||||||
|
AutoReq: bv.AutoReq,
|
||||||
|
AutoProv: bv.AutoProv,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildVars represents the script variables required
|
// BuildVars represents the script variables required
|
||||||
// to build a package
|
// to build a package
|
||||||
type BuildVars struct {
|
type BuildVars struct {
|
||||||
Name string `sh:"name,required"`
|
Name string `sh:"name,required"`
|
||||||
Base string
|
Version string `sh:"version,required"`
|
||||||
BuildVarsPre
|
Release int `sh:"release,required"`
|
||||||
|
Epoch uint `sh:"epoch"`
|
||||||
|
Description string `sh:"desc"`
|
||||||
|
Homepage string `sh:"homepage"`
|
||||||
|
Maintainer string `sh:"maintainer"`
|
||||||
|
Architectures []string `sh:"architectures"`
|
||||||
|
Licenses []string `sh:"license"`
|
||||||
|
Provides []string `sh:"provides"`
|
||||||
|
Conflicts []string `sh:"conflicts"`
|
||||||
|
Depends []string `sh:"deps"`
|
||||||
|
BuildDepends []string `sh:"build_deps"`
|
||||||
|
OptDepends []string `sh:"opt_deps"`
|
||||||
|
Replaces []string `sh:"replaces"`
|
||||||
|
Sources []string `sh:"sources"`
|
||||||
|
Checksums []string `sh:"checksums"`
|
||||||
|
Backup []string `sh:"backup"`
|
||||||
|
Scripts Scripts `sh:"scripts"`
|
||||||
|
AutoReq []string `sh:"auto_req"`
|
||||||
|
AutoProv []string `sh:"auto_prov"`
|
||||||
|
Base string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Scripts struct {
|
type Scripts struct {
|
||||||
|
@ -50,7 +50,6 @@ import (
|
|||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/shutils/handlers"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/shutils/handlers"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/shutils/helpers"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/shutils/helpers"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
||||||
finddeps "gitea.plemya-x.ru/Plemya-x/ALR/pkg/build/find_deps"
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/distro"
|
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/distro"
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/manager"
|
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/manager"
|
||||||
)
|
)
|
||||||
@ -212,10 +211,8 @@ func (b *Builder) BuildPackage(ctx context.Context) ([]string, []string, error)
|
|||||||
sources, checksums = removeDuplicatesSources(sources, checksums)
|
sources, checksums = removeDuplicatesSources(sources, checksums)
|
||||||
|
|
||||||
mergedVars := types.BuildVars{
|
mergedVars := types.BuildVars{
|
||||||
BuildVarsPre: types.BuildVarsPre{
|
Sources: sources,
|
||||||
Sources: sources,
|
Checksums: checksums,
|
||||||
Checksums: checksums,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buildDeps, err := b.installBuildDeps(ctx, buildDepends) // Устанавливаем зависимости для сборки
|
buildDeps, err := b.installBuildDeps(ctx, buildDepends) // Устанавливаем зависимости для сборки
|
||||||
@ -492,17 +489,13 @@ 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 {
|
||||||
name := pkg.BasePkgName
|
if pkgsMap[pkg.BasePkgName] == nil {
|
||||||
if name == "" {
|
pkgsMap[pkg.BasePkgName] = &item{
|
||||||
name = pkg.Name
|
|
||||||
}
|
|
||||||
if pkgsMap[name] == nil {
|
|
||||||
pkgsMap[name] = &item{
|
|
||||||
pkg: &pkg,
|
pkg: &pkg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pkgsMap[name].packages = append(
|
pkgsMap[pkg.BasePkgName].packages = append(
|
||||||
pkgsMap[name].packages,
|
pkgsMap[pkg.BasePkgName].packages,
|
||||||
pkg.Name,
|
pkg.Name,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -861,18 +854,24 @@ func (b *Builder) buildPkgMetadata(
|
|||||||
pkgInfo.Overridables.Contents = contents
|
pkgInfo.Overridables.Contents = contents
|
||||||
|
|
||||||
if len(vars.AutoProv) == 1 && decoder.IsTruthy(vars.AutoProv[0]) {
|
if len(vars.AutoProv) == 1 && decoder.IsTruthy(vars.AutoProv[0]) {
|
||||||
f := finddeps.New(b.info, pkgFormat)
|
if pkgFormat == "rpm" {
|
||||||
err = f.FindProvides(ctx, pkgInfo, dirs, vars.AutoProvSkipList)
|
err = rpmFindProvides(ctx, pkgInfo, dirs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
slog.Info(gotext.Get("AutoProv is not implemented for this package format, so it's skipped"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(vars.AutoReq) == 1 && decoder.IsTruthy(vars.AutoReq[0]) {
|
if len(vars.AutoReq) == 1 && decoder.IsTruthy(vars.AutoReq[0]) {
|
||||||
f := finddeps.New(b.info, pkgFormat)
|
if pkgFormat == "rpm" {
|
||||||
err = f.FindRequires(ctx, pkgInfo, dirs, vars.AutoReqSkipList)
|
err = rpmFindRequires(ctx, pkgInfo, dirs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
slog.Info(gotext.Get("AutoReq is not implemented for this package format, so it's skipped"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package finddeps
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@ -30,7 +30,7 @@ import (
|
|||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func rpmFindDependenciesALTLinux(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, command string, envs []string, updateFunc func(string)) error {
|
func rpmFindDependencies(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, command string, updateFunc func(string)) error {
|
||||||
if _, err := exec.LookPath(command); err != nil {
|
if _, err := exec.LookPath(command); err != nil {
|
||||||
slog.Info(gotext.Get("Command not found on the system"), "command", command)
|
slog.Info(gotext.Get("Command not found on the system"), "command", command)
|
||||||
return nil
|
return nil
|
||||||
@ -49,8 +49,8 @@ func rpmFindDependenciesALTLinux(ctx context.Context, pkgInfo *nfpm.Info, dirs t
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, command)
|
cmd := exec.Command(command)
|
||||||
cmd.Stdin = bytes.NewBufferString(strings.Join(paths, "\n") + "\n")
|
cmd.Stdin = bytes.NewBufferString(strings.Join(paths, "\n"))
|
||||||
cmd.Env = append(cmd.Env,
|
cmd.Env = append(cmd.Env,
|
||||||
"RPM_BUILD_ROOT="+dirs.PkgDir,
|
"RPM_BUILD_ROOT="+dirs.PkgDir,
|
||||||
"RPM_FINDPROV_METHOD=",
|
"RPM_FINDPROV_METHOD=",
|
||||||
@ -58,7 +58,6 @@ func rpmFindDependenciesALTLinux(ctx context.Context, pkgInfo *nfpm.Info, dirs t
|
|||||||
"RPM_DATADIR=",
|
"RPM_DATADIR=",
|
||||||
"RPM_SUBPACKAGE_NAME=",
|
"RPM_SUBPACKAGE_NAME=",
|
||||||
)
|
)
|
||||||
cmd.Env = append(cmd.Env, envs...)
|
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
cmd.Stdout = &out
|
cmd.Stdout = &out
|
||||||
@ -67,7 +66,6 @@ func rpmFindDependenciesALTLinux(ctx context.Context, pkgInfo *nfpm.Info, dirs t
|
|||||||
slog.Error(stderr.String())
|
slog.Error(stderr.String())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
slog.Debug(stderr.String())
|
|
||||||
|
|
||||||
dependencies := strings.Split(strings.TrimSpace(out.String()), "\n")
|
dependencies := strings.Split(strings.TrimSpace(out.String()), "\n")
|
||||||
for _, dep := range dependencies {
|
for _, dep := range dependencies {
|
||||||
@ -79,17 +77,15 @@ func rpmFindDependenciesALTLinux(ctx context.Context, pkgInfo *nfpm.Info, dirs t
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type ALTLinuxFindProvReq struct{}
|
func rpmFindProvides(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories) error {
|
||||||
|
return rpmFindDependencies(ctx, pkgInfo, dirs, "/usr/lib/rpm/find-provides", func(dep string) {
|
||||||
func (o *ALTLinuxFindProvReq) FindProvides(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, skiplist []string) error {
|
|
||||||
return rpmFindDependenciesALTLinux(ctx, pkgInfo, dirs, "/usr/lib/rpm/find-provides", []string{"RPM_FINDPROV_SKIPLIST=" + strings.Join(skiplist, "\n")}, func(dep string) {
|
|
||||||
slog.Info(gotext.Get("Provided dependency found"), "dep", dep)
|
slog.Info(gotext.Get("Provided dependency found"), "dep", dep)
|
||||||
pkgInfo.Overridables.Provides = append(pkgInfo.Overridables.Provides, dep)
|
pkgInfo.Overridables.Provides = append(pkgInfo.Overridables.Provides, dep)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ALTLinuxFindProvReq) FindRequires(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, skiplist []string) error {
|
func rpmFindRequires(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories) error {
|
||||||
return rpmFindDependenciesALTLinux(ctx, pkgInfo, dirs, "/usr/lib/rpm/find-requires", []string{"RPM_FINDREQ_SKIPLIST=" + strings.Join(skiplist, "\n")}, func(dep string) {
|
return rpmFindDependencies(ctx, pkgInfo, dirs, "/usr/lib/rpm/find-requires", func(dep string) {
|
||||||
slog.Info(gotext.Get("Required dependency found"), "dep", dep)
|
slog.Info(gotext.Get("Required dependency found"), "dep", dep)
|
||||||
pkgInfo.Overridables.Depends = append(pkgInfo.Overridables.Depends, dep)
|
pkgInfo.Overridables.Depends = append(pkgInfo.Overridables.Depends, dep)
|
||||||
})
|
})
|
@ -1,39 +0,0 @@
|
|||||||
// 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/>.
|
|
||||||
|
|
||||||
package finddeps
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"log/slog"
|
|
||||||
|
|
||||||
"github.com/goreleaser/nfpm/v2"
|
|
||||||
"github.com/leonelquinteros/gotext"
|
|
||||||
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
type EmptyFindProvReq struct{}
|
|
||||||
|
|
||||||
func (o *EmptyFindProvReq) FindProvides(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, skiplist []string) error {
|
|
||||||
slog.Info(gotext.Get("AutoProv is not implemented for this package format, so it's skipped"))
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *EmptyFindProvReq) FindRequires(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, skiplist []string) error {
|
|
||||||
slog.Info(gotext.Get("AutoReq is not implemented for this package format, so it's skipped"))
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1,118 +0,0 @@
|
|||||||
// 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/>.
|
|
||||||
|
|
||||||
package finddeps
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"log/slog"
|
|
||||||
"os/exec"
|
|
||||||
"path"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/goreleaser/nfpm/v2"
|
|
||||||
"github.com/leonelquinteros/gotext"
|
|
||||||
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
type FedoraFindProvReq struct{}
|
|
||||||
|
|
||||||
func rpmFindDependenciesFedora(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, command string, args []string, updateFunc func(string)) error {
|
|
||||||
if _, err := exec.LookPath(command); err != nil {
|
|
||||||
slog.Info(gotext.Get("Command not found on the system"), "command", command)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var paths []string
|
|
||||||
for _, content := range pkgInfo.Contents {
|
|
||||||
if content.Type != "dir" {
|
|
||||||
paths = append(paths,
|
|
||||||
path.Join(dirs.PkgDir, content.Destination),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(paths) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, command, args...)
|
|
||||||
cmd.Stdin = bytes.NewBufferString(strings.Join(paths, "\n") + "\n")
|
|
||||||
cmd.Env = append(cmd.Env,
|
|
||||||
"RPM_BUILD_ROOT="+dirs.PkgDir,
|
|
||||||
)
|
|
||||||
var out bytes.Buffer
|
|
||||||
var stderr bytes.Buffer
|
|
||||||
cmd.Stdout = &out
|
|
||||||
cmd.Stderr = &stderr
|
|
||||||
if err := cmd.Run(); err != nil {
|
|
||||||
slog.Error(stderr.String())
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
slog.Debug(stderr.String())
|
|
||||||
|
|
||||||
dependencies := strings.Split(strings.TrimSpace(out.String()), "\n")
|
|
||||||
for _, dep := range dependencies {
|
|
||||||
if dep != "" {
|
|
||||||
updateFunc(dep)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *FedoraFindProvReq) FindProvides(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, skiplist []string) error {
|
|
||||||
return rpmFindDependenciesFedora(
|
|
||||||
ctx,
|
|
||||||
pkgInfo,
|
|
||||||
dirs,
|
|
||||||
"/usr/lib/rpm/rpmdeps",
|
|
||||||
[]string{
|
|
||||||
"--define=_use_internal_dependency_generator 1",
|
|
||||||
"--provides",
|
|
||||||
fmt.Sprintf(
|
|
||||||
"--define=__provides_exclude_from %s\"",
|
|
||||||
strings.Join(skiplist, "|"),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
func(dep string) {
|
|
||||||
slog.Info(gotext.Get("Provided dependency found"), "dep", dep)
|
|
||||||
pkgInfo.Overridables.Provides = append(pkgInfo.Overridables.Provides, dep)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *FedoraFindProvReq) FindRequires(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, skiplist []string) error {
|
|
||||||
return rpmFindDependenciesFedora(
|
|
||||||
ctx,
|
|
||||||
pkgInfo,
|
|
||||||
dirs,
|
|
||||||
"/usr/lib/rpm/rpmdeps",
|
|
||||||
[]string{
|
|
||||||
"--define=_use_internal_dependency_generator 1",
|
|
||||||
"--requires",
|
|
||||||
fmt.Sprintf(
|
|
||||||
"--define=__requires_exclude_from %s",
|
|
||||||
strings.Join(skiplist, "|"),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
func(dep string) {
|
|
||||||
slog.Info(gotext.Get("Required dependency found"), "dep", dep)
|
|
||||||
pkgInfo.Overridables.Depends = append(pkgInfo.Overridables.Depends, dep)
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
// 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/>.
|
|
||||||
|
|
||||||
package finddeps
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/goreleaser/nfpm/v2"
|
|
||||||
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
|
||||||
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/distro"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ProvReqFinder interface {
|
|
||||||
FindProvides(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, skiplist []string) error
|
|
||||||
FindRequires(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, skiplist []string) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type ProvReqService struct {
|
|
||||||
finder ProvReqFinder
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(info *distro.OSRelease, pkgFormat string) *ProvReqService {
|
|
||||||
s := &ProvReqService{
|
|
||||||
finder: &EmptyFindProvReq{},
|
|
||||||
}
|
|
||||||
if pkgFormat == "rpm" {
|
|
||||||
switch info.ID {
|
|
||||||
case "altlinux":
|
|
||||||
s.finder = &ALTLinuxFindProvReq{}
|
|
||||||
case "fedora":
|
|
||||||
s.finder = &FedoraFindProvReq{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ProvReqService) FindProvides(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, skiplist []string) error {
|
|
||||||
return s.finder.FindProvides(ctx, pkgInfo, dirs, skiplist)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *ProvReqService) FindRequires(ctx context.Context, pkgInfo *nfpm.Info, dirs types.Directories, skiplist []string) error {
|
|
||||||
return s.finder.FindRequires(ctx, pkgInfo, dirs, skiplist)
|
|
||||||
}
|
|
@ -97,15 +97,14 @@ if [ -z "$noPkgMgr" ]; then
|
|||||||
echo "Полученный список файлов:"
|
echo "Полученный список файлов:"
|
||||||
echo "$fileList"
|
echo "$fileList"
|
||||||
|
|
||||||
if [ "$pkgMgr" == "pacman" ]; then
|
if [ "$pkgMgr" == "pacman" ]; then
|
||||||
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*\.pkg\.tar\.zst' | sort -V | tail -n 1)
|
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*.pkg.tar.zst' | sort -V | tail -n 1)
|
||||||
elif [ "$pkgMgr" == "apt" ]; then
|
elif [ "$pkgMgr" == "apt" ]; then
|
||||||
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*\.amd64\.deb' | sort -V | tail -n 1)
|
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*.amd64.deb' | sort -V | tail -n 1)
|
||||||
elif [ "$pkgMgr" == "apt-get" ]; then
|
elif [[ "$pkgMgr" == "dnf" || "$pkgMgr" == "yum" || "$pkgMgr" == "zypper" ]]; then
|
||||||
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*-alt[0-9]+\.x86_64\.rpm' | sort -V | tail -n 1)
|
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*\.x86_64\.rpm' | grep -v 'alt1' | sort -V | tail -n 1)
|
||||||
elif [[ "$pkgMgr" == "dnf" || "$pkgMgr" == "yum" || "$pkgMgr" == "zypper" ]]; then
|
elif [[ "$pkgMgr" == "apt-get" ]]; then
|
||||||
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*\.x86_64\.rpm' | sort -V | tail -n 1)
|
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*alt1.x86_64.rpm' | sort -V | tail -n 1)
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
else
|
||||||
error "Не поддерживаемый менеджер пакетов для автоматической установки"
|
error "Не поддерживаемый менеджер пакетов для автоматической установки"
|
||||||
|
Loading…
Reference in New Issue
Block a user