Commit graph

99 commits

Author SHA1 Message Date
morganamilo 8556acdd5f
Add flags for sort order and automating menu input
Added:

--sortby <votes|popularity|id|baseid|name|base|submitted|modified>
--answerclean
--answeredit
--answerupgrade
--noanswerclean
--noansweredit
--noanswerupgrade

TODO: docs and completion
2018-04-04 21:53:32 +01:00
morganamilo b8ef531b76
Strip request targets instead of making a new one 2018-04-03 17:48:56 +01:00
Peter Dyer 4400ebc31e Skip SRCINFOs that cannot be parsed during gendb
Install will still abort if a SRCINFO cannot be parsed.
2018-04-02 19:27:16 +01:00
morganamilo e5c99778df
Strip db prefix from request targets 2018-04-02 17:50:04 +01:00
morganamilo ed964bf04d
Try alpmArch and any when looking for built pkgs.
Instead of trying to figure out if the package is of arch any just try
both.
2018-04-02 14:56:07 +01:00
J Guerreiro 5b7daa129a
Merge pull request #302 from Morganamilo/fix#287
Only pass needed upgrades to deptree
2018-04-02 12:48:53 +02:00
Jguer 307daf32e7 Rename functions to more standard go form and typo fix some variables 2018-04-01 19:54:33 +02:00
morganamilo a04dd94282
Only pass needed upgrades to deptree
To know what AUR packages need updating a rpc request is needed for all
packages. The dep tree is designed to cache everything to minimize the
amount of rpc requests. The downside of this is the dep tree ends up
with all sorts of packages in cache that it doesn't need. Then the
deptree tries to resolve deps for all of thoes packages.

By spliting the sysupgrade from the dep tree this stops this from
happening, it uses one more rpc request but also may lower the amount of
total rpc requests needed lated on.

This fixes a couple of tiny bugs such as triggering providers prompts
and printing AUR out of date messages for packages that are not going
to be installed.

This also fixes another display bug where repo packages from -Su would
not apear when printing the packages to be installed under [Repo].
2018-03-29 19:05:38 +01:00
J Guerreiro 85238c2a93
Merge pull request #277 from Morganamilo/gendb
Separate gendb from install
2018-03-25 18:04:36 +02:00
morganamilo 2b9437741e
Handle db/name with --redownload and similar flags
--redownload is meant to only download the targets the user provides.
If the user enters aur/foo then Yay will find the package foo from the
aur, --redownload will see thats not what the user entered and skips the
download.

This makes it so after the dep searching is done, all db/ prefixes are
dropped.
2018-03-23 17:07:20 +00:00
morganamilo 1e01eafb43
Separate gendb from install 2018-03-22 18:23:20 +00:00
morganamilo 2ea16836eb
Fix nothing to do if upgrading only repo packages
Dont display clean/edit menu when upgrading only repo packages.
2018-03-22 17:12:33 +00:00
morganamilo 0c0cd4f883
Add utils.go 2018-03-22 16:38:21 +00:00
Morgana ac02498177
Merge pull request #269 from Morganamilo/conflicts
More conflict checking
2018-03-22 15:27:39 +00:00
morganamilo a1a05bced4
Don't mark targets as dependencies 2018-03-22 15:22:05 +00:00
morganamilo 4a8ec944bf
Move conflict checking to its own file 2018-03-22 07:19:25 +00:00
morganamilo 804bd45f2c
More conflict checking
This commit extends the conflict checking a lot, it adds support for:
	Conflicting with provides as well as actual package names
	Reverse conflicts
	Inner conflicts

Both normal conflicts and inner conflicts are run in parallel.
Messages are now printing when checking conflicts.

This also fixes packages sometimes being listed as conflicting with
themselves.

The inner conflict is a little verbose and could be toned down a little
but I am insure exactly how to tone it down.
2018-03-22 07:18:58 +00:00
morganamilo 98ea801004
Pass -Su to pacman during sysupgrade
Previosly during `yay -Su` Yay would pass
`pacman -S <packages that need upgrade>` to pacman.

Instead pass `pacman -Su --ignore <number menu choices>`

This allows yay to handle replaces and package downgrades `-Suu`
2018-03-22 07:13:18 +00:00
morganamilo 885614ef45
Move repo install to after numbermenus 2018-03-21 00:45:26 +00:00
morganamilo df11b85e54
Implement the provider question and imitate pacman
Implement the alpm question QuestionSelectProvider and print the select
menu in a way similar to how pacman does it.
2018-03-20 15:56:13 +00:00
morganamilo 4bcd3a6297
Handle pkgbuilds with an unsupported arch
When pkgbuilds are built by makepkg, if the pkgbuild's arch=() array
does not include the current carch set in makepkg.conf, makepkg will
fail to build the package.

