Skip to content

Commit

Permalink
Use formatPkgbase with getIncompatible
Browse files Browse the repository at this point in the history
There was a possibly that getIncompatible could be broken when working
with split packages. After looking into it, this does not seem to be the
case, as long as we only work with pkgbases.

arch may be overriden inside of a package function. The global arch
array may be 'any' but package_foo could say arch=('x86_64'). If you
were running arm then should yay warn about this?

I have decided the answer is no. This is because makepkg doesn't care.
It would seem makepkg only checks the global arch array. This leads me
to believe that the global array should contain a the required arch.

Therefore the correct way to do the former example would be to declare
the global arch as 'x86_64' and then override package_bar with 'any'.

So all that we should do is properly use formatPkgbase to list all the
packages under the base.
  • Loading branch information
Morganamilo committed Aug 18, 2018
1 parent cd21298 commit afee400
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions install.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ func install(parser *arguments) error {
config.NoConfirm = oldValue
}

//TODO: fix for split packages maybe?
incompatible, err = getIncompatible(do.Aur, srcinfos)
if err != nil {
return err
Expand Down Expand Up @@ -417,6 +416,7 @@ func earlyRefresh(parser *arguments) error {

func getIncompatible(bases []Base, srcinfos map[string]*gosrc.Srcinfo) (stringSet, error) {
incompatible := make(stringSet)
basesMap := make(map[string]Base)
alpmArch, err := alpmHandle.Arch()
if err != nil {
return nil, err
Expand All @@ -431,13 +431,14 @@ nextpkg:
}

incompatible.set(base.Pkgbase())
basesMap[base.Pkgbase()] = base
}

if len(incompatible) > 0 {
fmt.Println()
fmt.Print(bold(yellow(arrow)) + " The following packages are not compatible with your architecture:")
for pkg := range incompatible {
fmt.Print(" " + cyan(pkg))
fmt.Print(" " + cyan(formatPkgbase(basesMap[pkg])))
}

fmt.Println()
Expand Down

0 comments on commit afee400

Please sign in to comment.