瀏覽代碼

Use formatPkgbase with getIncompatible

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.
morganamilo 6 年之前
父節點
當前提交
afee400662
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      install.go

+ 3 - 2
install.go

@@ -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
@@ -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
@@ -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()