Now, Yay detects if a pkgbuild does not support the arch set in
pacman.conf Yay will ask the user about this and ask them if they want
to build anyway, passing `--ignorearch` to makepkg.`

Note that Yay will check against the arch set in pacman.conf which is
what pacman uses to only allow installs of package of that arch. makepkg
will still use carch set in makepkg.conf to build packages. These two
values are expected to be the same otherwise Yay will fail.

The on disk .srcinfo is needed for this as the user should be asked pre
source download. This and pgp checking both use the on disk .srcinfo so
it is no longer a one off. Store the 'stale' srcinfos so they can be
accesed by both functions.
2018-03-19 19:24:51 +00:00
Sergio Correia 9f62663888
Minor cleanups to keep the linter happy
* Unexported:
  - QuestionCallback
  - SliceToStringSet

* Unreachable return in parser.go

* Unneded else in dependencies.go

* Punctuation in error message in install.go
2018-03-19 11:39:47 -04:00
Sergio Correia a5b5cc38ee
Remove unused functions after #227
After #227, the following functions became unused, so remove them:
- askCleanBuilds
- askEditPkgBuilds
2018-03-19 11:28:46 -04:00
morganamilo e09752c23d
Be more exact when looking for cached packages
Instead of looking for `pkgname-pkgver-pkgrel*`
Look for `pkgname-pkgver-pkgrel-arch.pkg*` using the arch set in goalpm.
2018-03-19 10:53:40 +00:00
Sergio Correia 32f8396eca
Add --gpg' and --gpgflags` flags
`--gpg' is the GnuPG binary, while `--gpgflags' are extra
arguments to be passed to  GnuPG.

Also Update man page and usage regarding GnuPG options.
2018-03-17 19:15:29 -04:00
morganamilo 7eea7eb9b5
Fix and improve version checking
Fix typo where adding to has instead of depStrings

Error correcly when missing packages

Also handle cases where a package is provided multiple times. If one
package provies `foo=1` and another provides `foo=2` before the latter
would just overide the former version. Now both versions will be checked
against.
2018-03-17 02:09:17 +00:00
Morgana 4c4737d952
Merge pull request #247 from Morganamilo/versions
Check versioned deps during the dep fetching process
2018-03-17 00:40:43 +00:00
morganamilo 158b80c5bc
Fix updating of vsc packages
With the addition of pgp key checking in Yay, the srcinfo parsing was
moved to before the pkgver() bump, leading to outdated pkgbuild
information.

Srcinfo parsing must be done after the pkgver() bump
The pkgver() bump must be done after downloading sources
makepkg's PGP checking is done as the sources download
yays PGP importing requires the srcingo to be parsed

Quite the chicken and egg problem

It is possible to skip the integ checks after the sources download
then parse the srcinfo
do the yay PGP check
then run the integ checks

the problem here is that to generate the srcinfo `makepkg --printsrcingo` is ran
This causes the pkgbuild to be sourced which I am not comftable with
doing without the integ checks.

Instead we parse the on disk .SRRCINFO that downloads with the PKGBUILD
just for the PGP checking. Later on we parse a fresh srcinfo straight
from `makepkg --printsrcingo`. This is a little bit less efficient but
more secure than the other option.
2018-03-17 00:10:38 +00:00
morganamilo fae0c506cc
Support db/name for groups 2018-03-16 01:14:34 +00:00
morganamilo c091460d8c
Use a question callback for ignorepkg
The callback is set to allways silently say yes, When passing to pacman
for the intall pacman will then ask the question giving the user
a chance to answer.
2018-03-16 00:18:13 +00:00
morganamilo 69a86c6a78
Check versioned deps during the dep fetching process
Check versioned deps such as `foo>1` `foo=2` `foo<3`
2018-03-15 17:05:17 +00:00
J Guerreiro e0b8c92433
Merge pull request #243 from Morganamilo/rebuild2
Add --rebuild flag
2018-03-15 09:40:37 +00:00
morganamilo 18af700053
Add --rebuild flag
Similar to the --redownload flag, when specifed targets will be rebuilt
even if an up to date version is cached. --rebuildall can be used to
ensure uninstalled dependencies are rebuilt as well.

Additionally, unlike --redownload there is also --rebuildtree. This
causes a rebuild and reinstall of a package and all of it's dependencies
recursivley. This is designed for when a libary updae, breaks an
installed AUR package due to a partial upgrade. polybar is a common
example

--rebuild allows you to easily skip the cache and rebuild against a newer
libary version. --rebuildtree is a more nuclear option where you can
rebuild the whole dependency tree.
2018-03-14 15:01:20 +00:00
morganamilo de29fc1b0f
Error when installing AUR packages as root 2018-03-14 13:08:04 +00:00
Morgana f9d4d9bafb
Merge pull request #235 from Morganamilo/fix#228
Add support for db/name
2018-03-13 17:14:22 +00:00
Sergio Correia 6f25da860c Ask if yay should try to import missing PGP keys
When building a package from the AUR for which there are missing keys,
yay will now prompt the user whether it should try to import such keys
using gpg:

