diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 6b8243f..3dbe36d 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -84,31 +84,31 @@ jobs: sed -i "s/version='[0-9]\+\.[0-9]\+\.[0-9]\+'/version='${{ env.VERSION }}'/g" alr-default/alr-bin/alr.sh sed -i "s/release='[0-9]\+'/release='1'/g" alr-default/alr-bin/alr.sh - - name: Install alr - run: | - make install +# - name: Install alr +# run: | +# make install +# +# # temporary fix +# groupadd wheel +# usermod -aG wheel root - # temporary fix - groupadd wheel - usermod -aG wheel root +# - name: Build packages +# run: | +# SCRIPT_PATH=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: Build packages - run: | - SCRIPT_PATH=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 +# - 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 - name: Commit changes run: | diff --git a/assets/coverage-badge.svg b/assets/coverage-badge.svg index e1e8356..259d4b3 100644 --- a/assets/coverage-badge.svg +++ b/assets/coverage-badge.svg @@ -11,7 +11,7 @@ coverage coverage - 18.8% - 18.8% + 18.9% + 18.9% diff --git a/internal/repos/pull.go b/internal/repos/pull.go index d9beccb..e0944d8 100644 --- a/internal/repos/pull.go +++ b/internal/repos/pull.go @@ -68,33 +68,40 @@ func (rs *Repos) Pull(ctx context.Context, repos []types.Repo) error { } for _, repo := range repos { - urls := []string{repo.URL} - urls = append(urls, repo.Mirrors...) - - var lastErr error - - for i, repoURL := range urls { - if i > 0 { - slog.Info(gotext.Get("Trying mirror"), "repo", repo.Name, "mirror", repoURL) - } - - err := rs.pullRepoFromURL(ctx, repoURL, repo) - if err != nil { - lastErr = err - slog.Warn(gotext.Get("Failed to pull from URL"), "repo", repo.Name, "url", repoURL, "error", err) - continue - } - - // Success - return nil + err := rs.pullRepo(ctx, repo) + if err != nil { + return err } - - return fmt.Errorf("failed to pull repository %s from any URL: %w", repo.Name, lastErr) } return nil } +func (rs *Repos) pullRepo(ctx context.Context, repo types.Repo) error { + urls := []string{repo.URL} + urls = append(urls, repo.Mirrors...) + + var lastErr error + + for i, repoURL := range urls { + if i > 0 { + slog.Info(gotext.Get("Trying mirror"), "repo", repo.Name, "mirror", repoURL) + } + + err := rs.pullRepoFromURL(ctx, repoURL, repo) + if err != nil { + lastErr = err + slog.Warn(gotext.Get("Failed to pull from URL"), "repo", repo.Name, "url", repoURL, "error", err) + continue + } + + // Success + return nil + } + + return fmt.Errorf("failed to pull repository %s from any URL: %w", repo.Name, lastErr) +} + func readGitRepo(repoDir, repoUrl string) (*git.Repository, bool, error) { gitDir := filepath.Join(repoDir, ".git") if fi, err := os.Stat(gitDir); err == nil && fi.IsDir() { diff --git a/internal/translations/default.pot b/internal/translations/default.pot index b1c0bb1..ca81861 100644 --- a/internal/translations/default.pot +++ b/internal/translations/default.pot @@ -383,27 +383,27 @@ msgstr "" msgid "ERROR" msgstr "" -#: internal/repos/pull.go:78 +#: internal/repos/pull.go:88 msgid "Trying mirror" msgstr "" -#: internal/repos/pull.go:84 +#: internal/repos/pull.go:94 msgid "Failed to pull from URL" msgstr "" -#: internal/repos/pull.go:151 +#: internal/repos/pull.go:158 msgid "Pulling repository" msgstr "" -#: internal/repos/pull.go:188 +#: internal/repos/pull.go:195 msgid "Repository up to date" msgstr "" -#: internal/repos/pull.go:223 +#: internal/repos/pull.go:230 msgid "Git repository does not appear to be a valid ALR repo" msgstr "" -#: internal/repos/pull.go:239 +#: internal/repos/pull.go:246 msgid "" "ALR repo's minimum ALR version is greater than the current version. Try " "updating ALR if something doesn't work." diff --git a/internal/translations/po/ru/default.po b/internal/translations/po/ru/default.po index b8db48a..b109c78 100644 --- a/internal/translations/po/ru/default.po +++ b/internal/translations/po/ru/default.po @@ -12,8 +12,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " -"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Generator: Gtranslator 48.0\n" #: build.go:42 @@ -356,8 +356,8 @@ msgid "" "This command is deprecated and would be removed in the future, use \"%s\" " "instead!" msgstr "" -"Эта команда устарела и будет удалена в будущем, используйте вместо нее " -"\"%s\"!" +"Эта команда устарела и будет удалена в будущем, используйте вместо нее \"%s" +"\"!" #: internal/db/db.go:76 msgid "Database version mismatch; resetting" @@ -397,27 +397,27 @@ msgstr "%s %s загружается — %s/с\n" msgid "ERROR" msgstr "ОШИБКА" -#: internal/repos/pull.go:78 +#: internal/repos/pull.go:88 msgid "Trying mirror" msgstr "Пробую зеркало" -#: internal/repos/pull.go:84 +#: internal/repos/pull.go:94 msgid "Failed to pull from URL" msgstr "Не удалось извлечь из URL" -#: internal/repos/pull.go:151 +#: internal/repos/pull.go:158 msgid "Pulling repository" msgstr "Скачивание репозитория" -#: internal/repos/pull.go:188 +#: internal/repos/pull.go:195 msgid "Repository up to date" msgstr "Репозиторий уже обновлён" -#: internal/repos/pull.go:223 +#: internal/repos/pull.go:230 msgid "Git repository does not appear to be a valid ALR repo" msgstr "Репозиторий Git не поддерживается репозиторием ALR" -#: internal/repos/pull.go:239 +#: internal/repos/pull.go:246 msgid "" "ALR repo's minimum ALR version is greater than the current version. Try " "updating ALR if something doesn't work."