forked from Plemya-x/ALR
Compare commits
8 Commits
1e52d30f4c
...
v0.0.14
| Author | SHA1 | Date | |
|---|---|---|---|
| c88478a450 | |||
| 3e61fec67c | |||
| 6f484a1169 | |||
| dddcb9b7b0 | |||
| b03d94e48b | |||
| f92bd7089a | |||
| eb2356458c | |||
| 131f455eff |
57
.gitea/workflows/e2e-tests.yaml
Normal file
57
.gitea/workflows/e2e-tests.yaml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# 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/>.
|
||||||
|
|
||||||
|
name: E2E
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
container:
|
||||||
|
image: altlinux.space/maks1ms/actions-container-runner:latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: https://github.com/actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.24'
|
||||||
|
|
||||||
|
- name: Cache Podman images
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.local/share/containers/storage
|
||||||
|
/var/lib/containers/storage
|
||||||
|
key: ${{ runner.os }}-primes
|
||||||
|
|
||||||
|
- name: Run E2E tests
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: unix:///tmp/podman.sock
|
||||||
|
IGNORE_ROOT_CHECK: 1
|
||||||
|
run: |
|
||||||
|
podman system service -t 0 unix:///tmp/podman.sock &
|
||||||
|
make e2e-test
|
||||||
67
.gitea/workflows/release.yaml
Normal file
67
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# 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/>.
|
||||||
|
|
||||||
|
name: Create Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
changelog:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout this repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.24'
|
||||||
|
|
||||||
|
- name: Get Changes between Tags
|
||||||
|
id: changes
|
||||||
|
uses: simbo/changes-between-tags-action@v1
|
||||||
|
|
||||||
|
- name: Set version
|
||||||
|
run: |
|
||||||
|
version=$(echo "${GITHUB_REF##*/}" | sed 's/^v//')
|
||||||
|
echo "Version - $version"
|
||||||
|
echo "VERSION=$version" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build alr binary
|
||||||
|
run: |
|
||||||
|
CGO_ENABLED=0 go build -ldflags "-X gitea.plemya-x.ru/Plemya-x/ALR/internal/config.Version=${{ env.VERSION }}" -o alr
|
||||||
|
|
||||||
|
- name: Create tar.gz
|
||||||
|
run: |
|
||||||
|
mkdir -p ./out/completion
|
||||||
|
cp alr ./out
|
||||||
|
cp scripts/completion/bash ./out/completion/alr
|
||||||
|
cp scripts/completion/zsh ./out/completion/_alr
|
||||||
|
|
||||||
|
( cd out && tar -czvf ../alr-${{ env.VERSION }}-linux-x86_64.tar.gz * )
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
body: ${{ steps.changes.outputs.changes }}
|
||||||
|
files: |-
|
||||||
|
alr-${{ env.VERSION }}-linux-x86_64.tar.gz
|
||||||
|
|
||||||
5
Makefile
5
Makefile
@@ -1,6 +1,6 @@
|
|||||||
NAME := alr
|
NAME := alr
|
||||||
GIT_VERSION = $(shell git describe --tags )
|
GIT_VERSION = $(shell git describe --tags )
|
||||||
|
IGNORE_ROOT_CHECK ?= 0
|
||||||
DESTDIR ?=
|
DESTDIR ?=
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
BIN := ./$(NAME)
|
BIN := ./$(NAME)
|
||||||
@@ -24,8 +24,9 @@ $(BIN):
|
|||||||
go build -ldflags="-X 'gitea.plemya-x.ru/Plemya-x/ALR/internal/config.Version=$(GIT_VERSION)'" -o $@
|
go build -ldflags="-X 'gitea.plemya-x.ru/Plemya-x/ALR/internal/config.Version=$(GIT_VERSION)'" -o $@
|
||||||
|
|
||||||
check-no-root:
|
check-no-root:
|
||||||
@if [[ "$$(whoami)" == 'root' ]]; then \
|
@if [[ "$(IGNORE_ROOT_CHECK)" != "1" ]] && [[ "$$(whoami)" == 'root' ]]; then \
|
||||||
echo "This target shouldn't run as root" 1>&2; \
|
echo "This target shouldn't run as root" 1>&2; \
|
||||||
|
echo "Set IGNORE_ROOT_CHECK=1 to override" 1>&2; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -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">17.1%</text>
|
<text x="86" y="15" fill="#010101" fill-opacity=".3">16.9%</text>
|
||||||
<text x="86" y="14">17.1%</text>
|
<text x="86" y="14">16.9%</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 926 B After Width: | Height: | Size: 926 B |
@@ -21,7 +21,6 @@ package e2etests_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"github.com/efficientgo/e2e"
|
"github.com/efficientgo/e2e"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,10 +30,7 @@ func TestE2EBashCompletion(t *testing.T) {
|
|||||||
"bash-completion",
|
"bash-completion",
|
||||||
COMMON_SYSTEMS,
|
COMMON_SYSTEMS,
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
err := r.Exec(e2e.NewCommand(
|
execShouldNoError(t, r, "alr", "install", "--generate-bash-completion")
|
||||||
"alr", "install", "--generate-bash-completion",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -121,29 +120,6 @@ var COMMON_SYSTEMS []string = []string{
|
|||||||
"ubuntu-24.04",
|
"ubuntu-24.04",
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
|
||||||
for _, id := range ALL_SYSTEMS {
|
|
||||||
buildAlrTestImage(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func buildAlrTestImage(id string) {
|
|
||||||
cmd := exec.Command(
|
|
||||||
"docker",
|
|
||||||
"build",
|
|
||||||
"-t", fmt.Sprintf("alr-testimage-%s", id),
|
|
||||||
"-f", fmt.Sprintf("images/Dockerfile.%s", id),
|
|
||||||
".",
|
|
||||||
)
|
|
||||||
cmd.Stdout = os.Stdout
|
|
||||||
cmd.Stderr = os.Stderr
|
|
||||||
err := cmd.Run()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Error:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func dockerMultipleRun(t *testing.T, name string, ids []string, f func(t *testing.T, runnable e2e.Runnable)) {
|
func dockerMultipleRun(t *testing.T, name string, ids []string, f func(t *testing.T, runnable e2e.Runnable)) {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
for _, id := range ids {
|
for _, id := range ids {
|
||||||
@@ -158,26 +134,37 @@ func dockerMultipleRun(t *testing.T, name string, ids []string, f func(t *testin
|
|||||||
e, err := e2e.New(e2e.WithVerbose(), e2e.WithName(fmt.Sprintf("alr-%s", truncatedHash)))
|
e, err := e2e.New(e2e.WithVerbose(), e2e.WithName(fmt.Sprintf("alr-%s", truncatedHash)))
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
t.Cleanup(e.Close)
|
t.Cleanup(e.Close)
|
||||||
imageId := fmt.Sprintf("alr-testimage-%s", id)
|
imageId := fmt.Sprintf("ghcr.io/maks1ms/alr-e2e-test-image-%s", id)
|
||||||
runnable := e.Runnable(dockerName).Init(
|
runnable := e.Runnable(dockerName).Init(
|
||||||
e2e.StartOptions{
|
e2e.StartOptions{
|
||||||
Image: imageId,
|
Image: imageId,
|
||||||
Volumes: []string{
|
Volumes: []string{
|
||||||
// "./alr:/usr/bin/alr",
|
"./alr:/tmp/alr",
|
||||||
},
|
},
|
||||||
Privileged: true,
|
Privileged: true,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
assert.NoError(t, e2e.StartAndWaitReady(runnable))
|
assert.NoError(t, e2e.StartAndWaitReady(runnable))
|
||||||
|
err = runnable.Exec(e2e.NewCommand("/bin/alr-test-setup", "alr-install"))
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
err = runnable.Exec(e2e.NewCommand("/bin/alr-test-setup", "passwordless-sudo-setup"))
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
f(t, runnable)
|
f(t, runnable)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func simpleExec(t *testing.T, r e2e.Runnable, cmd string, args ...string) {
|
func execShouldNoError(t *testing.T, r e2e.Runnable, cmd string, args ...string) {
|
||||||
err := r.Exec(e2e.NewCommand(cmd, args...))
|
assert.NoError(t, r.Exec(e2e.NewCommand(cmd, args...)))
|
||||||
assert.NoError(t, err)
|
}
|
||||||
|
|
||||||
|
func execShouldError(t *testing.T, r e2e.Runnable, cmd string, args ...string) {
|
||||||
|
assert.Error(t, r.Exec(e2e.NewCommand(cmd, args...)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func runTestCommands(t *testing.T, r e2e.Runnable, timeout time.Duration, expects []expect.Batcher) {
|
func runTestCommands(t *testing.T, r e2e.Runnable, timeout time.Duration, expects []expect.Batcher) {
|
||||||
@@ -194,4 +181,22 @@ func runTestCommands(t *testing.T, r e2e.Runnable, timeout time.Duration, expect
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
const REPO_FOR_E2E_TESTS = "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git"
|
const REPO_NAME_FOR_E2E_TESTS = "alr-repo"
|
||||||
|
const REPO_URL_FOR_E2E_TESTS = "https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git"
|
||||||
|
|
||||||
|
func defaultPrepare(t *testing.T, r e2e.Runnable) {
|
||||||
|
execShouldNoError(t, r,
|
||||||
|
"sudo",
|
||||||
|
"alr",
|
||||||
|
"repo",
|
||||||
|
"add",
|
||||||
|
REPO_NAME_FOR_E2E_TESTS,
|
||||||
|
REPO_URL_FOR_E2E_TESTS,
|
||||||
|
)
|
||||||
|
|
||||||
|
execShouldNoError(t, r,
|
||||||
|
"sudo",
|
||||||
|
"alr",
|
||||||
|
"ref",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package e2etests_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"github.com/efficientgo/e2e"
|
"github.com/efficientgo/e2e"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,26 +30,9 @@ func TestE2EGroupAndSummaryField(t *testing.T) {
|
|||||||
"group-and-summary-field",
|
"group-and-summary-field",
|
||||||
RPM_SYSTEMS,
|
RPM_SYSTEMS,
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
err := r.Exec(e2e.NewCommand(
|
defaultPrepare(t, r)
|
||||||
"sudo",
|
execShouldNoError(t, r, "sh", "-c", "alr search --name test-group-and-summary --format \"{{.Group}}\" | grep ^System/Base$")
|
||||||
"alr",
|
execShouldNoError(t, r, "sh", "-c", "alr search --name test-group-and-summary --format \"{{.Summary}}\" | grep \"^Custom summary$\"")
|
||||||
"addrepo",
|
|
||||||
"--name",
|
|
||||||
"alr-repo",
|
|
||||||
"--url",
|
|
||||||
"https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sh", "-c", "alr search --name test-group-and-summary --format \"{{.Group}}\" | grep ^System/Base$",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sh", "-c", "alr search --name test-group-and-summary --format \"{{.Summary}}\" | grep \"^Custom summary$\"",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
FROM alpine:latest
|
|
||||||
RUN adduser -s /bin/bash alr-user
|
|
||||||
USER alr-user
|
|
||||||
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
FROM registry.altlinux.org/sisyphus/alt:latest
|
|
||||||
RUN apt-get update && apt-get install -y ca-certificates rpm-build
|
|
||||||
RUN useradd -m -s /bin/bash alr-user
|
|
||||||
USER alr-user
|
|
||||||
WORKDIR /home/alr-user
|
|
||||||
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
FROM archlinux:latest
|
|
||||||
RUN useradd -m -s /bin/bash alr-user
|
|
||||||
USER alr-user
|
|
||||||
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
FROM fedora:41
|
|
||||||
RUN dnf install -y ca-certificates sudo rpm-build bindfs
|
|
||||||
RUN <<EOF
|
|
||||||
useradd -m -s /bin/bash -G wheel user
|
|
||||||
echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/user
|
|
||||||
chmod 0440 /etc/sudoers.d/user
|
|
||||||
|
|
||||||
useradd -m -s /bin/bash alr
|
|
||||||
mkdir -p /var/cache/alr /etc/alr
|
|
||||||
chown alr:alr /var/cache/alr /etc/alr
|
|
||||||
EOF
|
|
||||||
COPY ./alr /usr/bin
|
|
||||||
RUN <<EOF
|
|
||||||
setcap cap_setuid,cap_setgid+ep /usr/bin/alr
|
|
||||||
EOF
|
|
||||||
USER user
|
|
||||||
WORKDIR /home/user
|
|
||||||
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
FROM opensuse/leap:latest
|
|
||||||
RUN useradd -m -s /bin/bash alr-user
|
|
||||||
USER alr-user
|
|
||||||
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
FROM registry.red-soft.ru/ubi8/ubi:latest
|
|
||||||
RUN useradd -m -s /bin/bash alr-user
|
|
||||||
USER alr-user
|
|
||||||
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
FROM ubuntu:24.10
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates sudo libcap2-bin
|
|
||||||
RUN <<EOF
|
|
||||||
useradd -m -s /bin/bash user
|
|
||||||
echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/user
|
|
||||||
chmod 0440 /etc/sudoers.d/user
|
|
||||||
|
|
||||||
useradd -m -s /bin/bash alr
|
|
||||||
mkdir -p /var/cache/alr /etc/alr
|
|
||||||
chown alr:alr /var/cache/alr /etc/alr
|
|
||||||
EOF
|
|
||||||
COPY ./alr /usr/bin
|
|
||||||
RUN <<EOF
|
|
||||||
setcap cap_setuid,cap_setgid+ep /usr/bin/alr
|
|
||||||
EOF
|
|
||||||
USER user
|
|
||||||
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
|
||||||
@@ -21,7 +21,6 @@ package e2etests_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"github.com/efficientgo/e2e"
|
"github.com/efficientgo/e2e"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,21 +30,11 @@ func TestE2EIssue32Interactive(t *testing.T) {
|
|||||||
"issue-32-interactive",
|
"issue-32-interactive",
|
||||||
COMMON_SYSTEMS,
|
COMMON_SYSTEMS,
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
assert.NoError(t, r.Exec(e2e.NewCommand(
|
execShouldNoError(t, r, "alr", "--interactive=false", "remove", "ca-certificates")
|
||||||
"sudo", "alr", "--interactive=false", "remove", "ca-certificates",
|
execShouldNoError(t, r, "sudo", "alr", "--interactive=false", "remove", "openssl")
|
||||||
)))
|
execShouldNoError(t, r, "alr", "fix")
|
||||||
|
execShouldNoError(t, r, "sudo", "apt-get", "update")
|
||||||
assert.NoError(t, r.Exec(e2e.NewCommand(
|
execShouldNoError(t, r, "sudo", "alr", "--interactive=false", "install", "ca-certificates")
|
||||||
"sudo", "alr", "--interactive=false", "remove", "openssl",
|
|
||||||
)))
|
|
||||||
|
|
||||||
assert.NoError(t, r.Exec(e2e.NewCommand(
|
|
||||||
"alr", "fix",
|
|
||||||
)))
|
|
||||||
|
|
||||||
assert.NoError(t, r.Exec(e2e.NewCommand(
|
|
||||||
"sudo", "alr", "--interactive=false", "install", "ca-certificates",
|
|
||||||
)))
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package e2etests_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"github.com/efficientgo/e2e"
|
"github.com/efficientgo/e2e"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,51 +30,11 @@ func TestE2EIssue41AutoreqSkiplist(t *testing.T) {
|
|||||||
"issue-41-autoreq-skiplist",
|
"issue-41-autoreq-skiplist",
|
||||||
AUTOREQ_AUTOPROV_SYSTEMS,
|
AUTOREQ_AUTOPROV_SYSTEMS,
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
err := r.Exec(e2e.NewCommand(
|
defaultPrepare(t, r)
|
||||||
"sudo",
|
execShouldNoError(t, r, "alr", "build", "-p", "alr-repo/test-autoreq-autoprov")
|
||||||
"alr",
|
execShouldNoError(t, r, "sh", "-c", "rpm -qp --requires *.rpm | grep \"^/bin/sh$\"")
|
||||||
"addrepo",
|
execShouldError(t, r, "sh", "-c", "rpm -qp --requires *.rpm | grep \"^/bin/bash$\"")
|
||||||
"--name",
|
execShouldError(t, r, "sh", "-c", "rpm -qp --requires *.rpm | grep \"^/bin/zsh$\"")
|
||||||
"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)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package e2etests_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"github.com/efficientgo/e2e"
|
"github.com/efficientgo/e2e"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,26 +30,10 @@ func TestE2EIssue50InstallMultiple(t *testing.T) {
|
|||||||
"issue-50-install-multiple",
|
"issue-50-install-multiple",
|
||||||
COMMON_SYSTEMS,
|
COMMON_SYSTEMS,
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
err := r.Exec(e2e.NewCommand(
|
defaultPrepare(t, r)
|
||||||
"sudo",
|
execShouldNoError(t, r, "sudo", "alr", "in", "foo-pkg", "bar-pkg")
|
||||||
"alr",
|
execShouldNoError(t, r, "cat", "/opt/foo")
|
||||||
"addrepo",
|
execShouldNoError(t, r, "cat", "/opt/bar")
|
||||||
"--name",
|
|
||||||
"alr-repo",
|
|
||||||
"--url",
|
|
||||||
"https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sudo", "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)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package e2etests_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"github.com/efficientgo/e2e"
|
"github.com/efficientgo/e2e"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,23 +30,8 @@ func TestE2EIssue53LcAllCInfo(t *testing.T) {
|
|||||||
"issue-53-lc-all-c-info",
|
"issue-53-lc-all-c-info",
|
||||||
COMMON_SYSTEMS,
|
COMMON_SYSTEMS,
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
err := r.Exec(e2e.NewCommand(
|
defaultPrepare(t, r)
|
||||||
"sudo",
|
execShouldNoError(t, r, "bash", "-c", "LANG=C alr info foo-pkg")
|
||||||
"alr",
|
|
||||||
"addrepo",
|
|
||||||
"--name",
|
|
||||||
"alr-repo",
|
|
||||||
"--url",
|
|
||||||
"https://gitea.plemya-x.ru/Plemya-x/alr-repo.git",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"bash",
|
|
||||||
"-c",
|
|
||||||
"LANG=C alr info alr-bin",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package e2etests_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"github.com/efficientgo/e2e"
|
"github.com/efficientgo/e2e"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,28 +30,11 @@ func TestE2EIssue59RmCompletion(t *testing.T) {
|
|||||||
"issue-59-rm-completion",
|
"issue-59-rm-completion",
|
||||||
COMMON_SYSTEMS,
|
COMMON_SYSTEMS,
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
err := r.Exec(e2e.NewCommand(
|
defaultPrepare(t, r)
|
||||||
"sudo",
|
execShouldNoError(t, r, "sudo", "alr", "in", "foo-pkg", "bar-pkg")
|
||||||
"alr",
|
execShouldNoError(t, r, "sh", "-c", "alr rm --generate-bash-completion | grep ^foo-pkg$")
|
||||||
"addrepo",
|
execShouldNoError(t, r, "sh", "-c", "alr rm --generate-bash-completion | grep ^bar-pkg$")
|
||||||
"--name",
|
execShouldError(t, r, "sh", "-c", "alr rm --generate-bash-completion | grep ^test-autoreq-autoprov$")
|
||||||
"alr-repo",
|
|
||||||
"--url",
|
|
||||||
"https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sudo", "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)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package e2etests_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"github.com/efficientgo/e2e"
|
"github.com/efficientgo/e2e"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,21 +30,8 @@ func TestE2EIssue72InstallWithDeps(t *testing.T) {
|
|||||||
"issue-72-install-with-deps",
|
"issue-72-install-with-deps",
|
||||||
COMMON_SYSTEMS,
|
COMMON_SYSTEMS,
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
err := r.Exec(e2e.NewCommand(
|
defaultPrepare(t, r)
|
||||||
"sudo",
|
execShouldNoError(t, r, "sudo", "alr", "in", "test-app-with-lib")
|
||||||
"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(
|
|
||||||
"sudo", "alr", "in", "test-app-with-lib",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,21 +30,14 @@ func TestE2EIssue74Upgradable(t *testing.T) {
|
|||||||
"issue-74-upgradable",
|
"issue-74-upgradable",
|
||||||
COMMON_SYSTEMS,
|
COMMON_SYSTEMS,
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
simpleExec(t, r, "sudo",
|
defaultPrepare(t, r)
|
||||||
"alr",
|
execShouldNoError(t, r, "sudo", "alr", "repo", "set-ref", "alr-repo", "bd26236cd7")
|
||||||
"addrepo",
|
execShouldNoError(t, r, "alr", "ref")
|
||||||
"--name",
|
execShouldNoError(t, r, "sudo", "alr", "in", "bar-pkg")
|
||||||
"alr-repo",
|
execShouldNoError(t, r, "sh", "-c", "test $(alr list -U | wc -l) -eq 0 || exit 1")
|
||||||
"--url",
|
execShouldNoError(t, r, "sudo", "alr", "repo", "set-ref", "alr-repo", "d9a3541561")
|
||||||
REPO_FOR_E2E_TESTS,
|
execShouldNoError(t, r, "sudo", "alr", "ref")
|
||||||
)
|
execShouldNoError(t, r, "sh", "-c", "test $(alr list -U | wc -l) -eq 1 || exit 1")
|
||||||
simpleExec(t, r, "sudo", "sh", "-c", "sed -i 's/ref = .*/ref = \"bd26236cd7\"/' /etc/alr/alr.toml")
|
|
||||||
simpleExec(t, r, "alr", "ref")
|
|
||||||
simpleExec(t, r, "sudo", "alr", "in", "bar-pkg")
|
|
||||||
simpleExec(t, r, "sh", "-c", "test $(alr list -U | wc -l) -eq 0 || exit 1")
|
|
||||||
simpleExec(t, r, "sudo", "sh", "-c", "sed -i 's/ref = .*/ref = \"d9a3541561\"/' /etc/alr/alr.toml")
|
|
||||||
simpleExec(t, r, "sudo", "alr", "ref")
|
|
||||||
simpleExec(t, r, "sh", "-c", "test $(alr list -U | wc -l) -eq 1 || exit 1")
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package e2etests_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"github.com/efficientgo/e2e"
|
"github.com/efficientgo/e2e"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,32 +30,9 @@ func TestE2EIssue75InstallWithDeps(t *testing.T) {
|
|||||||
"issue-75-ref-specify",
|
"issue-75-ref-specify",
|
||||||
COMMON_SYSTEMS,
|
COMMON_SYSTEMS,
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
err := r.Exec(e2e.NewCommand(
|
defaultPrepare(t, r)
|
||||||
"sudo",
|
execShouldNoError(t, r, "sudo", "alr", "repo", "set-ref", "alr-repo", "bd26236cd7")
|
||||||
"alr",
|
execShouldNoError(t, r, "sh", "-c", "test $(alr list | wc -l) -eq 2 || exit 1")
|
||||||
"addrepo",
|
|
||||||
"--name",
|
|
||||||
"alr-repo",
|
|
||||||
"--url",
|
|
||||||
"https://gitea.plemya-x.ru/Maks1mS/repo-for-tests.git",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sudo", "alr", "ref",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
// TODO: replace with alr command when it be added
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sudo", "sh", "-c", "sed -i 's/ref = .*/ref = \"bd26236cd7\"/' /etc/alr/alr.toml",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sh", "-c", "test $(alr list | wc -l) -eq 2 || exit 1",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/efficientgo/e2e"
|
"github.com/efficientgo/e2e"
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestE2EIssue81MultiplePackages(t *testing.T) {
|
func TestE2EIssue81MultiplePackages(t *testing.T) {
|
||||||
@@ -31,29 +30,9 @@ func TestE2EIssue81MultiplePackages(t *testing.T) {
|
|||||||
"issue-81-multiple-packages",
|
"issue-81-multiple-packages",
|
||||||
COMMON_SYSTEMS,
|
COMMON_SYSTEMS,
|
||||||
func(t *testing.T, r e2e.Runnable) {
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
err := r.Exec(e2e.NewCommand(
|
defaultPrepare(t, r)
|
||||||
"sudo",
|
execShouldNoError(t, r, "sudo", "alr", "in", "first-package-with-dashes")
|
||||||
"alr",
|
execShouldNoError(t, r, "cat", "/opt/first-package")
|
||||||
"addrepo",
|
|
||||||
"--name",
|
|
||||||
"alr-repo",
|
|
||||||
"--url",
|
|
||||||
REPO_FOR_E2E_TESTS,
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sudo", "alr", "ref",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand(
|
|
||||||
"sudo", "alr", "in", "first-package-with-dashes",
|
|
||||||
))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
err = r.Exec(e2e.NewCommand("cat", "/opt/first-package"))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
40
e2e-tests/issue_91_set_repo_ref_test.go
Normal file
40
e2e-tests/issue_91_set_repo_ref_test.go
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
// 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/>.
|
||||||
|
|
||||||
|
//go:build e2e
|
||||||
|
|
||||||
|
package e2etests_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/efficientgo/e2e"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestE2EIssue91MultiplePackages(t *testing.T) {
|
||||||
|
dockerMultipleRun(
|
||||||
|
t,
|
||||||
|
"issue-91-set-repo-ref",
|
||||||
|
COMMON_SYSTEMS,
|
||||||
|
func(t *testing.T, r e2e.Runnable) {
|
||||||
|
defaultPrepare(t, r)
|
||||||
|
execShouldError(t, r, "sudo", "alr", "repo", "set-ref")
|
||||||
|
execShouldError(t, r, "sudo", "alr", "repo", "set-ref", "alr-repo")
|
||||||
|
execShouldNoError(t, r, "sudo", "alr", "repo", "set-ref", "alr-repo", "bd26236cd7")
|
||||||
|
execShouldNoError(t, r, "sh", "-c", "test $(alr list | wc -l) -eq 2 || exit 1")
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
|
"github.com/leonelquinteros/gotext"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -61,3 +62,11 @@ func FormatCliExitWithCode(msg string, err error, exitCode int) cli.ExitCoder {
|
|||||||
}
|
}
|
||||||
return cli.Exit(fmt.Errorf("%s: %w", msg, err), exitCode)
|
return cli.Exit(fmt.Errorf("%s: %w", msg, err), exitCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WarnLegacyCommand(newSyntax string) {
|
||||||
|
slog.Warn(
|
||||||
|
gotext.Get(
|
||||||
|
"This command is deprecated and would be removed in the future, use \"%s\" instead!", newSyntax,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -278,6 +278,12 @@ msgstr ""
|
|||||||
msgid "OPTIONS"
|
msgid "OPTIONS"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: internal/cliutils/utils.go:69
|
||||||
|
msgid ""
|
||||||
|
"This command is deprecated and would be removed in the future, use \"%s\" "
|
||||||
|
"instead!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: internal/db/db.go:137
|
#: internal/db/db.go:137
|
||||||
msgid "Database version mismatch; resetting"
|
msgid "Database version mismatch; resetting"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -363,11 +369,11 @@ msgstr ""
|
|||||||
msgid "Enable interactive questions and prompts"
|
msgid "Enable interactive questions and prompts"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: main.go:145
|
#: main.go:146
|
||||||
msgid "Show help"
|
msgid "Show help"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: main.go:149
|
#: main.go:150
|
||||||
msgid "Error while running app"
|
msgid "Error while running app"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -451,48 +457,68 @@ msgid ""
|
|||||||
"updating ALR if something doesn't work."
|
"updating ALR if something doesn't work."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: refresh.go:30
|
||||||
|
msgid "Pull all repositories that have changed"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:39
|
#: repo.go:39
|
||||||
msgid "Add a new repository"
|
msgid "Manage repos"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:46
|
#: repo.go:51 repo.go:269
|
||||||
msgid "Name of the new repo"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: repo.go:52
|
|
||||||
msgid "URL of the new repo"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: repo.go:75
|
|
||||||
msgid "Repo \"%s\" already exists"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: repo.go:86 repo.go:159
|
|
||||||
msgid "Error saving config"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: repo.go:112
|
|
||||||
msgid "Remove an existing repository"
|
msgid "Remove an existing repository"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:119
|
#: repo.go:53
|
||||||
msgid "Name of the repo to be deleted"
|
msgid "<name>"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:148
|
#: repo.go:83
|
||||||
msgid "Repo \"%s\" does not exist"
|
msgid "Repo \"%s\" does not exist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:155
|
#: repo.go:90
|
||||||
msgid "Error removing repo directory"
|
msgid "Error removing repo directory"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:178
|
#: repo.go:94 repo.go:161 repo.go:219
|
||||||
|
msgid "Error saving config"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: repo.go:113
|
||||||
msgid "Error removing packages from database"
|
msgid "Error removing packages from database"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:189
|
#: repo.go:124 repo.go:239
|
||||||
msgid "Pull all repositories that have changed"
|
msgid "Add a new repository"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: repo.go:125
|
||||||
|
msgid "<name> <url>"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: repo.go:150
|
||||||
|
msgid "Repo \"%s\" already exists"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: repo.go:187
|
||||||
|
msgid "Set the reference of the repository"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: repo.go:188
|
||||||
|
msgid "<name> <ref>"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: repo.go:246
|
||||||
|
msgid "Name of the new repo"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: repo.go:252
|
||||||
|
msgid "URL of the new repo"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: repo.go:276
|
||||||
|
msgid "Name of the repo to be deleted"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.go:40
|
#: search.go:40
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: unnamed project\n"
|
"Project-Id-Version: unnamed project\n"
|
||||||
"PO-Revision-Date: 2025-05-13 23:24+0300\n"
|
"PO-Revision-Date: 2025-05-16 20:47+0300\n"
|
||||||
"Last-Translator: Maxim Slipenko <maks1ms@alt-gnome.ru>\n"
|
"Last-Translator: Maxim Slipenko <maks1ms@alt-gnome.ru>\n"
|
||||||
"Language-Team: Russian\n"
|
"Language-Team: Russian\n"
|
||||||
"Language: ru\n"
|
"Language: ru\n"
|
||||||
@@ -285,6 +285,14 @@ msgstr "КАТЕГОРИЯ"
|
|||||||
msgid "OPTIONS"
|
msgid "OPTIONS"
|
||||||
msgstr "ПАРАМЕТРЫ"
|
msgstr "ПАРАМЕТРЫ"
|
||||||
|
|
||||||
|
#: internal/cliutils/utils.go:69
|
||||||
|
msgid ""
|
||||||
|
"This command is deprecated and would be removed in the future, use \"%s\" "
|
||||||
|
"instead!"
|
||||||
|
msgstr ""
|
||||||
|
"Эта команда устарела и будет удалена в будущем, используйте вместо нее "
|
||||||
|
"\"%s\"!"
|
||||||
|
|
||||||
#: internal/db/db.go:137
|
#: internal/db/db.go:137
|
||||||
msgid "Database version mismatch; resetting"
|
msgid "Database version mismatch; resetting"
|
||||||
msgstr "Несоответствие версий базы данных; сброс настроек"
|
msgstr "Несоответствие версий базы данных; сброс настроек"
|
||||||
@@ -371,11 +379,11 @@ msgstr "Аргументы, которые будут переданы мене
|
|||||||
msgid "Enable interactive questions and prompts"
|
msgid "Enable interactive questions and prompts"
|
||||||
msgstr "Включение интерактивных вопросов и запросов"
|
msgstr "Включение интерактивных вопросов и запросов"
|
||||||
|
|
||||||
#: main.go:145
|
#: main.go:146
|
||||||
msgid "Show help"
|
msgid "Show help"
|
||||||
msgstr "Показать справку"
|
msgstr "Показать справку"
|
||||||
|
|
||||||
#: main.go:149
|
#: main.go:150
|
||||||
msgid "Error while running app"
|
msgid "Error while running app"
|
||||||
msgstr "Ошибка при запуске приложения"
|
msgstr "Ошибка при запуске приложения"
|
||||||
|
|
||||||
@@ -465,49 +473,69 @@ msgstr ""
|
|||||||
"Минимальная версия ALR для ALR-репозитория выше текущей версии. Попробуйте "
|
"Минимальная версия ALR для ALR-репозитория выше текущей версии. Попробуйте "
|
||||||
"обновить ALR, если что-то не работает."
|
"обновить ALR, если что-то не работает."
|
||||||
|
|
||||||
|
#: refresh.go:30
|
||||||
|
msgid "Pull all repositories that have changed"
|
||||||
|
msgstr "Скачать все изменённые репозитории"
|
||||||
|
|
||||||
#: repo.go:39
|
#: repo.go:39
|
||||||
msgid "Add a new repository"
|
msgid "Manage repos"
|
||||||
msgstr "Добавить новый репозиторий"
|
msgstr "Управление репозиториями"
|
||||||
|
|
||||||
#: repo.go:46
|
#: repo.go:51 repo.go:269
|
||||||
msgid "Name of the new repo"
|
|
||||||
msgstr "Название нового репозитория"
|
|
||||||
|
|
||||||
#: repo.go:52
|
|
||||||
msgid "URL of the new repo"
|
|
||||||
msgstr "URL-адрес нового репозитория"
|
|
||||||
|
|
||||||
#: repo.go:75
|
|
||||||
msgid "Repo \"%s\" already exists"
|
|
||||||
msgstr "Репозиторий \"%s\" уже существует"
|
|
||||||
|
|
||||||
#: repo.go:86 repo.go:159
|
|
||||||
msgid "Error saving config"
|
|
||||||
msgstr "Ошибка при сохранении конфигурации"
|
|
||||||
|
|
||||||
#: repo.go:112
|
|
||||||
msgid "Remove an existing repository"
|
msgid "Remove an existing repository"
|
||||||
msgstr "Удалить существующий репозиторий"
|
msgstr "Удалить существующий репозиторий"
|
||||||
|
|
||||||
#: repo.go:119
|
#: repo.go:53
|
||||||
msgid "Name of the repo to be deleted"
|
msgid "<name>"
|
||||||
msgstr "Название репозитория удалён"
|
msgstr "<имя>"
|
||||||
|
|
||||||
#: repo.go:148
|
#: repo.go:83
|
||||||
msgid "Repo \"%s\" does not exist"
|
msgid "Repo \"%s\" does not exist"
|
||||||
msgstr "Репозитория \"%s\" не существует"
|
msgstr "Репозитория \"%s\" не существует"
|
||||||
|
|
||||||
#: repo.go:155
|
#: repo.go:90
|
||||||
msgid "Error removing repo directory"
|
msgid "Error removing repo directory"
|
||||||
msgstr "Ошибка при удалении каталога репозитория"
|
msgstr "Ошибка при удалении каталога репозитория"
|
||||||
|
|
||||||
#: repo.go:178
|
#: repo.go:94 repo.go:161 repo.go:219
|
||||||
|
msgid "Error saving config"
|
||||||
|
msgstr "Ошибка при сохранении конфигурации"
|
||||||
|
|
||||||
|
#: repo.go:113
|
||||||
msgid "Error removing packages from database"
|
msgid "Error removing packages from database"
|
||||||
msgstr "Ошибка при удалении пакетов из базы данных"
|
msgstr "Ошибка при удалении пакетов из базы данных"
|
||||||
|
|
||||||
#: repo.go:189
|
#: repo.go:124 repo.go:239
|
||||||
msgid "Pull all repositories that have changed"
|
msgid "Add a new repository"
|
||||||
msgstr "Скачать все изменённые репозитории"
|
msgstr "Добавить новый репозиторий"
|
||||||
|
|
||||||
|
#: repo.go:125
|
||||||
|
msgid "<name> <url>"
|
||||||
|
msgstr "<имя> <url>"
|
||||||
|
|
||||||
|
#: repo.go:150
|
||||||
|
msgid "Repo \"%s\" already exists"
|
||||||
|
msgstr "Репозиторий \"%s\" уже существует"
|
||||||
|
|
||||||
|
#: repo.go:187
|
||||||
|
msgid "Set the reference of the repository"
|
||||||
|
msgstr "Установить ссылку на версию репозитория"
|
||||||
|
|
||||||
|
#: repo.go:188
|
||||||
|
msgid "<name> <ref>"
|
||||||
|
msgstr "<имя> <ссылка_на_версию>"
|
||||||
|
|
||||||
|
#: repo.go:246
|
||||||
|
msgid "Name of the new repo"
|
||||||
|
msgstr "Название нового репозитория"
|
||||||
|
|
||||||
|
#: repo.go:252
|
||||||
|
msgid "URL of the new repo"
|
||||||
|
msgstr "URL-адрес нового репозитория"
|
||||||
|
|
||||||
|
#: repo.go:276
|
||||||
|
msgid "Name of the repo to be deleted"
|
||||||
|
msgstr "Название репозитория удалён"
|
||||||
|
|
||||||
#: search.go:40
|
#: search.go:40
|
||||||
msgid "Search packages"
|
msgid "Search packages"
|
||||||
|
|||||||
5
main.go
5
main.go
@@ -74,14 +74,15 @@ func GetApp() *cli.App {
|
|||||||
InfoCmd(),
|
InfoCmd(),
|
||||||
ListCmd(),
|
ListCmd(),
|
||||||
BuildCmd(),
|
BuildCmd(),
|
||||||
AddRepoCmd(),
|
LegacyAddRepoCmd(),
|
||||||
RemoveRepoCmd(),
|
LegacyRemoveRepoCmd(),
|
||||||
RefreshCmd(),
|
RefreshCmd(),
|
||||||
FixCmd(),
|
FixCmd(),
|
||||||
GenCmd(),
|
GenCmd(),
|
||||||
HelperCmd(),
|
HelperCmd(),
|
||||||
VersionCmd(),
|
VersionCmd(),
|
||||||
SearchCmd(),
|
SearchCmd(),
|
||||||
|
RepoCmd(),
|
||||||
// Internal commands
|
// Internal commands
|
||||||
InternalBuildCmd(),
|
InternalBuildCmd(),
|
||||||
InternalInstallCmd(),
|
InternalInstallCmd(),
|
||||||
|
|||||||
52
refresh.go
Normal file
52
refresh.go
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
// 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/>.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/leonelquinteros/gotext"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
|
appbuilder "gitea.plemya-x.ru/Plemya-x/ALR/internal/cliutils/app_builder"
|
||||||
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RefreshCmd() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Name: "refresh",
|
||||||
|
Usage: gotext.Get("Pull all repositories that have changed"),
|
||||||
|
Aliases: []string{"ref"},
|
||||||
|
Action: func(c *cli.Context) error {
|
||||||
|
if err := utils.ExitIfCantDropCapsToAlrUser(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := c.Context
|
||||||
|
|
||||||
|
deps, err := appbuilder.
|
||||||
|
New(ctx).
|
||||||
|
WithConfig().
|
||||||
|
WithDB().
|
||||||
|
WithReposForcePull().
|
||||||
|
Build()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer deps.Defer()
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
251
repo.go
251
repo.go
@@ -33,96 +33,31 @@ import (
|
|||||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/utils"
|
"gitea.plemya-x.ru/Plemya-x/ALR/internal/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func AddRepoCmd() *cli.Command {
|
func RepoCmd() *cli.Command {
|
||||||
return &cli.Command{
|
return &cli.Command{
|
||||||
Name: "addrepo",
|
Name: "repo",
|
||||||
Usage: gotext.Get("Add a new repository"),
|
Usage: gotext.Get("Manage repos"),
|
||||||
Aliases: []string{"ar"},
|
Subcommands: []*cli.Command{
|
||||||
Flags: []cli.Flag{
|
RemoveRepoCmd(),
|
||||||
&cli.StringFlag{
|
AddRepoCmd(),
|
||||||
Name: "name",
|
SetRepoRefCmd(),
|
||||||
Aliases: []string{"n"},
|
|
||||||
Required: true,
|
|
||||||
Usage: gotext.Get("Name of the new repo"),
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "url",
|
|
||||||
Aliases: []string{"u"},
|
|
||||||
Required: true,
|
|
||||||
Usage: gotext.Get("URL of the new repo"),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Action: utils.RootNeededAction(func(c *cli.Context) error {
|
|
||||||
name := c.String("name")
|
|
||||||
repoURL := c.String("url")
|
|
||||||
|
|
||||||
ctx := c.Context
|
|
||||||
|
|
||||||
deps, err := appbuilder.
|
|
||||||
New(ctx).
|
|
||||||
WithConfig().
|
|
||||||
Build()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer deps.Defer()
|
|
||||||
|
|
||||||
cfg := deps.Cfg
|
|
||||||
|
|
||||||
reposSlice := cfg.Repos()
|
|
||||||
for _, repo := range reposSlice {
|
|
||||||
if repo.URL == repoURL || repo.Name == name {
|
|
||||||
return cliutils.FormatCliExit(gotext.Get("Repo \"%s\" already exists", repo.Name), nil)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reposSlice = append(reposSlice, types.Repo{
|
|
||||||
Name: name,
|
|
||||||
URL: repoURL,
|
|
||||||
})
|
|
||||||
cfg.SetRepos(reposSlice)
|
|
||||||
|
|
||||||
err = cfg.SaveUserConfig()
|
|
||||||
if err != nil {
|
|
||||||
return cliutils.FormatCliExit(gotext.Get("Error saving config"), err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := utils.ExitIfCantDropCapsToAlrUserNoPrivs(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
deps, err = appbuilder.
|
|
||||||
New(ctx).
|
|
||||||
UseConfig(cfg).
|
|
||||||
WithDB().
|
|
||||||
WithReposForcePull().
|
|
||||||
Build()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer deps.Defer()
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func RemoveRepoCmd() *cli.Command {
|
func RemoveRepoCmd() *cli.Command {
|
||||||
return &cli.Command{
|
return &cli.Command{
|
||||||
Name: "removerepo",
|
Name: "remove",
|
||||||
Usage: gotext.Get("Remove an existing repository"),
|
Usage: gotext.Get("Remove an existing repository"),
|
||||||
Aliases: []string{"rr"},
|
Aliases: []string{"rm"},
|
||||||
Flags: []cli.Flag{
|
ArgsUsage: gotext.Get("<name>"),
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "name",
|
|
||||||
Aliases: []string{"n"},
|
|
||||||
Required: true,
|
|
||||||
Usage: gotext.Get("Name of the repo to be deleted"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Action: utils.RootNeededAction(func(c *cli.Context) error {
|
Action: utils.RootNeededAction(func(c *cli.Context) error {
|
||||||
ctx := c.Context
|
if c.Args().Len() < 1 {
|
||||||
|
return cliutils.FormatCliExit("missing args", nil)
|
||||||
|
}
|
||||||
|
name := c.Args().Get(0)
|
||||||
|
|
||||||
name := c.String("name")
|
ctx := c.Context
|
||||||
|
|
||||||
deps, err := appbuilder.
|
deps, err := appbuilder.
|
||||||
New(ctx).
|
New(ctx).
|
||||||
@@ -183,21 +118,56 @@ func RemoveRepoCmd() *cli.Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func RefreshCmd() *cli.Command {
|
func AddRepoCmd() *cli.Command {
|
||||||
return &cli.Command{
|
return &cli.Command{
|
||||||
Name: "refresh",
|
Name: "add",
|
||||||
Usage: gotext.Get("Pull all repositories that have changed"),
|
Usage: gotext.Get("Add a new repository"),
|
||||||
Aliases: []string{"ref"},
|
ArgsUsage: gotext.Get("<name> <url>"),
|
||||||
Action: func(c *cli.Context) error {
|
Action: utils.RootNeededAction(func(c *cli.Context) error {
|
||||||
if err := utils.ExitIfCantDropCapsToAlrUser(); err != nil {
|
if c.Args().Len() < 2 {
|
||||||
return err
|
return cliutils.FormatCliExit("missing args", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
name := c.Args().Get(0)
|
||||||
|
repoURL := c.Args().Get(1)
|
||||||
|
|
||||||
ctx := c.Context
|
ctx := c.Context
|
||||||
|
|
||||||
deps, err := appbuilder.
|
deps, err := appbuilder.
|
||||||
New(ctx).
|
New(ctx).
|
||||||
WithConfig().
|
WithConfig().
|
||||||
|
Build()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer deps.Defer()
|
||||||
|
|
||||||
|
cfg := deps.Cfg
|
||||||
|
|
||||||
|
reposSlice := cfg.Repos()
|
||||||
|
for _, repo := range reposSlice {
|
||||||
|
if repo.URL == repoURL || repo.Name == name {
|
||||||
|
return cliutils.FormatCliExit(gotext.Get("Repo \"%s\" already exists", repo.Name), nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reposSlice = append(reposSlice, types.Repo{
|
||||||
|
Name: name,
|
||||||
|
URL: repoURL,
|
||||||
|
})
|
||||||
|
cfg.SetRepos(reposSlice)
|
||||||
|
|
||||||
|
err = cfg.SaveUserConfig()
|
||||||
|
if err != nil {
|
||||||
|
return cliutils.FormatCliExit(gotext.Get("Error saving config"), err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := utils.ExitIfCantDropCapsToAlrUserNoPrivs(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
deps, err = appbuilder.
|
||||||
|
New(ctx).
|
||||||
|
UseConfig(cfg).
|
||||||
WithDB().
|
WithDB().
|
||||||
WithReposForcePull().
|
WithReposForcePull().
|
||||||
Build()
|
Build()
|
||||||
@@ -205,7 +175,110 @@ func RefreshCmd() *cli.Command {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer deps.Defer()
|
defer deps.Defer()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetRepoRefCmd() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Name: "set-ref",
|
||||||
|
Usage: gotext.Get("Set the reference of the repository"),
|
||||||
|
ArgsUsage: gotext.Get("<name> <ref>"),
|
||||||
|
Action: utils.RootNeededAction(func(c *cli.Context) error {
|
||||||
|
if c.Args().Len() < 2 {
|
||||||
|
return cliutils.FormatCliExit("missing args", nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
name := c.Args().Get(0)
|
||||||
|
ref := c.Args().Get(1)
|
||||||
|
|
||||||
|
deps, err := appbuilder.
|
||||||
|
New(c.Context).
|
||||||
|
WithConfig().
|
||||||
|
WithDB().
|
||||||
|
WithReposNoPull().
|
||||||
|
Build()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer deps.Defer()
|
||||||
|
|
||||||
|
repos := deps.Cfg.Repos()
|
||||||
|
newRepos := []types.Repo{}
|
||||||
|
for _, repo := range repos {
|
||||||
|
if repo.Name == name {
|
||||||
|
repo.Ref = ref
|
||||||
|
}
|
||||||
|
newRepos = append(newRepos, repo)
|
||||||
|
}
|
||||||
|
deps.Cfg.SetRepos(newRepos)
|
||||||
|
err = deps.Cfg.SaveUserConfig()
|
||||||
|
if err != nil {
|
||||||
|
return cliutils.FormatCliExit(gotext.Get("Error saving config"), err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = deps.Repos.Pull(c.Context, newRepos)
|
||||||
|
if err != nil {
|
||||||
|
return cliutils.FormatCliExit(gotext.Get("Error pulling repositories"), err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove
|
||||||
|
//
|
||||||
|
// Deprecated: use "alr repo add"
|
||||||
|
func LegacyAddRepoCmd() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Hidden: true,
|
||||||
|
Name: "addrepo",
|
||||||
|
Usage: gotext.Get("Add a new repository"),
|
||||||
|
Aliases: []string{"ar"},
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "name",
|
||||||
|
Aliases: []string{"n"},
|
||||||
|
Required: true,
|
||||||
|
Usage: gotext.Get("Name of the new repo"),
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "url",
|
||||||
|
Aliases: []string{"u"},
|
||||||
|
Required: true,
|
||||||
|
Usage: gotext.Get("URL of the new repo"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Action: utils.RootNeededAction(func(c *cli.Context) error {
|
||||||
|
cliutils.WarnLegacyCommand("alr repo add <name> <url>")
|
||||||
|
return c.App.RunContext(c.Context, []string{"", "repo", "add", c.String("name"), c.String("url")})
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove
|
||||||
|
//
|
||||||
|
// Deprecated: use "alr repo rm"
|
||||||
|
func LegacyRemoveRepoCmd() *cli.Command {
|
||||||
|
return &cli.Command{
|
||||||
|
Hidden: true,
|
||||||
|
Name: "removerepo",
|
||||||
|
Usage: gotext.Get("Remove an existing repository"),
|
||||||
|
Aliases: []string{"rr"},
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "name",
|
||||||
|
Aliases: []string{"n"},
|
||||||
|
Required: true,
|
||||||
|
Usage: gotext.Get("Name of the repo to be deleted"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Action: utils.RootNeededAction(func(c *cli.Context) error {
|
||||||
|
cliutils.WarnLegacyCommand("alr repo remove <name>")
|
||||||
|
return c.App.RunContext(c.Context, []string{"", "repo", "remove", c.String("name")})
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user