Skip to content

Commit

Permalink
Fix legacy engine install issues (#1842)
Browse files Browse the repository at this point in the history
* fix debug pkg clearing pkg archive slice

* add debug messages and limit check for srcinfo

* treat pkgbuildDirs as expected directory, not proven directory

Co-authored-by: David Tomaschik <david@systemoverlord.com>

Co-authored-by: David Tomaschik <david@systemoverlord.com>
  • Loading branch information
Jguer and Matir authored Nov 29, 2022
1 parent 4f1f539 commit 1b5f0d6
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions install.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,7 @@ func install(ctx context.Context, cmdArgs *parser.Arguments, dbExecutor db.Execu

for _, base := range do.Aur {
dir := filepath.Join(config.BuildDir, base.Pkgbase())
if isGitRepository(dir) {
pkgbuildDirs[base.Pkgbase()] = dir
}
pkgbuildDirs[base.Pkgbase()] = dir
}

if config.CleanAfter {
Expand Down Expand Up @@ -645,6 +643,7 @@ func buildInstallPkgbuilds(
}

if !satisfied || !config.BatchInstall {
text.Debugln("non batch installing archives:", pkgArchives)
errArchive := installPkgArchive(ctx, cmdArgs, pkgArchives)
errReason := setInstallReason(ctx, cmdArgs, deps, exp)

Expand Down Expand Up @@ -775,21 +774,29 @@ func buildInstallPkgbuilds(
}
}
}
text.Debugln("deps:", deps, "exp:", exp, "pkgArchives:", pkgArchives)

var (
mux sync.Mutex
wg sync.WaitGroup
)

for _, pkg := range base {
if srcinfo == nil {
text.Errorln(gotext.Get("could not find srcinfo for: %s", pkg.Name))
break
}

wg.Add(1)

text.Debugln("checking vcs store for:", pkg.Name)
go config.Runtime.VCSStore.Update(ctx, pkg.Name, srcinfo.Source, &mux, &wg)
}

wg.Wait()
}

text.Debugln("installing archives:", pkgArchives)
errArchive := installPkgArchive(ctx, cmdArgs, pkgArchives)
if errArchive != nil {
go config.Runtime.VCSStore.RemovePackage([]string{do.Aur[len(do.Aur)-1].String()})
Expand All @@ -806,6 +813,10 @@ func buildInstallPkgbuilds(
}

func installPkgArchive(ctx context.Context, cmdArgs *parser.Arguments, pkgArchives []string) error {
if len(pkgArchives) == 0 {
return nil
}

arguments := cmdArgs.Copy()
arguments.ClearTargets()
arguments.Op = "U"
Expand All @@ -820,10 +831,6 @@ func installPkgArchive(ctx context.Context, cmdArgs *parser.Arguments, pkgArchiv
arguments.DelArg("asdeps", "asdep")
arguments.DelArg("asexplicit", "asexp")

if len(pkgArchives) == 0 {
return nil
}

arguments.AddTarget(pkgArchives...)

if errShow := config.Runtime.CmdBuilder.Show(config.Runtime.CmdBuilder.BuildPacmanCmd(ctx,
Expand Down Expand Up @@ -857,7 +864,7 @@ func doAddTarget(dp *dep.Pool, localNamesCache, remoteNamesCache stringset.Strin
pkgdest, ok := pkgdests[name]
if !ok {
if optional {
return deps, exp, newPkgArchives, nil
return deps, exp, pkgArchives, nil
}

return deps, exp, pkgArchives, errors.New(gotext.Get("could not find PKGDEST for: %s", name))
Expand Down

0 comments on commit 1b5f0d6

Please sign in to comment.