Commit Graph

60 Commits

Author SHA1 Message Date
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
Jguer
b18724ac7e Merge branch 'fix#71' of https://github.com/Morganamilo/yay into Morganamilo-fix#71 2018-01-15 02:22:41 +09:00
Jguer
62af87bb0f
Merged argument parsing system 2018-01-15 02:12:51 +09:00
Samuel Henrique Oliveira da Silva
6d2dcad091 Replicates the range functionally to upgrade 2018-01-14 14:04:15 -02:00
morganamilo
0fb4b3bab3
Use go-alpm for ignorepkg/ignoregroup 2018-01-10 00:38:32 +00:00
morganamilo
232edc64a6
Further integration for the argument system
Argument parsing now works mostly as expected for repo packages.
AUR packages are a little tricky becauce makepkg cant handle args such
as '--dbpath'.

Also out alpm handle does not read the commandline options so any
arguments relient on alpm will be ignored.

For now though it seems yay has gained back the functionality it once
had. While also having improved argument handling which should also be
expandable and make it easier to handle anything new that might have
been missed.
2018-01-04 08:32:50 +00:00
morganamilo
96f499ff44
Reimplement all previously existing operations
This reimplemens all operations yay previously supported:
	'-S' 'Syu' 'Si' ect.

Currently the argument objects are not fully implemented with the code.
Theres alot of funky conversion from
	argument object -> pkg, flags -> argument object
This is to just get back to the functionally we had before (almost).

I have not looked into it yet but alot of the time pacman flags get
passed to makepkg. this cases an error for most commands now because the
new system Passes all flags:
	`yay -Syu` -> flags = '-S' '-y' '-u'
while the old system would have done:
	`yay -Syu` -> op = '-Suy', flags = ''

So extra flags are no longer passed at all currently.

This means:
	'yay -S aic94xx-firmware --noconfirm -b /tmp/pacutilesu2q6hw/tmp-pacman -d'
will no longer error and 'aic94xx-firmware' will be installed but the
database path change will not apply and the dep checking will not be
skipped.
2018-01-04 08:32:50 +00:00
morganamilo
df27396fa0
Teach passToPacman how to use argParsers
passToPacman now takes and argParser as a paramater. And is implemented
for the simple cases in cmd.go. Although passToPacman is now left non
working in places which still try to usr the old call format and will
need to be reimplemented.
2018-01-04 08:32:50 +00:00
morganamilo
952d95273a
Fix crash when package version is "invalid" 2017-12-30 22:52:33 +00:00
Jguer
97bb7d0a9c Merge branch 'updateIgnore' 2017-10-30 21:41:50 +09:00
Jguer
138b0f27dd Check if package is already in upgrade list and skip it. References #60 2017-10-30 21:36:50 +09:00
Jguer
1f29de4805 References #61 2017-10-30 21:19:05 +09:00
Jguer
7a8933b8fc Readded showing new update ignored version 2017-10-25 16:17:13 +09:00
Jguer
61a1d46ccd Should resolve #59 2017-10-25 14:42:03 +09:00
Jguer
a6a0b9b441 git devel package support restored, house keeping, fixes related to config files. 2017-10-19 11:30:37 +09:00