mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
Merge pull request #183 from Morganamilo/fix#88
Save the VSC info when install finishes.
This commit is contained in:
commit
9c4b4d73f9
4 changed files with 17 additions and 25 deletions
11
cmd.go
11
cmd.go
|
@ -127,8 +127,6 @@ func initYay() (err error) {
|
|||
/////////////////
|
||||
// vcs config //
|
||||
////////////////
|
||||
updated = false
|
||||
|
||||
vfile, err := os.OpenFile(vcsFile, os.O_RDONLY|os.O_CREATE, 0644)
|
||||
if err == nil {
|
||||
defer vfile.Close()
|
||||
|
@ -237,15 +235,6 @@ cleanup:
|
|||
//if we fail to save the configuration
|
||||
//at least continue on and try clean up other parts
|
||||
|
||||
if updated {
|
||||
err = saveVCSInfo()
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
status = 1
|
||||
}
|
||||
}
|
||||
|
||||
if changedConfig {
|
||||
err = config.saveConfig()
|
||||
|
||||
|
|
|
@ -57,9 +57,6 @@ var vcsFile string
|
|||
//completion file
|
||||
var completionFile string
|
||||
|
||||
// Updated returns if database has been updated
|
||||
var updated bool
|
||||
|
||||
// changedConfig holds whether or not the config has changed
|
||||
var changedConfig bool
|
||||
|
||||
|
|
20
install.go
20
install.go
|
@ -314,13 +314,15 @@ func askEditPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func updateVSCdb(pkgbuild *gopkg.PKGBUILD) {
|
||||
func updateVSCdb(pkgs []*rpc.Pkg, pkgbuild *gopkg.PKGBUILD) {
|
||||
for _, pkgsource := range pkgbuild.Source {
|
||||
owner, repo := parseSource(pkgsource)
|
||||
if owner != "" && repo != "" {
|
||||
err := branchInfo(pkgbuild.Pkgbase, owner, repo)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
for _, pkg := range pkgs {
|
||||
err := branchInfo(pkg.Name, owner, repo)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -339,7 +341,7 @@ func parsesrcinfosFile(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, bas
|
|||
}
|
||||
|
||||
srcinfos[pkg.PackageBase] = pkgbuild
|
||||
updateVSCdb(pkgbuild)
|
||||
updateVSCdb(bases[pkg.PackageBase], pkgbuild)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -367,7 +369,6 @@ func parsesrcinfosGenerate(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
|
|||
}
|
||||
|
||||
srcinfos[pkg.PackageBase] = pkgbuild
|
||||
updateVSCdb(pkgbuild)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -402,10 +403,7 @@ func downloadPkgBuildsSources(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) (err
|
|||
}
|
||||
|
||||
func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, targets stringSet, parser *arguments, bases map[string][]*rpc.Pkg) error {
|
||||
//for n := len(pkgs) -1 ; n > 0; n-- {
|
||||
for n := 0; n < len(pkgs); n++ {
|
||||
pkg := pkgs[n]
|
||||
|
||||
for _, pkg := range pkgs {
|
||||
dir := config.BuildDir + pkg.PackageBase + "/"
|
||||
built := true
|
||||
|
||||
|
@ -469,6 +467,8 @@ func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
updateVSCdb(bases[pkg.PackageBase], srcinfo)
|
||||
if len(depArguments.targets) > 0 {
|
||||
err = passToPacman(depArguments)
|
||||
if err != nil {
|
||||
|
|
8
vcs.go
8
vcs.go
|
@ -129,7 +129,7 @@ func inStore(pkgName string) *Info {
|
|||
|
||||
// branchInfo updates saved information
|
||||
func branchInfo(pkgName string, owner string, repoName string) (err error) {
|
||||
updated = true
|
||||
updated := false
|
||||
var newRepo repo
|
||||
var newBranches branches
|
||||
url := "https://api.github.com/repos/" + owner + "/" + repoName
|
||||
|
@ -155,6 +155,8 @@ func branchInfo(pkgName string, owner string, repoName string) (err error) {
|
|||
|
||||
for _, e := range newBranches {
|
||||
if e.Name == defaultBranch {
|
||||
updated = true
|
||||
|
||||
if packinfo != nil {
|
||||
packinfo.Package = pkgName
|
||||
packinfo.URL = url
|
||||
|
@ -165,6 +167,10 @@ func branchInfo(pkgName string, owner string, repoName string) (err error) {
|
|||
}
|
||||
}
|
||||
|
||||
if updated {
|
||||
saveVCSInfo()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue