Move db and config back to internal
This commit is contained in:
parent
4774ec3343
commit
ac45087ead
2
build.go
2
build.go
|
@ -27,7 +27,7 @@ import (
|
|||
"go.elara.ws/lure/internal/osutils"
|
||||
"go.elara.ws/lure/internal/types"
|
||||
"go.elara.ws/lure/pkg/build"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/pkg/manager"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
)
|
||||
|
|
|
@ -30,7 +30,6 @@ import (
|
|||
"go.elara.ws/logger"
|
||||
"go.elara.ws/lure/cmd/lure-api-server/internal/api"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
)
|
||||
|
||||
|
@ -55,7 +54,7 @@ func main() {
|
|||
log.Logger = logger.NewMulti(log.Logger, logger.NewJSON(fl))
|
||||
}
|
||||
|
||||
err := repos.Pull(ctx, config.Config().Repos)
|
||||
err := repos.Pull(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatal("Error pulling repositories").Err(err).Send()
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
)
|
||||
|
||||
|
@ -88,7 +87,7 @@ func repoPullWorker(ctx context.Context, sigCh <-chan struct{}) {
|
|||
for {
|
||||
select {
|
||||
case <-sigCh:
|
||||
err := repos.Pull(ctx, config.Config().Repos)
|
||||
err := repos.Pull(ctx, nil)
|
||||
if err != nil {
|
||||
log.Warn("Error while pulling repositories").Err(err).Send()
|
||||
}
|
||||
|
|
4
fix.go
4
fix.go
|
@ -23,8 +23,8 @@ import (
|
|||
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
)
|
||||
|
||||
|
|
2
info.go
2
info.go
|
@ -27,7 +27,7 @@ import (
|
|||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/lure/internal/cliutils"
|
||||
"go.elara.ws/lure/internal/overrides"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/pkg/distro"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
|
|
@ -26,8 +26,8 @@ import (
|
|||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/types"
|
||||
"go.elara.ws/lure/pkg/build"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/pkg/manager"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
)
|
||||
|
|
|
@ -26,8 +26,8 @@ import (
|
|||
"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"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
)
|
||||
|
||||
// YesNoPrompt asks the user a yes or no question, using def as the default answer
|
||||
|
|
|
@ -27,7 +27,7 @@ import (
|
|||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"golang.org/x/exp/slices"
|
||||
"modernc.org/sqlite"
|
||||
)
|
|
@ -24,7 +24,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
)
|
||||
|
||||
var testPkg = db.Package{
|
|
@ -25,7 +25,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
)
|
||||
|
||||
// BasePath returns the base path of the download cache
|
||||
|
|
|
@ -27,7 +27,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"go.elara.ws/lure/internal/dlcache"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"go.elara.ws/lure/internal/cpu"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/pkg/distro"
|
||||
"golang.org/x/exp/slices"
|
||||
"golang.org/x/text/language"
|
||||
|
|
4
list.go
4
list.go
|
@ -23,8 +23,8 @@ import (
|
|||
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/pkg/manager"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
"golang.org/x/exp/slices"
|
||||
|
|
4
main.go
4
main.go
|
@ -30,8 +30,8 @@ import (
|
|||
"go.elara.ws/logger"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/translations"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/pkg/manager"
|
||||
)
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ import (
|
|||
"go.elara.ws/lure/internal/shutils/decoder"
|
||||
"go.elara.ws/lure/internal/shutils/helpers"
|
||||
"go.elara.ws/lure/internal/types"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/pkg/distro"
|
||||
"go.elara.ws/lure/pkg/manager"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
|
|
|
@ -24,8 +24,8 @@ import (
|
|||
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/types"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
)
|
||||
|
||||
// InstallPkgs installs native packages via the package manager,
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package repos
|
||||
|
||||
import "go.elara.ws/lure/pkg/db"
|
||||
import "go.elara.ws/lure/internal/db"
|
||||
|
||||
// FindPkgs looks for packages matching the inputs inside the database.
|
||||
// It returns a map that maps the package name input to any packages found for it.
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"go.elara.ws/lure/internal/types"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
)
|
||||
|
||||
|
|
|
@ -34,12 +34,12 @@ 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/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"
|
||||
|
@ -50,7 +50,12 @@ 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 if possible.
|
||||
// If repos is set to nil, the repos in the LURE config will be used.
|
||||
func Pull(ctx context.Context, repos []types.Repo) error {
|
||||
if repos == nil {
|
||||
repos = config.Config().Repos
|
||||
}
|
||||
|
||||
for _, repo := range repos {
|
||||
repoURL, err := url.Parse(repo.URL)
|
||||
if err != nil {
|
||||
|
|
|
@ -25,8 +25,8 @@ import (
|
|||
"testing"
|
||||
|
||||
"go.elara.ws/lure/internal/types"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
)
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
)
|
||||
|
||||
// Filter represents search filters.
|
||||
|
|
4
repo.go
4
repo.go
|
@ -26,8 +26,8 @@ import (
|
|||
"github.com/urfave/cli/v2"
|
||||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/types"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
|
|
@ -26,8 +26,8 @@ import (
|
|||
"go.elara.ws/lure/internal/log"
|
||||
"go.elara.ws/lure/internal/types"
|
||||
"go.elara.ws/lure/pkg/build"
|
||||
"go.elara.ws/lure/pkg/config"
|
||||
"go.elara.ws/lure/pkg/db"
|
||||
"go.elara.ws/lure/internal/config"
|
||||
"go.elara.ws/lure/internal/db"
|
||||
"go.elara.ws/lure/pkg/distro"
|
||||
"go.elara.ws/lure/pkg/manager"
|
||||
"go.elara.ws/lure/pkg/repos"
|
||||
|
|
Loading…
Reference in New Issue