Move some things out of internal
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Elara 2023-09-21 16:18:18 -07:00
parent 76ba7fcc68
commit be7709a5ed
46 changed files with 168 additions and 156 deletions

View File

@ -1,7 +1,8 @@
PREFIX ?= /usr/local
GIT_VERSION = $(shell git describe --tags )
lure: internal/config/version.txt
CGO_ENABLED=0 go build
lure:
CGO_ENABLED=0 go build -ldflags="-X 'go.elara.ws/lure/pkg/config.Version=$(GIT_VERSION)'"
clean:
rm -f lure
@ -15,8 +16,5 @@ installmisc:
uninstall:
rm -f /usr/local/bin/lure
internal/config/version.txt:
go generate ./internal/config
.PHONY: install clean uninstall installmisc
.PHONY: install clean uninstall installmisc lure

View File

@ -23,13 +23,13 @@ import (
"path/filepath"
"github.com/urfave/cli/v2"
"go.elara.ws/lure/internal/build"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/osutils"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/internal/types"
"go.elara.ws/lure/manager"
"go.elara.ws/lure/pkg/build"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/manager"
"go.elara.ws/lure/pkg/repos"
)
var buildCmd = &cli.Command{

View File

@ -27,9 +27,9 @@ import (
"github.com/twitchtv/twirp"
"go.elara.ws/lure/internal/api"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
"golang.org/x/text/language"
)

View File

@ -8,7 +8,7 @@ import (
"strings"
"github.com/go-chi/chi/v5"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/pkg/db"
)
//go:embed badge-logo.txt

View File

@ -29,9 +29,9 @@ import (
"github.com/twitchtv/twirp"
"go.elara.ws/logger"
"go.elara.ws/lure/internal/api"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/repos"
)
func init() {

View File

@ -29,9 +29,9 @@ import (
"os"
"strings"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/repos"
)
func handleWebhook(sigCh chan<- struct{}) http.HandlerFunc {

6
fix.go
View File

@ -22,10 +22,10 @@ import (
"os"
"github.com/urfave/cli/v2"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
"go.elara.ws/lure/pkg/repos"
)
var fixCmd = &cli.Command{

View File

@ -25,11 +25,11 @@ import (
"go.elara.ws/lure/internal/log"
"github.com/urfave/cli/v2"
"go.elara.ws/lure/distro"
"go.elara.ws/lure/internal/cliutils"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/overrides"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/distro"
"go.elara.ws/lure/pkg/repos"
"gopkg.in/yaml.v3"
)

View File

@ -22,14 +22,14 @@ import (
"fmt"
"github.com/urfave/cli/v2"
"go.elara.ws/lure/internal/build"
"go.elara.ws/lure/internal/cliutils"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/internal/types"
"go.elara.ws/lure/manager"
"go.elara.ws/lure/pkg/build"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
"go.elara.ws/lure/pkg/manager"
"go.elara.ws/lure/pkg/repos"
)
var installCmd = &cli.Command{

View File

@ -7,10 +7,11 @@
package api
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
@ -734,21 +735,23 @@ func file_lure_proto_rawDescGZIP() []byte {
return file_lure_proto_rawDescData
}
var file_lure_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_lure_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_lure_proto_goTypes = []interface{}{
(SORT_BY)(0), // 0: lure.SORT_BY
(FILTER_TYPE)(0), // 1: lure.FILTER_TYPE
(*SearchRequest)(nil), // 2: lure.SearchRequest
(*StringList)(nil), // 3: lure.StringList
(*Package)(nil), // 4: lure.Package
(*GetPackageRequest)(nil), // 5: lure.GetPackageRequest
(*SearchResponse)(nil), // 6: lure.SearchResponse
(*GetBuildScriptRequest)(nil), // 7: lure.GetBuildScriptRequest
(*GetBuildScriptResponse)(nil), // 8: lure.GetBuildScriptResponse
nil, // 9: lure.Package.DependsEntry
nil, // 10: lure.Package.BuildDependsEntry
}
var (
file_lure_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
file_lure_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
file_lure_proto_goTypes = []interface{}{
(SORT_BY)(0), // 0: lure.SORT_BY
(FILTER_TYPE)(0), // 1: lure.FILTER_TYPE
(*SearchRequest)(nil), // 2: lure.SearchRequest
(*StringList)(nil), // 3: lure.StringList
(*Package)(nil), // 4: lure.Package
(*GetPackageRequest)(nil), // 5: lure.GetPackageRequest
(*SearchResponse)(nil), // 6: lure.SearchResponse
(*GetBuildScriptRequest)(nil), // 7: lure.GetBuildScriptRequest
(*GetBuildScriptResponse)(nil), // 8: lure.GetBuildScriptResponse
nil, // 9: lure.Package.DependsEntry
nil, // 10: lure.Package.BuildDependsEntry
}
)
var file_lure_proto_depIdxs = []int32{
0, // 0: lure.SearchRequest.sort_by:type_name -> lure.SORT_BY
1, // 1: lure.SearchRequest.filter_type:type_name -> lure.FILTER_TYPE

View File

@ -3,23 +3,29 @@
package api
import context "context"
import fmt "fmt"
import http "net/http"
import io "io"
import json "encoding/json"
import strconv "strconv"
import strings "strings"
import (
context "context"
fmt "fmt"
http "net/http"
io "io"
json "encoding/json"
strconv "strconv"
strings "strings"
)
import protojson "google.golang.org/protobuf/encoding/protojson"
import proto "google.golang.org/protobuf/proto"
import twirp "github.com/twitchtv/twirp"
import ctxsetters "github.com/twitchtv/twirp/ctxsetters"
import (
protojson "google.golang.org/protobuf/encoding/protojson"
proto "google.golang.org/protobuf/proto"
twirp "github.com/twitchtv/twirp"
ctxsetters "github.com/twitchtv/twirp/ctxsetters"
)
import bytes "bytes"
import errors "errors"
import path "path"
import url "net/url"
import (
bytes "bytes"
errors "errors"
path "path"
url "net/url"
)
// Version compatibility assertion.
// If the constant is not defined in the package, that likely means

View File

@ -23,11 +23,11 @@ import (
"strings"
"github.com/AlecAivazis/survey/v2"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/pager"
"go.elara.ws/lure/internal/translations"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
)
// YesNoPrompt asks the user a yes or no question, using def as the default answer

View File

@ -1,26 +0,0 @@
/*
* LURE - Linux User REpository
* Copyright (C) 2023 Elara Musayelyan
*
* 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 config
import _ "embed"
//go:generate ../../scripts/gen-version.sh
//go:embed version.txt
var Version string

View File

@ -25,7 +25,7 @@ import (
"os"
"path/filepath"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/pkg/config"
)
// BasePath returns the base path of the download cache

View File

@ -26,8 +26,8 @@ import (
"path/filepath"
"testing"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/dlcache"
"go.elara.ws/lure/pkg/config"
)
func init() {

View File

@ -22,9 +22,9 @@ import (
"reflect"
"strings"
"go.elara.ws/lure/distro"
"go.elara.ws/lure/internal/cpu"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/pkg/db"
"go.elara.ws/lure/pkg/distro"
"golang.org/x/exp/slices"
"golang.org/x/text/language"
)

View File

@ -23,8 +23,8 @@ import (
"reflect"
"testing"
"go.elara.ws/lure/distro"
"go.elara.ws/lure/internal/overrides"
"go.elara.ws/lure/pkg/distro"
"golang.org/x/text/language"
)

View File

@ -25,8 +25,8 @@ import (
"strings"
"github.com/mitchellh/mapstructure"
"go.elara.ws/lure/distro"
"go.elara.ws/lure/internal/overrides"
"go.elara.ws/lure/pkg/distro"
"golang.org/x/exp/slices"
"mvdan.cc/sh/v3/expand"
"mvdan.cc/sh/v3/interp"

View File

@ -27,8 +27,8 @@ import (
"strings"
"testing"
"go.elara.ws/lure/distro"
"go.elara.ws/lure/internal/shutils/decoder"
"go.elara.ws/lure/pkg/distro"
"mvdan.cc/sh/v3/interp"
"mvdan.cc/sh/v3/syntax"
)

View File

@ -23,9 +23,9 @@ import (
"strings"
"testing"
"go.elara.ws/lure/distro"
"go.elara.ws/lure/internal/shutils"
"go.elara.ws/lure/internal/shutils/decoder"
"go.elara.ws/lure/pkg/distro"
"mvdan.cc/sh/v3/interp"
"mvdan.cc/sh/v3/syntax"
)

View File

@ -18,7 +18,7 @@
package types
import "go.elara.ws/lure/manager"
import "go.elara.ws/lure/pkg/manager"
type BuildOpts struct {
Script string

View File

@ -22,11 +22,11 @@ import (
"fmt"
"github.com/urfave/cli/v2"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/manager"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
"go.elara.ws/lure/pkg/manager"
"go.elara.ws/lure/pkg/repos"
"golang.org/x/exp/slices"
)

View File

@ -28,11 +28,11 @@ import (
"github.com/mattn/go-isatty"
"github.com/urfave/cli/v2"
"go.elara.ws/logger"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/translations"
"go.elara.ws/lure/manager"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
"go.elara.ws/lure/pkg/manager"
)
var app = &cli.App{

View File

@ -38,19 +38,19 @@ import (
"github.com/goreleaser/nfpm/v2"
"github.com/goreleaser/nfpm/v2/files"
"go.elara.ws/lure/distro"
"go.elara.ws/lure/internal/cliutils"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/cpu"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/dl"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/internal/shutils"
"go.elara.ws/lure/internal/shutils/decoder"
"go.elara.ws/lure/internal/shutils/helpers"
"go.elara.ws/lure/internal/types"
"go.elara.ws/lure/manager"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
"go.elara.ws/lure/pkg/distro"
"go.elara.ws/lure/pkg/manager"
"go.elara.ws/lure/pkg/repos"
"mvdan.cc/sh/v3/expand"
"mvdan.cc/sh/v3/interp"
"mvdan.cc/sh/v3/syntax"

View File

@ -22,14 +22,14 @@ import (
"context"
"path/filepath"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/types"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
)
// InstallPkgs installs non-LURE packages via the package manager, then builds and installs LURE
// packages
// InstallPkgs installs native packages via the package manager,
// then builds and installs the LURE packages
func InstallPkgs(ctx context.Context, lurePkgs []db.Package, nativePkgs []string, opts types.BuildOpts) {
if len(nativePkgs) > 0 {
err := opts.Manager.Install(nil, nativePkgs...)
@ -41,7 +41,7 @@ func InstallPkgs(ctx context.Context, lurePkgs []db.Package, nativePkgs []string
InstallScripts(ctx, GetScriptPaths(lurePkgs), opts)
}
// GetScriptPaths generates a slice of script paths corresponding to the
// GetScriptPaths returns a slice of script paths corresponding to the
// given packages
func GetScriptPaths(pkgs []db.Package) []string {
var scripts []string
@ -52,7 +52,7 @@ func GetScriptPaths(pkgs []db.Package) []string {
return scripts
}
// InstallScripts builds and installs LURE build scripts
// InstallScripts builds and installs the given LURE build scripts
func InstallScripts(ctx context.Context, scripts []string, opts types.BuildOpts) {
for _, script := range scripts {
opts.Script = script

View File

@ -40,6 +40,9 @@ var defaultConfig = &types.Config{
var config *types.Config
// Config returns a LURE 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() *types.Config {
if config == nil {
cfgFl, err := os.Open(GetPaths().ConfigPath)

View File

@ -31,6 +31,10 @@ var (
langSet bool
)
// Language returns the system language.
// The first time it's called, it'll detect the langauge based on
// the $LANG environment variable.
// Subsequent calls will just return the same value.
func Language() language.Tag {
if !langSet {
syslang := SystemLang()
@ -45,6 +49,8 @@ func Language() language.Tag {
return lang
}
// SystemLang returns the system language based on
// the $LANG environment variable.
func SystemLang() string {
lang := os.Getenv("LANG")
lang, _, _ = strings.Cut(lang, ".")

View File

@ -26,6 +26,7 @@ import (
"go.elara.ws/lure/internal/log"
)
// Paths contains various paths used by LURE
type Paths struct {
ConfigDir string
ConfigPath string
@ -37,6 +38,10 @@ type Paths struct {
var paths *Paths
// GetPaths returns a Paths struct.
// The first time it's called, it'll generate the struct
// using information from the system.
// Subsequent calls will return the same value.
func GetPaths() *Paths {
if paths == nil {
paths = &Paths{}

5
pkg/config/version.go Normal file
View File

@ -0,0 +1,5 @@
package config
// Version contains the version of LURE. If the version
// isn't known, it'll be set to "unknown"
var Version = "unknown"

View File

@ -26,16 +26,18 @@ import (
"fmt"
"github.com/jmoiron/sqlx"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/pkg/config"
"golang.org/x/exp/slices"
"modernc.org/sqlite"
)
// CurrentVersion is the current version of the database.
// The database is reset if its version doesn't match this.
const CurrentVersion = 2
func init() {
sqlite.MustRegisterScalarFunction("json_array_contains", 2, JsonArrayContains)
sqlite.MustRegisterScalarFunction("json_array_contains", 2, jsonArrayContains)
}
// Package is a LURE package's database representation
@ -67,11 +69,14 @@ var (
closed = true
)
// DB returns the LURE database.
// The first time it's called, it opens the SQLite database file.
// Subsequent calls return the same connection.
func DB() *sqlx.DB {
if conn != nil && !closed {
return conn
}
db, err := Open(config.GetPaths().DBPath)
db, err := open(config.GetPaths().DBPath)
if err != nil {
log.Fatal("Error opening database").Err(err).Send()
}
@ -79,7 +84,7 @@ func DB() *sqlx.DB {
return conn
}
func Open(dsn string) (*sqlx.DB, error) {
func open(dsn string) (*sqlx.DB, error) {
db, err := sqlx.Open("sqlite", dsn)
if err != nil {
return nil, err
@ -95,6 +100,7 @@ func Open(dsn string) (*sqlx.DB, error) {
return db, nil
}
// Close closes the database
func Close() error {
closed = true
if conn != nil {
@ -104,7 +110,7 @@ func Close() error {
}
}
// Init initializes the database
// initDB initializes the database
func initDB(dsn string) error {
conn = conn.Unsafe()
_, err := conn.Exec(`
@ -139,7 +145,7 @@ func initDB(dsn string) error {
ver, ok := GetVersion()
if ok && ver != CurrentVersion {
log.Warn("Database version mismatch; resetting").Int("version", ver).Int("expected", CurrentVersion).Send()
Reset()
reset()
return initDB(dsn)
} else if !ok {
log.Warn("Database version does not exist. Run lure fix if something isn't working.").Send()
@ -149,7 +155,8 @@ func initDB(dsn string) error {
return nil
}
func Reset() error {
// reset drops all the database tables
func reset() error {
_, err := DB().Exec("DROP TABLE IF EXISTS pkgs;")
if err != nil {
return err
@ -158,6 +165,7 @@ func Reset() error {
return err
}
// IsEmpty returns true if the database has no packages in it, otherwise it returns false.
func IsEmpty() bool {
var count int
err := DB().Get(&count, "SELECT count(1) FROM pkgs;")
@ -167,6 +175,8 @@ func IsEmpty() bool {
return count == 0
}
// GetVersion returns the database version and a boolean indicating
// whether the database contained a version number
func GetVersion() (int, bool) {
var ver version
err := DB().Get(&ver, "SELECT * FROM lure_db_version LIMIT 1;")
@ -232,7 +242,7 @@ func GetPkgs(where string, args ...any) (*sqlx.Rows, error) {
return stream, nil
}
// GetPkg returns a single package that match the where conditions
// GetPkg returns a single package that matches the where conditions
func GetPkg(where string, args ...any) (*Package, error) {
out := &Package{}
err := DB().Get(out, "SELECT * FROM pkgs WHERE "+where+" LIMIT 1", args...)
@ -245,7 +255,9 @@ func DeletePkgs(where string, args ...any) error {
return err
}
func JsonArrayContains(ctx *sqlite.FunctionContext, args []driver.Value) (driver.Value, error) {
// jsonArrayContains is an SQLite function that checks if a JSON array
// in the database contains a given value
func jsonArrayContains(ctx *sqlite.FunctionContext, args []driver.Value) (driver.Value, error) {
value, ok := args[0].(string)
if !ok {
return nil, errors.New("both arguments to json_array_contains must be strings")
@ -265,10 +277,12 @@ func JsonArrayContains(ctx *sqlite.FunctionContext, args []driver.Value) (driver
return slices.Contains(array, item), nil
}
// JSON represents a JSON value in the database
type JSON[T any] struct {
Val T
}
// NewJSON creates a new database JSON value
func NewJSON[T any](v T) JSON[T] {
return JSON[T]{Val: v}
}

View File

@ -24,7 +24,7 @@ import (
"testing"
"github.com/jmoiron/sqlx"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/pkg/db"
)
var testPkg = db.Package{

View File

@ -20,7 +20,6 @@ package distro
import (
"context"
"errors"
"os"
"strings"
@ -30,8 +29,7 @@ import (
"mvdan.cc/sh/v3/syntax"
)
var ErrParse = errors.New("could not parse os-release file")
// OSRelease contains information from an os-release file
type OSRelease struct {
Name string
PrettyName string
@ -50,7 +48,8 @@ var parsed *OSRelease
// OSReleaseName returns a struct parsed from the system's os-release
// file. It checks /etc/os-release as well as /usr/lib/os-release.
// The returned OSRelease struct is a singleton.
// The first time it's called, it'll parse the os-release file.
// Subsequent calls will return the same value.
func ParseOSRelease(ctx context.Context) (*OSRelease, error) {
if parsed != nil {
return parsed, nil
@ -87,7 +86,7 @@ func ParseOSRelease(ctx context.Context) (*OSRelease, error) {
err = runner.Run(ctx, file)
if err != nil {
return nil, ErrParse
return nil, err
}
out := &OSRelease{

View File

@ -18,10 +18,10 @@
package repos
import "go.elara.ws/lure/internal/db"
import "go.elara.ws/lure/pkg/db"
// FindPkgs looks for packages matching the inputs inside the database.
// It returns a map that maps the package name input to the packages found for it.
// It returns a map that maps the package name input to any packages found for it.
// It also returns a slice that contains the names of all packages that were not found.
func FindPkgs(pkgs []string) (map[string][]db.Package, []string, error) {
found := map[string][]db.Package{}

View File

@ -24,9 +24,9 @@ import (
"strings"
"testing"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/internal/types"
"go.elara.ws/lure/pkg/db"
"go.elara.ws/lure/pkg/repos"
)
func TestFindPkgs(t *testing.T) {

View File

@ -34,13 +34,13 @@ import (
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/format/diff"
"github.com/pelletier/go-toml/v2"
"go.elara.ws/lure/distro"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/shutils"
"go.elara.ws/lure/internal/shutils/decoder"
"go.elara.ws/lure/internal/types"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
"go.elara.ws/lure/pkg/distro"
"go.elara.ws/vercmp"
"mvdan.cc/sh/v3/expand"
"mvdan.cc/sh/v3/interp"
@ -49,7 +49,7 @@ import (
// Pull pulls the provided repositories. If a repo doesn't exist, it will be cloned
// and its packages will be written to the DB. If it does exist, it will be pulled.
// In this case, only changed packages will be processed.
// In this case, only changed packages will be processed if possible.
func Pull(ctx context.Context, repos []types.Repo) error {
for _, repo := range repos {
repoURL, err := url.Parse(repo.URL)
@ -149,9 +149,11 @@ func Pull(ctx context.Context, repos []types.Repo) error {
}
fl.Close()
currentVer, _, _ := strings.Cut(config.Version, "-")
if vercmp.Compare(currentVer, repoCfg.Repo.MinVersion) == -1 {
log.Warn("LURE repo's minumum LURE version is greater than the current version. Try updating LURE if something doesn't work.").Str("repo", repo.Name).Send()
if config.Version != "unknown" {
currentVer, _, _ := strings.Cut(config.Version, "-")
if vercmp.Compare(currentVer, repoCfg.Repo.MinVersion) == -1 {
log.Warn("LURE repo's minumum LURE version is greater than the current version. Try updating LURE if something doesn't work.").Str("repo", repo.Name).Send()
}
}
}

View File

@ -24,10 +24,10 @@ import (
"path/filepath"
"testing"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/internal/types"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
"go.elara.ws/lure/pkg/repos"
)
func setCfgDirs(t *testing.T) {

View File

@ -24,11 +24,11 @@ import (
"github.com/pelletier/go-toml/v2"
"github.com/urfave/cli/v2"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/internal/types"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
"go.elara.ws/lure/pkg/repos"
"golang.org/x/exp/slices"
)

View File

@ -1,3 +0,0 @@
#!/bin/bash
git describe --tags > version.txt

View File

@ -23,14 +23,14 @@ import (
"fmt"
"github.com/urfave/cli/v2"
"go.elara.ws/lure/distro"
"go.elara.ws/lure/internal/build"
"go.elara.ws/lure/internal/config"
"go.elara.ws/lure/internal/db"
"go.elara.ws/lure/internal/log"
"go.elara.ws/lure/internal/repos"
"go.elara.ws/lure/internal/types"
"go.elara.ws/lure/manager"
"go.elara.ws/lure/pkg/build"
"go.elara.ws/lure/pkg/config"
"go.elara.ws/lure/pkg/db"
"go.elara.ws/lure/pkg/distro"
"go.elara.ws/lure/pkg/manager"
"go.elara.ws/lure/pkg/repos"
"go.elara.ws/vercmp"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"