mirror of
https://github.com/Jguer/yay
synced 2024-10-31 13:42:27 +00:00
Regenerate .SRCINFO if editing the PKGBUILD
This commit is contained in:
parent
24d8b57172
commit
ad898b2d33
1 changed files with 28 additions and 3 deletions
31
install.go
31
install.go
|
@ -101,8 +101,15 @@ func install(parser *arguments) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
askEditPkgBuilds(dc.AurMake)
|
err = askEditPkgBuilds(dc.AurMake)
|
||||||
askEditPkgBuilds(dc.Aur)
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = askEditPkgBuilds(dc.Aur)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if _, ok := arguments.options["gendb"]; ok {
|
if _, ok := arguments.options["gendb"]; ok {
|
||||||
fmt.Println("GenDB finished. No packages were installed")
|
fmt.Println("GenDB finished. No packages were installed")
|
||||||
return nil
|
return nil
|
||||||
|
@ -240,7 +247,7 @@ func checkForConflicts(aur []*rpc.Pkg, aurMake []*rpc.Pkg, repo []*alpm.Package,
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func askEditPkgBuilds(pkgs []*rpc.Pkg) {
|
func askEditPkgBuilds(pkgs []*rpc.Pkg) (error) {
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
dir := config.BuildDir + pkg.PackageBase + "/"
|
dir := config.BuildDir + pkg.PackageBase + "/"
|
||||||
|
|
||||||
|
@ -248,8 +255,24 @@ func askEditPkgBuilds(pkgs []*rpc.Pkg) {
|
||||||
editcmd := exec.Command(editor(), dir+"PKGBUILD")
|
editcmd := exec.Command(editor(), dir+"PKGBUILD")
|
||||||
editcmd.Stdin, editcmd.Stdout, editcmd.Stderr = os.Stdin, os.Stdout, os.Stderr
|
editcmd.Stdin, editcmd.Stdout, editcmd.Stderr = os.Stdin, os.Stdout, os.Stderr
|
||||||
editcmd.Run()
|
editcmd.Run()
|
||||||
|
|
||||||
|
file, err := os.OpenFile(dir + ".SRCINFO", os.O_TRUNC|os.O_WRONLY|os.O_CREATE, 0666)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
cmd := exec.Command(config.MakepkgBin, "--printsrcinfo")
|
||||||
|
cmd.Stdout, cmd.Stderr = file, os.Stderr
|
||||||
|
cmd.Dir = dir
|
||||||
|
err = cmd.Run()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pkgbuild, err := gopkg.ParseSRCINFO(dir + ".SRCINFO")
|
pkgbuild, err := gopkg.ParseSRCINFO(dir + ".SRCINFO")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
for _, pkgsource := range pkgbuild.Source {
|
for _, pkgsource := range pkgbuild.Source {
|
||||||
|
@ -264,6 +287,8 @@ func askEditPkgBuilds(pkgs []*rpc.Pkg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func dowloadPkgBuilds(pkgs []*rpc.Pkg) (err error) {
|
func dowloadPkgBuilds(pkgs []*rpc.Pkg) (err error) {
|
||||||
|
|
Loading…
Reference in a new issue