forked from Plemya-x/ALR
Compare commits
19 Commits
eb2356458c
...
9540030579
| Author | SHA1 | Date | |
|---|---|---|---|
| 9540030579 | |||
| 4f9d4260b8 | |||
| 38b5e6f581 | |||
| 408bd12302 | |||
| fb83d544de | |||
| 2cb963d4b2 | |||
| e74d74cdf6 | |||
| 5b3d53d253 | |||
| 36e704f735 | |||
| 07356d5e55 | |||
| 52bd6aca93 | |||
| 2f1770b43b | |||
| 9d5b5b51ff | |||
| c88478a450 | |||
| 3e61fec67c | |||
| 6f484a1169 | |||
| dddcb9b7b0 | |||
| b03d94e48b | |||
| f92bd7089a |
105
.gitea/workflows/release.yaml
Normal file
105
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
- name: Clone alr-default repository
|
||||||
|
run: |
|
||||||
|
git clone https://gitea:${{ secrets.GITEAPUBLIC }}@gitea.plemya-x.ru/Plemya-x/alr-default.git /tmp/alr-default
|
||||||
|
|
||||||
|
- name: Update version in alr-bin
|
||||||
|
run: |
|
||||||
|
# Замените значения в файле с конфигурацией
|
||||||
|
sed -i "s/version='[0-9]\+\.[0-9]\+\.[0-9]\+'/version='${{ env.VERSION }}'/g" /tmp/alr-default/alr-bin/alr.sh
|
||||||
|
sed -i "s/release='[0-9]\+'/release='1'/g" /tmp/alr-default/alr-bin/alr.sh
|
||||||
|
|
||||||
|
- name: Commit changes
|
||||||
|
run: |
|
||||||
|
cd /tmp/alr-default
|
||||||
|
git config user.name "gitea"
|
||||||
|
git config user.email "admin@plemya-x.ru"
|
||||||
|
git remote set-url origin https://gitea:${{ secrets.GITEAPUBLIC }}@gitea.plemya-x.ru/Plemya-x/alr-default.git
|
||||||
|
git remote -v
|
||||||
|
git add .
|
||||||
|
git commit -m "Обновление версии до ${{ env.VERSION }}"
|
||||||
|
git push origin master
|
||||||
|
|
||||||
|
- name: Build packages
|
||||||
|
run: |
|
||||||
|
SCRIPT_PATH=/tmp/alr-default/alr-bin/alr.sh
|
||||||
|
ALR_DISTRO=altlinux ALR_PKG_FORMAT=rpm alr build -s "$SCRIPT_PATH"
|
||||||
|
ALR_PKG_FORMAT=rpm alr build -s "$SCRIPT_PATH"
|
||||||
|
ALR_PKG_FORMAT=deb alr build -s "$SCRIPT_PATH"
|
||||||
|
ALR_PKG_FORMAT=archlinux alr build -s "$SCRIPT_PATH"
|
||||||
|
|
||||||
|
- name: Upload assets
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
body: ${{ steps.changes.outputs.changes }}
|
||||||
|
files: |-
|
||||||
|
alr-bin+alr-default_${{ env.VERSION }}-1.red80_amd64.deb \
|
||||||
|
alr-bin+alr-default-${{ env.VERSION }}-1-x86_64.pkg.tar.zst \
|
||||||
|
alr-bin+alr-default-${{ env.VERSION }}-1.red80.x86_64.rpm \
|
||||||
|
alr-bin+alr-default-${{ env.VERSION }}-alt1.x86_64.rpm
|
||||||
16
README.md
16
README.md
@@ -20,10 +20,10 @@ ALR написан на чистом Go и после сборки не имее
|
|||||||
Установочный скрипт автоматически загрузит и установит соответствующий пакет ALR в вашей системе. Чтобы использовать его, просто выполните следующую команду:
|
Установочный скрипт автоматически загрузит и установит соответствующий пакет ALR в вашей системе. Чтобы использовать его, просто выполните следующую команду:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fsSL plemya-x.ru/alr/install.sh | bash
|
curl -fsSL https://gitea.plemya-x.ru/Plemya-x/ALR/raw/branch/master/scripts/install.sh | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
**ВАЖНО**: При этом скрипт будет загружен и запущен с <https://plemya-x.ru/alr/install.sh>. Пожалуйста, просматривайте любые скрипты, которые вы скачиваете из Интернета (включая этот), прежде чем запускать их.
|
**ВАЖНО**: При этом скрипт будет загружен и запущен [скрипт](https://gitea.plemya-x.ru/Plemya-x/ALR/src/branch/master/scripts/install.sh). Пожалуйста, просматривайте любые скрипты, которые вы скачиваете из Интернета (включая этот), прежде чем запускать их.
|
||||||
|
|
||||||
### Сборка из исходного кода
|
### Сборка из исходного кода
|
||||||
|
|
||||||
@@ -52,9 +52,17 @@ ALR был создан потому, что упаковка программн
|
|||||||
|
|
||||||
Репозитории alr - это git-хранилища, которые содержат каталог для каждого пакета с файлом `alr.sh` внутри. Файл `alr.sh` содержит все инструкции по сборке пакета и информацию о нем. Скрипты `alr.sh` аналогичны скриптам Aur PKGBUILD.
|
Репозитории alr - это git-хранилища, которые содержат каталог для каждого пакета с файлом `alr.sh` внутри. Файл `alr.sh` содержит все инструкции по сборке пакета и информацию о нем. Скрипты `alr.sh` аналогичны скриптам Aur PKGBUILD.
|
||||||
|
|
||||||
Например, репозиторий [Plemya-x/alr-repo](https://gitea.plemya-x.ru/Plemya-x/alr-repo.git) можно подключить так:
|
Например, репозиторий с ALR [Plemya-x/alr-default](https://gitea.plemya-x.ru/Plemya-x/alr-default.git)
|
||||||
```
|
```
|
||||||
alr addrepo --name alr-repo --url https://gitea.plemya-x.ru/Plemya-x/alr-repo.git
|
alr repo add alr-default https://gitea.plemya-x.ru/Plemya-x/alr-default.git
|
||||||
|
```
|
||||||
|
Репозиторий пакетов [Plemya-x/alr-repo](https://gitea.plemya-x.ru/Plemya-x/alr-repo.git) можно подключить так:
|
||||||
|
```
|
||||||
|
alr repo add alr-repo https://gitea.plemya-x.ru/Plemya-x/alr-repo.git
|
||||||
|
```
|
||||||
|
Репозиторий Linux-Gaming [Plemya-x/alr-LG](https://gitea.plemya-x.ru/Plemya-x/alr-LG.git) можно подключить так:
|
||||||
|
```
|
||||||
|
alr repo add alr-LG https://gitea.plemya-x.ru/Plemya-x/alr-linux-gaming.git
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -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.0%</text>
|
<text x="86" y="15" fill="#010101" fill-opacity=".3">16.9%</text>
|
||||||
<text x="86" y="14">17.0%</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 |
@@ -12,7 +12,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="37" y="15" fill="#010101" fill-opacity=".3">ru translate</text>
|
<text x="37" y="15" fill="#010101" fill-opacity=".3">ru translate</text>
|
||||||
<text x="37" y="14">ru translate</text>
|
<text x="37" y="14">ru translate</text>
|
||||||
<text x="100" y="15" fill="#010101" fill-opacity=".3">96.00%</text>
|
<text x="100" y="15" fill="#010101" fill-opacity=".3">100.00%</text>
|
||||||
<text x="100" y="14">96.00%</text>
|
<text x="100" y="14">100.00%</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 940 B After Width: | Height: | Size: 942 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)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,9 +159,12 @@ func dockerMultipleRun(t *testing.T, name string, ids []string, f func(t *testin
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
@@ -178,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)
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,25 +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", "apt-get", "update",
|
|
||||||
)))
|
|
||||||
|
|
||||||
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")
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -465,51 +465,59 @@ msgstr ""
|
|||||||
msgid "Manage repos"
|
msgid "Manage repos"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:50 repo.go:220
|
#: repo.go:51 repo.go:269
|
||||||
msgid "Remove an existing repository"
|
msgid "Remove an existing repository"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:52
|
#: repo.go:53
|
||||||
msgid "<name>"
|
msgid "<name>"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:82
|
#: repo.go:83
|
||||||
msgid "Repo \"%s\" does not exist"
|
msgid "Repo \"%s\" does not exist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:89
|
#: repo.go:90
|
||||||
msgid "Error removing repo directory"
|
msgid "Error removing repo directory"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:93 repo.go:160
|
#: repo.go:94 repo.go:161 repo.go:219
|
||||||
msgid "Error saving config"
|
msgid "Error saving config"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:112
|
#: repo.go:113
|
||||||
msgid "Error removing packages from database"
|
msgid "Error removing packages from database"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:123 repo.go:190
|
#: repo.go:124 repo.go:239
|
||||||
msgid "Add a new repository"
|
msgid "Add a new repository"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:124
|
#: repo.go:125
|
||||||
msgid "<name> <url>"
|
msgid "<name> <url>"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:149
|
#: repo.go:150
|
||||||
msgid "Repo \"%s\" already exists"
|
msgid "Repo \"%s\" already exists"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:197
|
#: 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"
|
msgid "Name of the new repo"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:203
|
#: repo.go:252
|
||||||
msgid "URL of the new repo"
|
msgid "URL of the new repo"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: repo.go:227
|
#: repo.go:276
|
||||||
msgid "Name of the repo to be deleted"
|
msgid "Name of the repo to be deleted"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|||||||
@@ -5,15 +5,15 @@
|
|||||||
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"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
|
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
|
||||||
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||||
"X-Generator: Gtranslator 48.0\n"
|
"X-Generator: Gtranslator 48.0\n"
|
||||||
|
|
||||||
#: build.go:42
|
#: build.go:42
|
||||||
@@ -290,6 +290,8 @@ msgid ""
|
|||||||
"This command is deprecated and would be removed in the future, use \"%s\" "
|
"This command is deprecated and would be removed in the future, use \"%s\" "
|
||||||
"instead!"
|
"instead!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Эта команда устарела и будет удалена в будущем, используйте вместо нее "
|
||||||
|
"\"%s\"!"
|
||||||
|
|
||||||
#: internal/db/db.go:137
|
#: internal/db/db.go:137
|
||||||
msgid "Database version mismatch; resetting"
|
msgid "Database version mismatch; resetting"
|
||||||
@@ -477,53 +479,61 @@ msgstr "Скачать все изменённые репозитории"
|
|||||||
|
|
||||||
#: repo.go:39
|
#: repo.go:39
|
||||||
msgid "Manage repos"
|
msgid "Manage repos"
|
||||||
msgstr ""
|
msgstr "Управление репозиториями"
|
||||||
|
|
||||||
#: repo.go:50 repo.go:220
|
#: repo.go:51 repo.go:269
|
||||||
msgid "Remove an existing repository"
|
msgid "Remove an existing repository"
|
||||||
msgstr "Удалить существующий репозиторий"
|
msgstr "Удалить существующий репозиторий"
|
||||||
|
|
||||||
#: repo.go:52
|
#: repo.go:53
|
||||||
msgid "<name>"
|
msgid "<name>"
|
||||||
msgstr ""
|
msgstr "<имя>"
|
||||||
|
|
||||||
#: repo.go:82
|
#: repo.go:83
|
||||||
msgid "Repo \"%s\" does not exist"
|
msgid "Repo \"%s\" does not exist"
|
||||||
msgstr "Репозитория \"%s\" не существует"
|
msgstr "Репозитория \"%s\" не существует"
|
||||||
|
|
||||||
#: repo.go:89
|
#: repo.go:90
|
||||||
msgid "Error removing repo directory"
|
msgid "Error removing repo directory"
|
||||||
msgstr "Ошибка при удалении каталога репозитория"
|
msgstr "Ошибка при удалении каталога репозитория"
|
||||||
|
|
||||||
#: repo.go:93 repo.go:160
|
#: repo.go:94 repo.go:161 repo.go:219
|
||||||
msgid "Error saving config"
|
msgid "Error saving config"
|
||||||
msgstr "Ошибка при сохранении конфигурации"
|
msgstr "Ошибка при сохранении конфигурации"
|
||||||
|
|
||||||
#: repo.go:112
|
#: repo.go:113
|
||||||
msgid "Error removing packages from database"
|
msgid "Error removing packages from database"
|
||||||
msgstr "Ошибка при удалении пакетов из базы данных"
|
msgstr "Ошибка при удалении пакетов из базы данных"
|
||||||
|
|
||||||
#: repo.go:123 repo.go:190
|
#: repo.go:124 repo.go:239
|
||||||
msgid "Add a new repository"
|
msgid "Add a new repository"
|
||||||
msgstr "Добавить новый репозиторий"
|
msgstr "Добавить новый репозиторий"
|
||||||
|
|
||||||
#: repo.go:124
|
#: repo.go:125
|
||||||
msgid "<name> <url>"
|
msgid "<name> <url>"
|
||||||
msgstr ""
|
msgstr "<имя> <url>"
|
||||||
|
|
||||||
#: repo.go:149
|
#: repo.go:150
|
||||||
msgid "Repo \"%s\" already exists"
|
msgid "Repo \"%s\" already exists"
|
||||||
msgstr "Репозиторий \"%s\" уже существует"
|
msgstr "Репозиторий \"%s\" уже существует"
|
||||||
|
|
||||||
#: repo.go:197
|
#: 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"
|
msgid "Name of the new repo"
|
||||||
msgstr "Название нового репозитория"
|
msgstr "Название нового репозитория"
|
||||||
|
|
||||||
#: repo.go:203
|
#: repo.go:252
|
||||||
msgid "URL of the new repo"
|
msgid "URL of the new repo"
|
||||||
msgstr "URL-адрес нового репозитория"
|
msgstr "URL-адрес нового репозитория"
|
||||||
|
|
||||||
#: repo.go:227
|
#: repo.go:276
|
||||||
msgid "Name of the repo to be deleted"
|
msgid "Name of the repo to be deleted"
|
||||||
msgstr "Название репозитория удалён"
|
msgstr "Название репозитория удалён"
|
||||||
|
|
||||||
|
|||||||
49
repo.go
49
repo.go
@@ -40,6 +40,7 @@ func RepoCmd() *cli.Command {
|
|||||||
Subcommands: []*cli.Command{
|
Subcommands: []*cli.Command{
|
||||||
RemoveRepoCmd(),
|
RemoveRepoCmd(),
|
||||||
AddRepoCmd(),
|
AddRepoCmd(),
|
||||||
|
SetRepoRefCmd(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,6 +181,54 @@ func AddRepoCmd() *cli.Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// TODO: remove
|
||||||
//
|
//
|
||||||
// Deprecated: use "alr repo add"
|
// Deprecated: use "alr repo add"
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ installPkg() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
pacman) $rootCmd pacman --noconfirm -U ${@:2} ;;
|
pacman) $rootCmd pacman --noconfirm -U "${@:2}" ;;
|
||||||
apk) $rootCmd apk add --allow-untrusted ${@:2} ;;
|
apk) $rootCmd apk add --allow-untrusted "${@:2}" ;;
|
||||||
zypper) $rootCmd zypper --no-gpg-checks install ${@:2} ;;
|
zypper) $rootCmd zypper --no-gpg-checks install "${@:2}" ;;
|
||||||
*) $rootCmd $1 install -y ${@:2} ;;
|
*) $rootCmd "$1" install -y "${@:2}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,60 +88,51 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$noPkgMgr" ]; then
|
if [ -z "$noPkgMgr" ]; then
|
||||||
info "Получение списка файлов с https://plemya-x.ru/"
|
info "Получение списка файлов с https://gitea.plemya-x.ru/Plemya-x/ALR/releases"
|
||||||
pageContent=$(curl -s https://plemya-x.ru/?dir=alr)
|
|
||||||
|
# Изменено URL и регулярное выражение для списка файлов
|
||||||
|
pageContent=$(curl -s https://gitea.plemya-x.ru/Plemya-x/ALR/releases)
|
||||||
|
|
||||||
# Извлечение списка файлов из HTML
|
# Извлечение списка файлов из HTML
|
||||||
fileList=$(echo "$pageContent" | grep -oP '(?<=href=").*?(?=")' | grep -E 'alr-bin-.*.(pkg.tar.zst|rpm|deb)')
|
fileList=$(echo "$pageContent" | grep -oP '(?<=href=").*?(?=")' | grep -E 'alr-bin.*\.(pkg.tar.zst|rpm|deb)')
|
||||||
|
|
||||||
echo "Полученный список файлов:"
|
echo "Полученный список файлов:"
|
||||||
echo "$fileList"
|
echo "$fileList"
|
||||||
if [ "$pkgMgr" == "pacman" ]; then
|
|
||||||
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*\.pkg\.tar\.zst' | sort -V | tail -n 1)
|
if [ "$pkgMgr" == "pacman" ]; then
|
||||||
elif [ "$pkgMgr" == "apt" ]; then
|
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*\.pkg\.tar\.zst' | sort -V | tail -n 1)
|
||||||
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*\.amd64\.deb' | sort -V | tail -n 1)
|
elif [ "$pkgMgr" == "apt" ]; then
|
||||||
elif [[ "$pkgMgr" == "dnf" || "$pkgMgr" == "yum" || "$pkgMgr" == "zypper" ]]; then
|
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*\.amd64\.deb' | 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=$(printf "%s\n" "${fileList[@]}" | grep -E 'alr-bin-.*\.x86_64\.rpm' | grep -v 'alt[0-9]*' | sort -V | tail -n 1)
|
||||||
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*-alt[0-9]+\.x86_64\.rpm' | sort -V | tail -n 1)
|
elif [ "$pkgMgr" == "apt-get" ]; then
|
||||||
|
latestFile=$(echo "$fileList" | grep -E 'alr-bin-.*-alt[0-9]+\.x86_64\.rpm' | sort -V | tail -n 1)
|
||||||
|
else
|
||||||
|
error "Не поддерживаемый менеджер пакетов для автоматической установки"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$latestFile" ]; then
|
||||||
|
error "Не удалось найти соответствующий пакет для $pkgMgr"
|
||||||
|
fi
|
||||||
|
|
||||||
|
info "Найдена последняя версия ALR: $latestFile"
|
||||||
|
|
||||||
|
fname="$(mktemp -u -p /tmp "alr.XXXXXXXXXX").${pkgFormat}"
|
||||||
|
|
||||||
|
info "Загрузка пакета ALR"
|
||||||
|
curl -o $fname -L "$latestFile"
|
||||||
|
|
||||||
|
if [ ! -f "$fname" ]; then
|
||||||
|
error "Ошибка загрузки пакета ALR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
info "Установка пакета ALR"
|
||||||
|
installPkg "$pkgMgr" "$fname"
|
||||||
|
|
||||||
|
info "Очистка"
|
||||||
|
rm "$fname"
|
||||||
|
|
||||||
|
info "Готово!"
|
||||||
else
|
else
|
||||||
error "Не поддерживаемый менеджер пакетов для автоматической установки"
|
echo "Не найден поддерживаемый менеджер пакетов. О_о"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$latestFile" ]; then
|
|
||||||
error "Не удалось найти соответствующий пакет для $pkgMgr"
|
|
||||||
fi
|
|
||||||
|
|
||||||
info "Найдена последняя версия ALR: $latestFile"
|
|
||||||
|
|
||||||
url="https://plemya-x.ru/$latestFile"
|
|
||||||
fname="$(mktemp -u -p /tmp "alr.XXXXXXXXXX").${pkgFormat}"
|
|
||||||
|
|
||||||
info "Загрузка пакета ALR"
|
|
||||||
curl -L $url -o $fname
|
|
||||||
|
|
||||||
if [ ! -f "$fname" ]; then
|
|
||||||
error "Ошибка загрузки пакета ALR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
info "Установка пакета ALR"
|
|
||||||
installPkg $pkgMgr $fname
|
|
||||||
|
|
||||||
info "Очистка"
|
|
||||||
rm $fname
|
|
||||||
|
|
||||||
info "Готово!"
|
|
||||||
|
|
||||||
else
|
|
||||||
info "Клонирование репозитория ALR"
|
|
||||||
git clone https://gitea.plemya-x.ru/xpamych/ALR.git /tmp/alr
|
|
||||||
|
|
||||||
info "Установка ALR"
|
|
||||||
cd /tmp/alr
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
info "Очистка репозитория ALR"
|
|
||||||
rm -rf /tmp/alr
|
|
||||||
|
|
||||||
info "Все задачи выполнены!"
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user