ебать крупнейшее обновление 1.0
This commit is contained in:
1 parent
22359129af
commit
d6ebd95cbd
6 files changed
+1775
-317
No files matched your search
+4
-1
@@ -1,5 +1,8 @@
|
|||||||
package paths
|
package paths
|
||||||
|
|
||||||
const ReposUrlsFile = "etc/qulay/repositories"
|
const ReposConfigDir = "etc/qulay/repos/"
|
||||||
const ReposDir = "var/lib/qulay/repos/"
|
const ReposDir = "var/lib/qulay/repos/"
|
||||||
const InstalledFile = "var/lib/qulay/installed"
|
const InstalledFile = "var/lib/qulay/installed"
|
||||||
|
const BuiltDir = "var/lib/qulay/built/"
|
||||||
|
const FilesDir = "var/lib/qulay/files/"
|
||||||
|
const BuildConfigFile = "etc/qulay/build"
|
||||||
+110
-53
@@ -1,70 +1,112 @@
|
|||||||
package database
|
package database
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
// "archive/tar"
|
|
||||||
"bufio"
|
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"slices"
|
||||||
"time"
|
|
||||||
// "net/url"
|
|
||||||
"io"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"qulay/config"
|
"qulay/config"
|
||||||
"codeberg.org/UzbekLinux/uzbekdb-go"
|
"qulay/helpers"
|
||||||
|
|
||||||
|
"codeberg.org/UzbekLinux/uzbekdb-go"
|
||||||
"github.com/codeclysm/extract/v3"
|
"github.com/codeclysm/extract/v3"
|
||||||
// "github.com/klauspost/compress/zstd"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _name string = filepath.Base(os.Args[0])
|
var _name string = filepath.Base(os.Args[0])
|
||||||
|
|
||||||
func GetReposUrls(destDir string) []string {
|
type Repo struct {
|
||||||
f, err := os.Open(filepath.Join(destDir, paths.ReposUrlsFile))
|
Name string
|
||||||
if err != nil {
|
URL string
|
||||||
return []string{}
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
var urls []string
|
|
||||||
scanner := bufio.NewScanner(f)
|
|
||||||
for scanner.Scan() {
|
|
||||||
urls = append(urls, scanner.Text())
|
|
||||||
}
|
|
||||||
return urls
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func DownloadRepos(urls []string, destDir string) {
|
func GetRepos(destDir string) []Repo {
|
||||||
var wg sync.WaitGroup
|
dir := filepath.Join(destDir, paths.ReposConfigDir)
|
||||||
var links []string
|
|
||||||
|
|
||||||
for _, link := range urls {
|
entries, err := os.ReadDir(dir)
|
||||||
link = strings.TrimSpace(link)
|
if err != nil {
|
||||||
if link == "" {
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var repos []Repo
|
||||||
|
|
||||||
|
for _, entry := range entries {
|
||||||
|
if entry.IsDir() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
links = append(links, link)
|
|
||||||
|
data, err := os.ReadFile(
|
||||||
|
filepath.Join(dir, entry.Name()),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
wg.Add(len(links))
|
|
||||||
for _, link := range links {
|
m := uzbekdb.Loads(string(data), "map")
|
||||||
go func(link string) {
|
if m == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
mp, ok := m.(map[interface{}][]interface{})
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
repo := Repo{Name: entry.Name()}
|
||||||
|
|
||||||
|
if vals, ok := mp["url"]; ok && len(vals) > 0 {
|
||||||
|
repo.URL = fmt.Sprintf("%v", vals[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
repos = append(repos, repo)
|
||||||
|
}
|
||||||
|
|
||||||
|
slices.SortFunc(repos, func(a, b Repo) int {
|
||||||
|
return strings.Compare(a.Name, b.Name)
|
||||||
|
})
|
||||||
|
|
||||||
|
return repos
|
||||||
|
}
|
||||||
|
|
||||||
|
func RepoURL(destDir, name string) string {
|
||||||
|
for _, repo := range GetRepos(destDir) {
|
||||||
|
if repo.Name == name {
|
||||||
|
return repo.URL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func DownloadRepos(destDir string) {
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
|
for _, repo := range GetRepos(destDir) {
|
||||||
|
wg.Add(1)
|
||||||
|
|
||||||
|
go func(base, name string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
archiveName := path.Base(link)
|
|
||||||
repoName := strings.TrimSuffix(archiveName, ".tar.zst")
|
|
||||||
destArchivePath := filepath.Join(destDir, "tmp", archiveName)
|
|
||||||
destNArchivePath := filepath.Join(destDir, "tmp")
|
|
||||||
destPath := filepath.Join(destDir, paths.ReposDir)
|
|
||||||
fullDestPath := filepath.Join(destDir, paths.ReposDir, repoName)
|
|
||||||
|
|
||||||
os.MkdirAll(destNArchivePath, 0755)
|
link := base
|
||||||
|
if !strings.HasSuffix(link, "/") {
|
||||||
client := &http.Client{
|
link += "/"
|
||||||
Timeout: 10 * time.Second,
|
|
||||||
}
|
}
|
||||||
|
link += name + ".tar.zst"
|
||||||
|
|
||||||
|
archiveName := path.Base(link)
|
||||||
|
destArchivePath := filepath.Join(destDir, "tmp", archiveName)
|
||||||
|
destPath := filepath.Join(destDir, paths.ReposDir)
|
||||||
|
fullDestPath := filepath.Join(destPath, name)
|
||||||
|
|
||||||
|
os.MkdirAll(filepath.Dir(destArchivePath), 0755)
|
||||||
|
defer os.Remove(destArchivePath)
|
||||||
|
|
||||||
|
client := helpers.HTTPClient()
|
||||||
|
|
||||||
resp, err := client.Get(link)
|
resp, err := client.Get(link)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -72,6 +114,10 @@ func DownloadRepos(urls []string, destDir string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
if resp.StatusCode != http.StatusOK {
|
||||||
|
fmt.Println("!! http error", resp.StatusCode, link)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
f, err := os.Create(destArchivePath)
|
f, err := os.Create(destArchivePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -88,8 +134,8 @@ func DownloadRepos(urls []string, destDir string) {
|
|||||||
|
|
||||||
fmt.Println(":: downloaded", archiveName, "to", destArchivePath)
|
fmt.Println(":: downloaded", archiveName, "to", destArchivePath)
|
||||||
|
|
||||||
err = os.RemoveAll(fullDestPath)
|
|
||||||
fmt.Println(":: removing old repo", fullDestPath)
|
fmt.Println(":: removing old repo", fullDestPath)
|
||||||
|
err = os.RemoveAll(fullDestPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("w! failed to delete old repo", fullDestPath, err)
|
fmt.Println("w! failed to delete old repo", fullDestPath, err)
|
||||||
}
|
}
|
||||||
@@ -99,13 +145,16 @@ func DownloadRepos(urls []string, destDir string) {
|
|||||||
fmt.Println("!! failed to open archive file", destArchivePath, err)
|
fmt.Println("!! failed to open archive file", destArchivePath, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = extract.Zstd(context.TODO(), file, destPath, nil)
|
defer file.Close()
|
||||||
|
|
||||||
|
err = extract.Zstd(context.TODO(), file, fullDestPath, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("!! failed to extract", err)
|
fmt.Println("!! failed to extract", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}(link)
|
}(repo.URL, repo.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
fmt.Println(":: repo updating ended")
|
fmt.Println(":: repo updating ended")
|
||||||
}
|
}
|
||||||
@@ -150,12 +199,21 @@ func IsInstalled(name string, destDir string) bool {
|
|||||||
|
|
||||||
func GetPackageVersion(name string, destDir string) string {
|
func GetPackageVersion(name string, destDir string) string {
|
||||||
data := ReadInstalled(destDir)
|
data := ReadInstalled(destDir)
|
||||||
|
if !strings.Contains(name, "/") {
|
||||||
|
for k := range data {
|
||||||
|
if kStr, ok := k.(string); ok {
|
||||||
|
if strings.HasSuffix(kStr, "/"+name) {
|
||||||
|
name = kStr
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
alo, _ := data[name]
|
alo, _ := data[name]
|
||||||
if len(alo) > 0 {
|
if len(alo) > 0 {
|
||||||
return alo[0].(string)
|
return fmt.Sprintf("%v", alo[0])
|
||||||
} else {
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegPackage(name string, version string, destDir string) error {
|
func RegPackage(name string, version string, destDir string) error {
|
||||||
@@ -177,7 +235,7 @@ func UnRegPackage(name string, destDir string) error {
|
|||||||
data := ReadInstalled(destDir)
|
data := ReadInstalled(destDir)
|
||||||
_, ok := data[name]
|
_, ok := data[name]
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("cant unregister '%s': package is not installed", name)
|
return nil
|
||||||
}
|
}
|
||||||
delete(data, name)
|
delete(data, name)
|
||||||
return WriteInstalled(data, destDir)
|
return WriteInstalled(data, destDir)
|
||||||
@@ -185,13 +243,12 @@ func UnRegPackage(name string, destDir string) error {
|
|||||||
|
|
||||||
func PurgeRepository(name string, destDir string) error {
|
func PurgeRepository(name string, destDir string) error {
|
||||||
dirPath := filepath.Join(destDir, paths.ReposDir, name)
|
dirPath := filepath.Join(destDir, paths.ReposDir, name)
|
||||||
|
if _, err := os.Stat(dirPath); err != nil {
|
||||||
|
return fmt.Errorf("repository '%s' not found", name)
|
||||||
|
}
|
||||||
err := os.RemoveAll(dirPath)
|
err := os.RemoveAll(dirPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// func Ensure(args, destDir) error {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
@@ -5,13 +5,13 @@ go 1.26.4
|
|||||||
require (
|
require (
|
||||||
codeberg.org/UzbekLinux/uzbekdb-go v0.0.0-20260509165828-8f8f4cbf599e
|
codeberg.org/UzbekLinux/uzbekdb-go v0.0.0-20260509165828-8f8f4cbf599e
|
||||||
github.com/codeclysm/extract/v3 v3.1.1
|
github.com/codeclysm/extract/v3 v3.1.1
|
||||||
|
github.com/klauspost/compress v1.15.13
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/h2non/filetype v1.1.3 // indirect
|
github.com/h2non/filetype v1.1.3 // indirect
|
||||||
github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5 // indirect
|
github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5 // indirect
|
||||||
github.com/juju/loggo v1.0.0 // indirect
|
github.com/juju/loggo v1.0.0 // indirect
|
||||||
github.com/klauspost/compress v1.15.13 // indirect
|
|
||||||
github.com/kr/text v0.2.0 // indirect
|
github.com/kr/text v0.2.0 // indirect
|
||||||
github.com/ulikunitz/xz v0.5.11 // indirect
|
github.com/ulikunitz/xz v0.5.11 // indirect
|
||||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
|
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package helpers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@@ -25,6 +27,18 @@ func Ask(str string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func HTTPClient() *http.Client {
|
||||||
|
transport := &http.Transport{
|
||||||
|
DialContext: (&net.Dialer{
|
||||||
|
Timeout: 10 * time.Second,
|
||||||
|
}).DialContext,
|
||||||
|
TLSHandshakeTimeout: 10 * time.Second,
|
||||||
|
}
|
||||||
|
return &http.Client{
|
||||||
|
Transport: transport,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func ToString(v interface{}) string {
|
func ToString(v interface{}) string {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case int:
|
case int:
|
||||||
@@ -67,6 +81,9 @@ func CopyDir(src, dst string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := os.RemoveAll(target); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return os.Symlink(link, target)
|
return os.Symlink(link, target)
|
||||||
|
|
||||||
case info.IsDir():
|
case info.IsDir():
|
||||||
|
|||||||
@@ -13,29 +13,41 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var _name string = filepath.Base(os.Args[0])
|
var _name string = filepath.Base(os.Args[0])
|
||||||
var _cmds = []string{"h", "+", "-", "g", "s", "p", "u", "r", "q", "f", "v"}
|
var _cmds = []string{"h", "+", "-", "g", "s", "p", "u", "r", "q", "f", "v", "b", "o"}
|
||||||
var _root_cmds = []string{"+", "-", "u", "i"}
|
|
||||||
|
|
||||||
const _version string = "0.7"
|
const _version string = "1.0"
|
||||||
const _help string = `{_name}: command-line interface to the Qulay Package Manager
|
const _help string = `{_name}: Qulay Package Manager
|
||||||
Usage:
|
Usage:
|
||||||
{_name} h -> help menu
|
{_name} h -> help menu
|
||||||
{_name} + pkg -> download and install package
|
{_name} + pkg -> download and install package (or .qpmp file path)
|
||||||
{_name} - pkg -> remove package
|
{_name} - pkg -> remove package
|
||||||
|
{_name} b pkg -> build package into .tar.zst (or .qpmp on :qpmp)
|
||||||
{_name} g pkg -> get package version
|
{_name} g pkg -> get package version
|
||||||
{_name} s pkg -> search packages by name
|
{_name} s pkg -> search packages by name
|
||||||
{_name} p repo -> purge local repo directory
|
{_name} p repo -> purge local repo directory
|
||||||
{_name} u -> update all repositories
|
{_name} u -> update all repositories
|
||||||
{_name} r -> get all repositories URLs
|
{_name} r -> get all repositories configs
|
||||||
|
{_name} o -> upgrade all installed packages
|
||||||
{_name} q -> get all installed packages
|
{_name} q -> get all installed packages
|
||||||
{_name} f -> get files path for destDir
|
{_name} f -> get files path for destDir
|
||||||
{_name} v -> get {_name} version
|
{_name} v -> get {_name} version
|
||||||
Options:
|
Options:
|
||||||
:v -> verbose output
|
|
||||||
:a -> ask before doing
|
:a -> ask before doing
|
||||||
:nl -> disable recording in databases and logs
|
:nl -> disable recording in databases and logs
|
||||||
:nd -> do not download deps
|
:nd -> do not download deps
|
||||||
:r -> reinstall already installed deps
|
:r -> reinstall already installed deps
|
||||||
|
:f -> force install (ignore conflicts)
|
||||||
|
:qpmp -> build a .qpmp archive instead of .tar.zst
|
||||||
|
Tags (for +, - , b and o):
|
||||||
|
@all -> apply to all packages
|
||||||
|
repo/@all -> apply to all packages in repo
|
||||||
|
@inst -> apply to installed (for b: built) packages
|
||||||
|
repo/@inst -> apply to installed (for b: built) packages in repo
|
||||||
|
@notinst -> apply to not installed (for b: not built) packages
|
||||||
|
repo/@notinst-> apply to not installed (for b: not built) packages in repo
|
||||||
|
@old -> apply to installed/built packages outdated by version
|
||||||
|
repo/@old -> apply to outdated packages in repo
|
||||||
|
o without tags applies @old automatically
|
||||||
Vars:
|
Vars:
|
||||||
DESTDIR -> path where the package will be installed/removed`
|
DESTDIR -> path where the package will be installed/removed`
|
||||||
|
|
||||||
@@ -86,7 +98,12 @@ func main() {
|
|||||||
fmt.Println("!! no package(s) received")
|
fmt.Println("!! no package(s) received")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
for _, n := range oths {
|
names, err := pkg.Expand("+", oths, absDestDir)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("!!", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
for _, n := range names {
|
||||||
err := pkg.Install(n, opts, absDestDir)
|
err := pkg.Install(n, opts, absDestDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("!!", err)
|
fmt.Println("!!", err)
|
||||||
@@ -98,7 +115,12 @@ func main() {
|
|||||||
fmt.Println("!! no package(s) received")
|
fmt.Println("!! no package(s) received")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
for _, n := range oths {
|
names, err := pkg.Expand("-", oths, absDestDir)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("!!", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
for _, n := range names {
|
||||||
err := pkg.Remove(n, opts, absDestDir)
|
err := pkg.Remove(n, opts, absDestDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("!!", err)
|
fmt.Println("!!", err)
|
||||||
@@ -106,7 +128,24 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if cmds[0] == "u" {
|
} else if cmds[0] == "u" {
|
||||||
database.DownloadRepos(database.GetReposUrls(absDestDir), absDestDir)
|
database.DownloadRepos(absDestDir)
|
||||||
|
} else if cmds[0] == "b" {
|
||||||
|
if len(oths) < 1 {
|
||||||
|
fmt.Println("!! no package(s) received")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
names, err := pkg.Expand("b", oths, absDestDir)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("!!", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
for _, n := range names {
|
||||||
|
err := pkg.Build(n, opts, absDestDir)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("!!", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if cmds[0] == "g" {
|
} else if cmds[0] == "g" {
|
||||||
if len(oths) < 1 {
|
if len(oths) < 1 {
|
||||||
fmt.Println("!! no package(s) received")
|
fmt.Println("!! no package(s) received")
|
||||||
@@ -116,21 +155,37 @@ func main() {
|
|||||||
fmt.Println(database.GetPackageVersion(name, absDestDir))
|
fmt.Println(database.GetPackageVersion(name, absDestDir))
|
||||||
}
|
}
|
||||||
} else if cmds[0] == "r" {
|
} else if cmds[0] == "r" {
|
||||||
for _, url := range database.GetReposUrls(absDestDir) {
|
for _, repo := range database.GetRepos(absDestDir) {
|
||||||
fmt.Println(url)
|
fmt.Println(repo.Name, "url:", repo.URL)
|
||||||
|
}
|
||||||
|
} else if cmds[0] == "o" {
|
||||||
|
if len(oths) < 1 {
|
||||||
|
oths = []string{"@old"}
|
||||||
|
}
|
||||||
|
names, err := pkg.Expand("o", oths, absDestDir)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("!!", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
err = pkg.Upgrade(names, opts, absDestDir)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("!!", err)
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
} else if cmds[0] == "q" {
|
} else if cmds[0] == "q" {
|
||||||
for name, version := range database.ReadInstalled(absDestDir) {
|
for name, version := range database.ReadInstalled(absDestDir) {
|
||||||
|
if len(version) > 0 {
|
||||||
fmt.Println(name, "-", version[0])
|
fmt.Println(name, "-", version[0])
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if cmds[0] == "s" {
|
} else if cmds[0] == "s" {
|
||||||
if len(oths) < 1 {
|
if len(oths) < 1 {
|
||||||
pkgs := pkg.GetPackages(absDestDir)
|
pkgs := pkg.GetPackages(absDestDir)
|
||||||
for _, p := range pkgs {
|
for _, p := range pkgs {
|
||||||
if database.IsInstalled(p.Repo+"/"+p.Name, absDestDir) {
|
if database.IsInstalled(p.Repo+"/"+p.Name, absDestDir) {
|
||||||
fmt.Printf("[+] %s/%s - %v - %v\n", p.Repo, p.Name, p.Data[0], p.Data[1])
|
fmt.Printf("[+] %s/%s - %v - %v\n", p.Repo, p.Name, p.Version, p.Desc)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf(" %s/%s - %v - %v\n", p.Repo, p.Name, p.Data[0], p.Data[1])
|
fmt.Printf(" %s/%s - %v - %v\n", p.Repo, p.Name, p.Version, p.Desc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -138,9 +193,9 @@ func main() {
|
|||||||
pkgs := pkg.FindPackages(n, absDestDir)
|
pkgs := pkg.FindPackages(n, absDestDir)
|
||||||
for _, p := range pkgs {
|
for _, p := range pkgs {
|
||||||
if database.IsInstalled(p.Repo+"/"+p.Name, absDestDir) {
|
if database.IsInstalled(p.Repo+"/"+p.Name, absDestDir) {
|
||||||
fmt.Printf("[+] %s/%s - %v - %v\n", p.Repo, p.Name, p.Data[0], p.Data[1])
|
fmt.Printf("[+] %s/%s - %v - %v\n", p.Repo, p.Name, p.Version, p.Desc)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf(" %s/%s - %v - %v\n", p.Repo, p.Name, p.Data[0], p.Data[1])
|
fmt.Printf(" %s/%s - %v - %v\n", p.Repo, p.Name, p.Version, p.Desc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,9 +221,11 @@ func main() {
|
|||||||
fmt.Printf("dest dir: %v\n", destDir)
|
fmt.Printf("dest dir: %v\n", destDir)
|
||||||
fmt.Printf("abs dest dir: %v\n", absDestDir)
|
fmt.Printf("abs dest dir: %v\n", absDestDir)
|
||||||
fmt.Printf("is abs: %v\n", filepath.IsAbs(destDir))
|
fmt.Printf("is abs: %v\n", filepath.IsAbs(destDir))
|
||||||
fmt.Printf("repos urls file: %v\n", filepath.Join(absDestDir, paths.ReposUrlsFile))
|
fmt.Printf("repos config dir: %v\n", filepath.Join(absDestDir, paths.ReposConfigDir))
|
||||||
fmt.Printf("repos dir: %v\n", filepath.Join(absDestDir, paths.ReposDir))
|
fmt.Printf("repos dir: %v\n", filepath.Join(absDestDir, paths.ReposDir))
|
||||||
fmt.Printf("installed pkgs database: %v\n", filepath.Join(absDestDir, paths.InstalledFile))
|
fmt.Printf("installed pkgs database: %v\n", filepath.Join(absDestDir, paths.InstalledFile))
|
||||||
|
fmt.Printf("built pkgs dir: %v\n", filepath.Join(absDestDir, paths.BuiltDir))
|
||||||
|
fmt.Printf("build config file: %v\n", filepath.Join(absDestDir, paths.BuildConfigFile))
|
||||||
} else if cmds[0] == "v" {
|
} else if cmds[0] == "v" {
|
||||||
fmt.Println(_version)
|
fmt.Println(_version)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1569
-245
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user