forked from Plemya-x/ALR
		
	alr изменения
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -24,11 +24,11 @@ import (
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"github.com/AlecAivazis/survey/v2"
 | 
			
		||||
	"lure.sh/lure/internal/config"
 | 
			
		||||
	"lure.sh/lure/internal/db"
 | 
			
		||||
	"lure.sh/lure/internal/pager"
 | 
			
		||||
	"lure.sh/lure/internal/translations"
 | 
			
		||||
	"lure.sh/lure/pkg/loggerctx"
 | 
			
		||||
	"plemya-x.ru/alr/internal/config"
 | 
			
		||||
	"plemya-x.ru/alr/internal/db"
 | 
			
		||||
	"plemya-x.ru/alr/internal/pager"
 | 
			
		||||
	"plemya-x.ru/alr/internal/translations"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/loggerctx"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// YesNoPrompt asks the user a yes or no question, using def as the default answer
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -24,8 +24,8 @@ import (
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"github.com/pelletier/go-toml/v2"
 | 
			
		||||
	"lure.sh/lure/internal/types"
 | 
			
		||||
	"lure.sh/lure/pkg/loggerctx"
 | 
			
		||||
	"plemya-x.ru/alr/internal/types"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/loggerctx"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var defaultConfig = &types.Config{
 | 
			
		||||
@@ -35,7 +35,7 @@ var defaultConfig = &types.Config{
 | 
			
		||||
	Repos: []types.Repo{
 | 
			
		||||
		{
 | 
			
		||||
			Name: "default",
 | 
			
		||||
			URL:  "https://github.com/lure-sh/lure-repo.git",
 | 
			
		||||
			URL:  "https://gitflic.ru/project/xpamych/xpamych-alr-repo.git",
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
}
 | 
			
		||||
@@ -45,7 +45,7 @@ var (
 | 
			
		||||
	config    *types.Config
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Config returns a LURE configuration struct.
 | 
			
		||||
// Config returns a ALR configuration struct.
 | 
			
		||||
// The first time it's called, it'll load the config from a file.
 | 
			
		||||
// Subsequent calls will just return the same value.
 | 
			
		||||
func Config(ctx context.Context) *types.Config {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -24,7 +24,7 @@ import (
 | 
			
		||||
	"strings"
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"lure.sh/lure/pkg/loggerctx"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/loggerctx"
 | 
			
		||||
	"golang.org/x/text/language"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -25,10 +25,10 @@ import (
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"github.com/pelletier/go-toml/v2"
 | 
			
		||||
	"lure.sh/lure/pkg/loggerctx"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/loggerctx"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Paths contains various paths used by LURE
 | 
			
		||||
// Paths contains various paths used by ALR
 | 
			
		||||
type Paths struct {
 | 
			
		||||
	ConfigDir  string
 | 
			
		||||
	ConfigPath string
 | 
			
		||||
@@ -60,19 +60,19 @@ func GetPaths(ctx context.Context) *Paths {
 | 
			
		||||
			log.Fatal("Unable to detect user config directory").Err(err).Send()
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		paths.ConfigDir = filepath.Join(cfgDir, "lure")
 | 
			
		||||
		paths.ConfigDir = filepath.Join(cfgDir, "alr")
 | 
			
		||||
 | 
			
		||||
		err = os.MkdirAll(paths.ConfigDir, 0o755)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			log.Fatal("Unable to create LURE config directory").Err(err).Send()
 | 
			
		||||
			log.Fatal("Unable to create ALR config directory").Err(err).Send()
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		paths.ConfigPath = filepath.Join(paths.ConfigDir, "lure.toml")
 | 
			
		||||
		paths.ConfigPath = filepath.Join(paths.ConfigDir, "alr.toml")
 | 
			
		||||
 | 
			
		||||
		if _, err := os.Stat(paths.ConfigPath); err != nil {
 | 
			
		||||
			cfgFl, err := os.Create(paths.ConfigPath)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				log.Fatal("Unable to create LURE config file").Err(err).Send()
 | 
			
		||||
				log.Fatal("Unable to create ALR config file").Err(err).Send()
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			err = toml.NewEncoder(cfgFl).Encode(&defaultConfig)
 | 
			
		||||
@@ -88,7 +88,7 @@ func GetPaths(ctx context.Context) *Paths {
 | 
			
		||||
			log.Fatal("Unable to detect cache directory").Err(err).Send()
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		paths.CacheDir = filepath.Join(cacheDir, "lure")
 | 
			
		||||
		paths.CacheDir = filepath.Join(cacheDir, "alr")
 | 
			
		||||
		paths.RepoDir = filepath.Join(paths.CacheDir, "repo")
 | 
			
		||||
		paths.PkgsDir = filepath.Join(paths.CacheDir, "pkgs")
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
package config
 | 
			
		||||
 | 
			
		||||
// Version contains the version of LURE. If the version
 | 
			
		||||
// Version contains the version of ALR. If the version
 | 
			
		||||
// isn't known, it'll be set to "unknown"
 | 
			
		||||
var Version = "unknown"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -28,10 +28,10 @@ import (
 | 
			
		||||
	"golang.org/x/sys/cpu"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// armVariant checks which variant of ARM lure is running
 | 
			
		||||
// armVariant checks which variant of ARM alr is running
 | 
			
		||||
// on, by using the same detection method as Go itself
 | 
			
		||||
func armVariant() string {
 | 
			
		||||
	armEnv := os.Getenv("LURE_ARM_VARIANT")
 | 
			
		||||
	armEnv := os.Getenv("ALR_ARM_VARIANT")
 | 
			
		||||
	// ensure value has "arm" prefix, such as arm5 or arm6
 | 
			
		||||
	if strings.HasPrefix(armEnv, "arm") {
 | 
			
		||||
		return armEnv
 | 
			
		||||
@@ -48,7 +48,7 @@ func armVariant() string {
 | 
			
		||||
 | 
			
		||||
// Arch returns the canonical CPU architecture of the system
 | 
			
		||||
func Arch() string {
 | 
			
		||||
	arch := os.Getenv("LURE_ARCH")
 | 
			
		||||
	arch := os.Getenv("ALR_ARCH")
 | 
			
		||||
	if arch == "" {
 | 
			
		||||
		arch = runtime.GOARCH
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -28,8 +28,8 @@ import (
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"github.com/jmoiron/sqlx"
 | 
			
		||||
	"lure.sh/lure/internal/config"
 | 
			
		||||
	"lure.sh/lure/pkg/loggerctx"
 | 
			
		||||
	"plemya-x.ru/alr/internal/config"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/loggerctx"
 | 
			
		||||
	"golang.org/x/exp/slices"
 | 
			
		||||
	"modernc.org/sqlite"
 | 
			
		||||
)
 | 
			
		||||
@@ -42,7 +42,7 @@ func init() {
 | 
			
		||||
	sqlite.MustRegisterScalarFunction("json_array_contains", 2, jsonArrayContains)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Package is a LURE package's database representation
 | 
			
		||||
// Package is a ALR package's database representation
 | 
			
		||||
type Package struct {
 | 
			
		||||
	Name          string                    `sh:"name,required" db:"name"`
 | 
			
		||||
	Version       string                    `sh:"version,required" db:"version"`
 | 
			
		||||
@@ -72,7 +72,7 @@ var (
 | 
			
		||||
	closed = true
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// DB returns the LURE database.
 | 
			
		||||
// DB returns the ALR database.
 | 
			
		||||
// The first time it's called, it opens the SQLite database file.
 | 
			
		||||
// Subsequent calls return the same connection.
 | 
			
		||||
func DB(ctx context.Context) *sqlx.DB {
 | 
			
		||||
@@ -147,7 +147,7 @@ func initDB(ctx context.Context, dsn string) error {
 | 
			
		||||
			UNIQUE(name, repository)
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
		CREATE TABLE IF NOT EXISTS lure_db_version (
 | 
			
		||||
		CREATE TABLE IF NOT EXISTS alr_db_version (
 | 
			
		||||
			version INT NOT NULL
 | 
			
		||||
		);
 | 
			
		||||
	`)
 | 
			
		||||
@@ -161,7 +161,7 @@ func initDB(ctx context.Context, dsn string) error {
 | 
			
		||||
		reset(ctx)
 | 
			
		||||
		return initDB(ctx, dsn)
 | 
			
		||||
	} else if !ok {
 | 
			
		||||
		log.Warn("Database version does not exist. Run lure fix if something isn't working.").Send()
 | 
			
		||||
		log.Warn("Database version does not exist. Run alr fix if something isn't working.").Send()
 | 
			
		||||
		return addVersion(ctx, CurrentVersion)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -174,7 +174,7 @@ func reset(ctx context.Context) error {
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	_, err = DB(ctx).ExecContext(ctx, "DROP TABLE IF EXISTS lure_db_version;")
 | 
			
		||||
	_, err = DB(ctx).ExecContext(ctx, "DROP TABLE IF EXISTS alr_db_version;")
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -192,7 +192,7 @@ func IsEmpty(ctx context.Context) bool {
 | 
			
		||||
// whether the database contained a version number
 | 
			
		||||
func GetVersion(ctx context.Context) (int, bool) {
 | 
			
		||||
	var ver version
 | 
			
		||||
	err := DB(ctx).GetContext(ctx, &ver, "SELECT * FROM lure_db_version LIMIT 1;")
 | 
			
		||||
	err := DB(ctx).GetContext(ctx, &ver, "SELECT * FROM alr_db_version LIMIT 1;")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, false
 | 
			
		||||
	}
 | 
			
		||||
@@ -200,7 +200,7 @@ func GetVersion(ctx context.Context) (int, bool) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func addVersion(ctx context.Context, ver int) error {
 | 
			
		||||
	_, err := DB(ctx).ExecContext(ctx, `INSERT INTO lure_db_version(version) VALUES (?);`, ver)
 | 
			
		||||
	_, err := DB(ctx).ExecContext(ctx, `INSERT INTO alr_db_version(version) VALUES (?);`, ver)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -24,7 +24,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/jmoiron/sqlx"
 | 
			
		||||
	"lure.sh/lure/internal/db"
 | 
			
		||||
	"plemya-x.ru/alr/internal/db"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var testPkg = db.Package{
 | 
			
		||||
@@ -37,10 +37,10 @@ var testPkg = db.Package{
 | 
			
		||||
		"ru": "Проверочный пакет",
 | 
			
		||||
	}),
 | 
			
		||||
	Homepage: db.NewJSON(map[string]string{
 | 
			
		||||
		"en": "https://lure.sh/",
 | 
			
		||||
		"en": "https://gitflic.ru/project/xpamych/alr/",
 | 
			
		||||
	}),
 | 
			
		||||
	Maintainer: db.NewJSON(map[string]string{
 | 
			
		||||
		"en": "Elara Musayelyan <elara@elara.ws>",
 | 
			
		||||
		"en": "Евгений Храмов <xpamych@yandex.ru>",
 | 
			
		||||
		"ru": "Элара Мусаелян <elara@elara.ws>",
 | 
			
		||||
	}),
 | 
			
		||||
	Architectures: db.NewJSON([]string{"arm64", "amd64"}),
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -39,11 +39,11 @@ import (
 | 
			
		||||
	"golang.org/x/crypto/blake2b"
 | 
			
		||||
	"golang.org/x/crypto/blake2s"
 | 
			
		||||
	"golang.org/x/exp/slices"
 | 
			
		||||
	"lure.sh/lure/internal/dlcache"
 | 
			
		||||
	"lure.sh/lure/pkg/loggerctx"
 | 
			
		||||
	"plemya-x.ru/alr/internal/dlcache"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/loggerctx"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const manifestFileName = ".lure_cache_manifest"
 | 
			
		||||
const manifestFileName = ".alr_cache_manifest"
 | 
			
		||||
 | 
			
		||||
// ErrChecksumMismatch occurs when the checksum of a downloaded file
 | 
			
		||||
// does not match the expected checksum provided in the Options struct.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -33,7 +33,7 @@ import (
 | 
			
		||||
 | 
			
		||||
	"github.com/mholt/archiver/v4"
 | 
			
		||||
	"github.com/schollz/progressbar/v3"
 | 
			
		||||
	"lure.sh/lure/internal/shutils/handlers"
 | 
			
		||||
	"plemya-x.ru/alr/internal/shutils/handlers"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// FileDownloader downloads files using HTTP
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -26,7 +26,7 @@ import (
 | 
			
		||||
	"os"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
 | 
			
		||||
	"lure.sh/lure/internal/config"
 | 
			
		||||
	"plemya-x.ru/alr/internal/config"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// BasePath returns the base path of the download cache
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -27,12 +27,12 @@ import (
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"lure.sh/lure/internal/config"
 | 
			
		||||
	"lure.sh/lure/internal/dlcache"
 | 
			
		||||
	"plemya-x.ru/alr/internal/config"
 | 
			
		||||
	"plemya-x.ru/alr/internal/dlcache"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	dir, err := os.MkdirTemp("/tmp", "lure-dlcache-test.*")
 | 
			
		||||
	dir, err := os.MkdirTemp("/tmp", "alr-dlcache-test.*")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		panic(err)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -22,9 +22,9 @@ import (
 | 
			
		||||
	"reflect"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"lure.sh/lure/internal/cpu"
 | 
			
		||||
	"lure.sh/lure/internal/db"
 | 
			
		||||
	"lure.sh/lure/pkg/distro"
 | 
			
		||||
	"plemya-x.ru/alr/internal/cpu"
 | 
			
		||||
	"plemya-x.ru/alr/internal/db"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/distro"
 | 
			
		||||
	"golang.org/x/exp/slices"
 | 
			
		||||
	"golang.org/x/text/language"
 | 
			
		||||
)
 | 
			
		||||
@@ -146,7 +146,7 @@ func (o *Opts) WithLanguageTags(langs []string) *Opts {
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ResolvedPackage is a LURE package after its overrides
 | 
			
		||||
// ResolvedPackage is a ALR package after its overrides
 | 
			
		||||
// have been resolved
 | 
			
		||||
type ResolvedPackage struct {
 | 
			
		||||
	Name          string   `sh:"name"`
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -23,8 +23,8 @@ import (
 | 
			
		||||
	"reflect"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"lure.sh/lure/internal/overrides"
 | 
			
		||||
	"lure.sh/lure/pkg/distro"
 | 
			
		||||
	"plemya-x.ru/alr/internal/overrides"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/distro"
 | 
			
		||||
	"golang.org/x/text/language"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -90,8 +90,8 @@ func TestResolveName(t *testing.T) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestResolveArch(t *testing.T) {
 | 
			
		||||
	os.Setenv("LURE_ARCH", "arm7")
 | 
			
		||||
	defer os.Setenv("LURE_ARCH", "")
 | 
			
		||||
	os.Setenv("ALR_ARCH", "arm7")
 | 
			
		||||
	defer os.Setenv("ALR_ARCH", "")
 | 
			
		||||
 | 
			
		||||
	names, err := overrides.Resolve(info, &overrides.Opts{
 | 
			
		||||
		Name:        "deps",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -25,8 +25,8 @@ import (
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"github.com/mitchellh/mapstructure"
 | 
			
		||||
	"lure.sh/lure/internal/overrides"
 | 
			
		||||
	"lure.sh/lure/pkg/distro"
 | 
			
		||||
	"plemya-x.ru/alr/internal/overrides"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/distro"
 | 
			
		||||
	"golang.org/x/exp/slices"
 | 
			
		||||
	"mvdan.cc/sh/v3/expand"
 | 
			
		||||
	"mvdan.cc/sh/v3/interp"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -27,8 +27,8 @@ import (
 | 
			
		||||
	"strings"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"lure.sh/lure/internal/shutils/decoder"
 | 
			
		||||
	"lure.sh/lure/pkg/distro"
 | 
			
		||||
	"plemya-x.ru/alr/internal/shutils/decoder"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/distro"
 | 
			
		||||
	"mvdan.cc/sh/v3/interp"
 | 
			
		||||
	"mvdan.cc/sh/v3/syntax"
 | 
			
		||||
)
 | 
			
		||||
@@ -56,8 +56,8 @@ const testScript = `
 | 
			
		||||
	release=1
 | 
			
		||||
	epoch=2
 | 
			
		||||
	desc="Test package"
 | 
			
		||||
	homepage='https://lure.arsenm.dev'
 | 
			
		||||
	maintainer='Arsen Musayelyan <arsen@arsenm.dev>'
 | 
			
		||||
	homepage='https://gitflic.ru/project/xpamych/alr'
 | 
			
		||||
	maintainer='Евгений Храмов <xpamych@yandex.ru>'
 | 
			
		||||
	architectures=('arm64' 'amd64')
 | 
			
		||||
	license=('GPL-3.0-or-later')
 | 
			
		||||
	provides=('test')
 | 
			
		||||
@@ -87,7 +87,7 @@ var osRelease = &distro.OSRelease{
 | 
			
		||||
func TestDecodeVars(t *testing.T) {
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
 | 
			
		||||
	fl, err := syntax.NewParser().Parse(strings.NewReader(testScript), "lure.sh")
 | 
			
		||||
	fl, err := syntax.NewParser().Parse(strings.NewReader(testScript), "alr.sh")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatalf("Expected no error, got %s", err)
 | 
			
		||||
	}
 | 
			
		||||
@@ -116,7 +116,7 @@ func TestDecodeVars(t *testing.T) {
 | 
			
		||||
		Release:       1,
 | 
			
		||||
		Epoch:         2,
 | 
			
		||||
		Description:   "Test package",
 | 
			
		||||
		Homepage:      "https://lure.arsenm.dev",
 | 
			
		||||
		Homepage:      "https://gitflic.ru/project/xpamych/alr",
 | 
			
		||||
		Maintainer:    "Arsen Musayelyan <arsen@arsenm.dev>",
 | 
			
		||||
		Architectures: []string{"arm64", "amd64"},
 | 
			
		||||
		Licenses:      []string{"GPL-3.0-or-later"},
 | 
			
		||||
@@ -139,7 +139,7 @@ func TestDecodeVarsMissing(t *testing.T) {
 | 
			
		||||
		name='test'
 | 
			
		||||
		epoch=2
 | 
			
		||||
		desc="Test package"
 | 
			
		||||
		homepage='https://lure.arsenm.dev'
 | 
			
		||||
		homepage='https://gitflic.ru/project/xpamych/alr'
 | 
			
		||||
		maintainer='Arsen Musayelyan <arsen@arsenm.dev>'
 | 
			
		||||
		architectures=('arm64' 'amd64')
 | 
			
		||||
		license=('GPL-3.0-or-later')
 | 
			
		||||
@@ -162,7 +162,7 @@ func TestDecodeVarsMissing(t *testing.T) {
 | 
			
		||||
		}
 | 
			
		||||
	`
 | 
			
		||||
 | 
			
		||||
	fl, err := syntax.NewParser().Parse(strings.NewReader(testScript), "lure.sh")
 | 
			
		||||
	fl, err := syntax.NewParser().Parse(strings.NewReader(testScript), "alr.sh")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatalf("Expected no error, got %s", err)
 | 
			
		||||
	}
 | 
			
		||||
@@ -191,7 +191,7 @@ func TestDecodeVarsMissing(t *testing.T) {
 | 
			
		||||
func TestGetFunc(t *testing.T) {
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
 | 
			
		||||
	fl, err := syntax.NewParser().Parse(strings.NewReader(testScript), "lure.sh")
 | 
			
		||||
	fl, err := syntax.NewParser().Parse(strings.NewReader(testScript), "alr.sh")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatalf("Expected no error, got %s", err)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -23,9 +23,9 @@ import (
 | 
			
		||||
	"strings"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"lure.sh/lure/internal/shutils/handlers"
 | 
			
		||||
	"lure.sh/lure/internal/shutils/decoder"
 | 
			
		||||
	"lure.sh/lure/pkg/distro"
 | 
			
		||||
	"plemya-x.ru/alr/internal/shutils/handlers"
 | 
			
		||||
	"plemya-x.ru/alr/internal/shutils/decoder"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/distro"
 | 
			
		||||
	"mvdan.cc/sh/v3/interp"
 | 
			
		||||
	"mvdan.cc/sh/v3/syntax"
 | 
			
		||||
)
 | 
			
		||||
@@ -36,8 +36,8 @@ const testScript = `
 | 
			
		||||
	release=1
 | 
			
		||||
	epoch=2
 | 
			
		||||
	desc="Test package"
 | 
			
		||||
	homepage='https://lure.sh'
 | 
			
		||||
	maintainer='Elara Musayelyan <elara@elara.ws>'
 | 
			
		||||
	homepage='https://gitflic.ru/project/xpamych/alr'
 | 
			
		||||
	maintainer='Евгений Храмов <xpamych@yandex.ru>'
 | 
			
		||||
	architectures=('arm64' 'amd64')
 | 
			
		||||
	license=('GPL-3.0-or-later')
 | 
			
		||||
	provides=('test')
 | 
			
		||||
@@ -68,7 +68,7 @@ var osRelease = &distro.OSRelease{
 | 
			
		||||
func TestExecFuncs(t *testing.T) {
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
 | 
			
		||||
	fl, err := syntax.NewParser().Parse(strings.NewReader(testScript), "lure.sh")
 | 
			
		||||
	fl, err := syntax.NewParser().Parse(strings.NewReader(testScript), "alr.sh")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatalf("Expected no error, got %s", err)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -25,7 +25,7 @@ import (
 | 
			
		||||
	"strings"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"lure.sh/lure/internal/shutils/handlers"
 | 
			
		||||
	"plemya-x.ru/alr/internal/shutils/handlers"
 | 
			
		||||
	"mvdan.cc/sh/v3/interp"
 | 
			
		||||
	"mvdan.cc/sh/v3/syntax"
 | 
			
		||||
)
 | 
			
		||||
@@ -33,7 +33,7 @@ import (
 | 
			
		||||
func TestNopExec(t *testing.T) {
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
 | 
			
		||||
	fl, err := syntax.NewParser().Parse(strings.NewReader(`/bin/echo test`), "lure.sh")
 | 
			
		||||
	fl, err := syntax.NewParser().Parse(strings.NewReader(`/bin/echo test`), "alr.sh")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatalf("Expected no error, got %s", err)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -31,7 +31,7 @@ import (
 | 
			
		||||
	"github.com/go-git/go-git/v5"
 | 
			
		||||
	"github.com/go-git/go-git/v5/plumbing/object"
 | 
			
		||||
	"golang.org/x/exp/slices"
 | 
			
		||||
	"lure.sh/lure/internal/shutils/handlers"
 | 
			
		||||
	"plemya-x.ru/alr/internal/shutils/handlers"
 | 
			
		||||
	"mvdan.cc/sh/v3/interp"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -186,7 +186,7 @@ var usrLibDistros = []string{
 | 
			
		||||
 | 
			
		||||
// Based on CMake's GNUInstallDirs
 | 
			
		||||
func getLibPrefix(hc interp.HandlerContext) string {
 | 
			
		||||
	if dir, ok := os.LookupEnv("LURE_LIB_DIR"); ok {
 | 
			
		||||
	if dir, ok := os.LookupEnv("ALR_LIB_DIR"); ok {
 | 
			
		||||
		return dir
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -120,7 +120,7 @@ value = 'Building package metadata'
 | 
			
		||||
 | 
			
		||||
[[translation]]
 | 
			
		||||
id = 3121791194
 | 
			
		||||
value = 'Running LURE as root is forbidden as it may cause catastrophic damage to your system'
 | 
			
		||||
value = 'Running ALR as root is forbidden as it may cause catastrophic damage to your system'
 | 
			
		||||
 | 
			
		||||
[[translation]]
 | 
			
		||||
id = 1256604213
 | 
			
		||||
 
 | 
			
		||||
@@ -116,7 +116,7 @@ value = 'Создание метаданных пакета'
 | 
			
		||||
 | 
			
		||||
[[translation]]
 | 
			
		||||
id = 3121791194
 | 
			
		||||
value = 'Запуск LURE от имени root запрещен, так как это может привести к катастрофическому повреждению вашей системы'
 | 
			
		||||
value = 'Запуск ALR от имени root запрещен, так как это может привести к катастрофическому повреждению вашей системы'
 | 
			
		||||
 | 
			
		||||
[[translation]]
 | 
			
		||||
id = 1256604213
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -24,7 +24,7 @@ import (
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"go.elara.ws/logger"
 | 
			
		||||
	"lure.sh/lure/pkg/loggerctx"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/loggerctx"
 | 
			
		||||
	"go.elara.ws/translate"
 | 
			
		||||
	"golang.org/x/text/language"
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
 | 
			
		||||
package types
 | 
			
		||||
 | 
			
		||||
import "lure.sh/lure/pkg/manager"
 | 
			
		||||
import "plemya-x.ru/alr/pkg/manager"
 | 
			
		||||
 | 
			
		||||
type BuildOpts struct {
 | 
			
		||||
	Script      string
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
 | 
			
		||||
package types
 | 
			
		||||
 | 
			
		||||
// Config represents the LURE configuration file
 | 
			
		||||
// Config represents the ALR configuration file
 | 
			
		||||
type Config struct {
 | 
			
		||||
	RootCmd          string   `toml:"rootCmd"`
 | 
			
		||||
	PagerStyle       string   `toml:"pagerStyle"`
 | 
			
		||||
@@ -27,7 +27,7 @@ type Config struct {
 | 
			
		||||
	Unsafe           Unsafe   `toml:"unsafe"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Repo represents a LURE repo within a configuration file
 | 
			
		||||
// Repo represents a ALR repo within a configuration file
 | 
			
		||||
type Repo struct {
 | 
			
		||||
	Name string `toml:"name"`
 | 
			
		||||
	URL  string `toml:"url"`
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
 | 
			
		||||
package types
 | 
			
		||||
 | 
			
		||||
// RepoConfig represents a LURE repo's lure-repo.toml file.
 | 
			
		||||
// RepoConfig represents a ALR repo's alr-repo.toml file.
 | 
			
		||||
type RepoConfig struct {
 | 
			
		||||
	Repo struct {
 | 
			
		||||
		MinVersion string `toml:"minVersion"`
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user