[...]
:: Parsing SRCINFO (1/3): libc++ (libc++abi libc++)
:: Parsing SRCINFO (2/3): aurutils
:: Parsing SRCINFO (3/3): cower
==> GPG keys need importing:
        487EACC08557AD082088DABA1EB2638FF56C0C53, required by: cower
        11E521D646982372EB577A1F8F0871F202119294, required by: libc++ (libc++abi libc++)
        B6C8F98282B944E3B0D5C2530FC3042E345AD05D, required by: libc++ (libc++abi libc++)
        DBE7D3DD8C81D58D0A13D0E76BC26A17B9B7018A, required by: aurutils
==> Import?  [Y/n]
[...]

Default is to try to import the problematic keys ([Y/n]).
2018-03-12 17:11:31 -04:00
Jguer e86e39a21d Add left padding to number menu
Signed-off-by: Jguer <me@jguer.space>
2018-03-12 21:01:53 +00:00
morganamilo 5446f5d0a4
Add support for db/name
Adds the ability to pick which database to install a package from. This
is extended to also support for AUR packages. For example `extra/git`
and `aur/yay` should both work`. When not explicitly requesting
a database repo packages will be choosen over the AUR.

This features extends to yogurt mode, listings where a package shows up
in multiple database/the AUR is now handled.

The aur does not have a real pacman databse like core, extra ect. But
can be accessed as if was one with `aur/name`. Using Yay with a pacman
repository named "aur" is undefined.
2018-03-11 21:32:36 +00:00
morganamilo f7abb1b0ac
Use numbermenu for cleanBuilds and editPkgbuilds 2018-03-11 18:14:16 +00:00
Morgana a7be7a839d
Merge pull request #208 from Morganamilo/redownload
Add support to skip pkgbuild downloads.
2018-03-07 21:56:18 +00:00
morganamilo a6cab60888
Add --redownloadall option and fix manpage descs 2018-03-07 21:32:55 +00:00
morganamilo fd95855a49
Fix group installs 2018-03-07 16:42:26 +00:00
morganamilo f66349696e
Add support to skip pkgbuild downloads.
If a pkgbuild is already in cache and matches the version on
the aur skip the download.

The version we check comes from the .SRCINFO file on disk which is never
updated. (updates through pkgver() edit the pkgbuild but do not effect
the .SRCINFO). Therefore if the the version of the .SRCINFO matches the
AUR's version there must not be  an update.

In the case of the on disk version being newer than the AUR version we
can assume user interaction and they probably do not want it overwitten
so in that case also skip the download.
2018-03-06 04:08:37 +00:00
morganamilo 80c59a74cc
Use git ls-remote to track devel updates
Use the command `git ls-remote <url> <branch>` to track devel updates
rather than relying on the GitHub API.

This allows devel update to work for every git based source and
elimantes the rate limiting from GitHub.

The yay_vcs.json format has changed to better support packages which
multiple vcs sources and to track the protocols each source uses. And
track the branch that each source tracks in it's fragment.
2018-03-05 23:05:13 +00:00
morganamilo 1597fb1cf0
Fix Yay showing AUR prompts when it shouldnt
In a very specific case where the user runs `yay -Syu` then uses the
number menu to ignore all AUR upgrades after the Repo install the user
will still be prompted to install and download packages.
2018-03-03 04:14:35 +00:00
morganamilo 55bfd619dc
Improve printing
Add ( and ) to "installed" to match groups and out of date
Show popularity as well as voted in yogurt mode
Show download and install size in yogurt mode
Remove printing of white and black
Fix incorrect message on number menu
Yellow is now almost never used
Use `v` instead of `r` when printing version
show when a page was marked out of date on search and info
2018-03-02 20:32:33 +00:00
morganamilo ed2c231a72
Refactor printing
Drop the Fb suffix for printing colours
Seperate bold, fb and bg printing into individual functions
2018-03-02 04:39:16 +00:00
morganamilo 111a7f73dc
Hide pacman output when setting install reason
Stderr is shown if Pacman returns non 0.
2018-02-28 17:41:42 +00:00
morganamilo 0b6e4e0872
Correctly mark packages as dependencies
Previously Installing repo targets and repo dependencies of aur targets
was done in two steps.

doing `yay -S repo1 repo2 aur1 aur2` would lead to yay calling
`pacman -S repo1 repo2`. Then after we find all the dependencies of the
aur packages we call `pacman -S --asdeps <all repo dependencies>`. This
was an easy way to correctly mark dependencies. Since 005635b4 Both
these calls were merged into one command but dependency marking was
forgoten about.

Now correctly mark the dependencies through `pacman -D`
2018-02-28 15:29:54 +00:00
morganamilo 695927c4cd
Abort if editor does not return 0
This allows the user to abort the install by telling the editor to exit
with a non zero status. e.g. `:cq` in vim. This should also catch errors
if the editor does actually fail or if the configured editor does not
exist.
2018-02-28 11:39:19 +00:00