Commit graph

74 commits

Author SHA1 Message Date
morganamilo 0ae8fc2a06
Support --aur and --repo flags
These flags limit operations to only check the repos or only check the
AUR. These flags apply to -S, -Si and -Su.

-a may also be used as a short option for --aur. --repo has no short
option as -r is taken.
2018-05-31 16:25:49 +01:00
Jguer 3f15788c6a
Unexport functions and structures 2018-05-20 16:17:05 +01:00
Alexander Popov d1602083f2
Print warnings about newer local packages then remote versions
Inspired by [`pakku`](https://github.com/kitsunyan/pakku)
2018-05-14 11:31:18 +03:00
Alexander Popov 58283a9799
Make upgrade output as table 2018-05-08 00:41:35 +03:00
Jguer d319576303 Use megacheck to lint project
Signed-off-by: Jguer <me@jguer.space>
2018-04-27 01:25:40 +01:00
Tom Swartz 1c9715dddf Fix typos 2018-04-23 13:06:56 -04:00
morganamilo 72eaf6f582
gofmt -s 2018-04-17 17:54:22 +01:00
morganamilo 06406d7cee
More formatting tweaks
Ensure aurWarnings will always be printed out in one block
use '->' for printing aur warnings and ignored upgrades
use '->' for conflict printing
use '->' for key importing
Say PGP keys not GPG keys
Add back green for input prompts
Use 4 spcaces over \t
2018-04-11 20:23:43 +01:00
morganamilo 191b5ebe47
Make colours more consistent and less ott
Use yellow ==> for warning messages
Keep white text no matter the colour of ==>
Use cyan for pkgname printing like it already is in places
2018-04-11 20:23:43 +01:00
Alexander Popov 38b5680619
Fix make test (gofmt threw "Files need to be linted") 2018-04-08 22:46:33 +03:00
Alexander Popov 46cffa6ba6
Highlight diff between old and new versions better
Split by dots, pluses, dashes, tilds, etc., not only `Version` and `Pkgrel`.

Don't make new version different bold.

Inspired by [`pikaur`](https://github.com/actionless/pikaur).
2018-04-08 02:16:31 +03:00
morganamilo a33414b723
Repect --answer* flags when --noconfirm is set
This means that menus are now printed in noconfirm mode, I don't see
this as a problem because Pacman still prints its questions during
noconfirm.

When the user has edited pkgbuilds Yay will prompt if they want to
continue with the intall. This prompt is also enabled during noconfirm
to ensure the user is happy with the pkgbuilds.
2018-04-04 22:22:33 +01:00
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 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
morganamilo e807cd637f
Sort upgrade menu by pacman.conf order.
When printing the upgrade menu, sort the repos in the order they are
defined in pacman.conf (or more technically, the order they are
registered in alpm). Packages in the same repo are still sorted
alphabetically.

If a repo is not in pacman.conf or the database query fails it will
fallback to alphabetical.
2018-03-26 02:43:58 +01:00
morganamilo 7fd2a74bd2
Lint 2018-03-22 16:39:27 +00:00
morganamilo 0c0cd4f883
Add utils.go 2018-03-22 16:38:21 +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 bb211fdbf7
Don't show package in aur/ if it is also in devel/ 2018-03-22 07:13:18 +00:00
morganamilo 624851b80b
More sorting for upgrade menu
Sort accending instead of decending
Sort by package name as well as repo name
Sort AUR packages as well as repo packages
2018-03-22 07:13:18 +00:00
morganamilo b5c0cb7a11
Simplify upList()
Before the goroutines in upList() were layed out like:
	upLists()
	|- - - 	upRepo()
	|- - - 	pAur()
		| - - -	upDevel()

Simplified by moving upDevel() from upAur() to upList():
	upList()
	|- - - 	upRepo()
	|- - - 	upAur()
	|- - - 	upDevel()

With the simpler layout it was easy to then remove some un need channel
useage entirely and use WaitGroups in other places.

Now if any of the three inner functions error, upList() will return
a combined error instead of just printing the error and carrying on.
2018-03-22 07:13:18 +00:00
morganamilo 57a8048cb8
Use goroutinuies for devel updates
The update process was already partly parallel: repo, aur and devel
updates where each given their own goroutine.

This gives two further layers of parallelization. Firstly the
`needsUpdate()` function is now run in parallel for each package checked.
One package may have many vcs sources so `needsUpdate()` also checks all
of its sources in parallel.

This gives an aproxamte 3x speedup for `yay -Su --devel` timing from
when the command starts to when the number menu apears.

unfortunately git://bitbucket.org/volumesoffun/polyvox.git never
resolves on my machine for some reason so it always hits the 5 second
timout period.

It then moves on to http:/bitbucket.org/volumesoffun/polyvox.git/ which
does resolve as expected. I have not looked into it but I fear this
applies to all gitbucket repos. Luckly they are few and far between.
2018-03-13 17:18:46 +00:00
morganamilo 74196306fa
Respect --ignore and --ignoregroup flags
And enable version colouring on repo ignore and devel ignore
2018-03-12 23:46:23 +00:00
J Guerreiro c072146190
Merge pull request #227 from Morganamilo/numbermenu
Use numbermenu for cleanBuilds and editPkgbuilds
2018-03-11 19:46:53 +00:00
morganamilo f7abb1b0ac
Use numbermenu for cleanBuilds and editPkgbuilds 2018-03-11 18:14:16 +00:00
morganamilo 91757f51c7
Fix formatting on upgrade menu
commit 5286f385 broke the alignment on -> in the upgrade menu.

This commit moves the function responsable for printing the upgrade menu
from upgrade.go to print.go, fixes the formating to how it was before
and changes the padding on the number to three digits instead of two.
This allows proper alignment on numbers >100 which is not unheard of.
2018-03-11 04:13:13 +00:00
morganamilo 2aadd1931c
Refactor and improve the upgrade menu
With the planned move to number menus for askcleanbuilds and
askeditpkgbuilds a consistant way is needed to make number menus in
a clean way without rewriting the same code over and over.

The prevous commit introduced `parseNumerMenu()` to create a standard
way to handle number menus. This commit implements the new function for
the upgrade menu both as a test and to bring some new features.

Entering 1-9999999 will no longer cause ram usage to spike to 100%
(before yay would try to build an []int containing the numbers 1 to
9999999).

Suport for discarding/including entire repos by name

> "54 aur extra"
	would skip the package numbered 54 and all packages
	that are listed as aur and extra.

> "^devel ^20"
	would only install packages listed under devel and the package
	numbered 20
2018-03-10 03:04:54 +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
Peter Dyer 66225b949d Add missing space before devel update 2018-03-03 23:42:12 +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 181663b7cb
Refactor f() to a dedicated function colourHash()
Also enable colourHash() for yogurt mode.
2018-03-02 01:08:14 +00:00
morganamilo 4cdcdc30e9
Further formatting tweaks
Ask clean builds is now asked early and remembers what you choose when
the install finishes.
Fixup "there is nothing to do" message.
2018-02-27 02:52:06 +00:00
morganamilo 4ef282c54e
go fmt 2018-02-27 02:02:33 +00:00
morganamilo 716d775d5f
Improve formatting
Ignorepkg also colours version differences like the upgrade menu
Tweaked formatting when asking for users to eneter number
2018-02-27 02:02:33 +00:00
morganamilo 2856a7276c
Refactoring and improving insall process
This commit mostly focuses on merging the install() and upgradePkgs()
functions to be more integrated. Instead of both making their own aur
queries they now both combine theyre needes into one query. This gives
us a speed up and allows us to easily print orphands, misising and out
of date in one clean block.
2018-02-27 02:02:33 +00:00
morganamilo 7558f8fcf8
Use aurInfo for -S and -Su
This also improves the dependency by switching to stringSets for some
structures that previously contained duplicates.
2018-02-27 02:02:33 +00:00
Daniel Martí 269f6516d8 upgrade: be consistent about no colors
If pacman's color is off, don't use colors to mark the repos of
upgradeable packages.
2018-02-20 15:54:53 +00:00
Simon Legner 750ae0254c Fix typos in code/comments 2018-01-31 22:07:02 +01:00
Jguer a25ed83b21
Fixes version colouring. Semi-fixes collumn allignment 2018-01-26 15:27:47 +00:00
Jguer ecc337c29f
Finishes porting text to new colour format. 2018-01-26 15:04:10 +00:00
Jguer f466fc74f5
Ports more text to new colour format. 2018-01-26 11:30:33 +00:00
Jguer 5286f3858c
References #109. Begins to add escape codes and string constants 2018-01-26 10:18:49 +09:00
Jguer 3c9a31994c
Linted using Neoformat, all linters enabled 2018-01-21 07:37:10 +09:00
morganamilo 3275f8d8ac
New install algorithm
I have replaced the old install and dependancy algorithms with a new
design that attemps to be more pacaur like. Mostly in minimizing user
input. Ask every thing first then do everything with no need for more
user input.

It is not yet fully complete but is finished enough so that it works,
should not fail in most cases and provides a base for more contributors
to help address the existing problems.

The new install chain is as follows:
	Source info about the provided targets
	Fetch a list of all dependancies needed to install targets
		I put alot of effort into fetching the dependancy tree
		while making the least amount of aur requests as
		possible. I'm actually very happy with how it turned out
		and yay wil now resolve dependancies noticably faster
		than pacaur when there are many aur dependancies.
	Install repo targets by passing to pacman
	Print dependancy tree and ask to confirm
	Ask to clean build if directory already exists
	Download all pkgbuilds
	Ask to edit all pkgbuilds
	Ask to continue with the install
	Download the sources for each packagebuild
	Build and install every package
		using -s to get repo deps and -i to install
	Ask to remove make dependancies

There are still a lot of things that need to be done for a fully working
system. Here are the problems I found with this system, either new or
existing:
	Formating
		I am not so good at formatting myself, I thought best to
		leave it until last so I could get feedback on how it
		should look and help implementing it.
	Dependancy tree
		The dependancy tree is usually correct although I have
		noticed times where it doesnt detect all the
		dependancies that it should. I have only noticed this
		when there are circular dependancies so i think this
		might be the cause. It's not a big deal currently
		because makepkg -i installed repo deps for us which
		handles the repo deps for us and will get the correct
		ones. So yay might not list all the dependancies. but
		they will get installed so I consider this a visual bug.
		I have yet to see any circular dependancies in the AUR
		so I can not say what will happend but I#m guessing that
		it will break.
	Versioned packages/dependencies
		Targets and dependancies with version constriants such
		as 'linux>=4.1' will not be checked on the aur side of
		things but will be checked on the repo side.
	Ignorepkg/Ignoregroup
		Currently I do not handle this in any way but it
		shouldn't be too hard to implement.
	Conflict checking
		This is not currently implemented either
	Split Paclages
		Split packages are not Handles properly. If we only
		specify one package so install from a split package
		makepkg -i ends up installing them all anyway. If we
		specify more than one (n) package it will actually build the
		package base n times and reinstall every split package
		n times.
	Makepkg
		To get things working I decided to keep using the
		makepkg -i method. I plan to eventually replace this
		with a pacman -U based method. This should allow passing
		args such as --dbpath and --config to aur packages
		aswell as help solve some problems such as the split
		packages.
	Clean build
		I plan to improve the clean build choice to be a little
		more smart and instead of check if the directory exists,
		check if the package is already build and if so skip the
		build all together.
2018-01-20 10:00:12 +00:00
morganamilo 91662d7e9d
Count from 0 on upgrade prompt 2018-01-18 12:08:40 +00:00
Samuel Henrique Oliveira da Silva 12641befac Keeping up with master
- Minor linting fixes.
2018-01-14 17:17:15 -02:00
Samuel Henrique Oliveira da Silva d737c99c81 Excluding from installation
#ItWoksOnMyMachine
2018-01-14 16:53:37 -02:00
Samuel Henrique Oliveira da Silva 0301eb0440 Negation for upgrading 2018-01-14 15:48:16 -02:00
Jguer 4abddaab66
Satisfied linter 2018-01-15 02:23:29 +09:00