Commit graph

60 commits

Author SHA1 Message Date
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
morganamilo 8fb83f3e70
Save the VSC info when install finishes.
Save the VSC Info as soon as the package install finishes. This should
ensure the VSC db does not end up in an incorrect state if an install
fails or is cancelled by the user.

This also adds better support for split packages. When one or more
packages are installed from the same base each individual package is
added to the db not just the base. This allows us to track individual
updates from the same base so that if one package gets updated we don't
assume all packages in the base are updated.
2018-02-27 17:14:40 +00:00
morganamilo 04a9830e0b
Fix tests 2018-02-27 03:41:39 +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 31d6a95c2a
Tweak some of the printting and fix formatting 2018-02-27 02:02:33 +00:00
morganamilo b50fae1dd4
Reword conflicting package message
The old message was probably easy to confuse with the `replaces` term.
2018-02-27 02:02:33 +00:00
morganamilo deed5e6794
Fix yay not installing repo deps properly 2018-02-27 02:02:33 +00:00
morganamilo e015c612d8
Remove -s from makepkg
The -s was kept aroung because the package base `python-virtualfish`
failed to build without it. I first blamed this on some aur rpc bug
because it was missing some deps that were listed in python-virtualfish.
As is turned out python-virtualfish actually does some things wrong in
it's package build and if it was formated correctly this wouldnt be
a problem.

I kept the -s in just so it would build even though it might have had
some side affects. makepkg not respecting the --dbpath for example.

From now on python-virtualfish will fail to build when you dont have all
the deps installed. This is their fault and will not be fixed here.
2018-02-27 02:02:33 +00:00
morganamilo 2f39f5ddc4
Only print "querying aur" when using the aur 2018-02-27 02:02:33 +00:00
morganamilo dab8f1b5d2
Improve gendb and formatting
Exit after parsing srcinfo with db do it actually does something.
when using gendb dont bother generating srcinfos.
Improved the formatting for some things mainly downloading and parsing.
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
morganamilo 4350752e32
Give error when failing to parse .SRCINFO
Instead of panicking later on.
2018-02-18 15:39:04 +00:00
morganamilo e88bf0f5b7
Improve conflict handling
Renable conflict checking, was disabled for testing, forgot to reenable
Use pacman --ask to remove conflicting packages, dont do it directly.
Say what each package conflicts with
Check for conflicts before aking for clean build

Reverse conflict are still not checked
2018-02-16 22:39:46 +00:00
Jguer 433f5b6ce1
Apply linting to patch 2018-02-16 17:18:59 +00:00
morganamilo 03295c3f3f
Install repo deps for aur packages after questions 2018-02-16 15:50:54 +00:00
morganamilo cdaee7d1d4
Improve support for split packages
Split packages are now grouped together when printing displaying the
package base and the packages inside of the base to beinstalled. If only
one packge is to be installed from a base and the package name matches
the base name print normally

Only build and install once per package base

Only ask questions once per package base for editing pkgbuils and clean
build
2018-02-16 15:49:18 +00:00
morganamilo e1f3cb6682
run cleanafter after finishing the install process
Cleanafter is now run right at the very end of install instead of after
each makepkg command.
2018-02-15 21:41:49 +00:00
morganamilo e61263ff96
Install repo deps for aur packages at the start
Install all deps for aur packages after the user confirms they want to
continue installing. This takes most of the load off of makepkg -s but
the -s is still left in for some edge cases with split packages.
2018-02-15 21:41:49 +00:00
morganamilo f58421953b
Skip build if package is already built in cache 2018-02-15 21:41:49 +00:00
morganamilo 8c3c125900
Bump pkgver before parsing .SRCINFO 2018-02-15 21:41:49 +00:00
morganamilo 83491069d3
Split .SRCINFO parsing to its own function 2018-02-15 21:41:49 +00:00
morganamilo ad898b2d33
Regenerate .SRCINFO if editing the PKGBUILD 2018-02-15 21:41:49 +00:00
morganamilo 24d8b57172
Use -Ru instead of -R when removing make depends
When installing a package might be a dependancy for something and a make
dependancy for something else. This means when prompted to remove make
dependencies yay might also try to remove a package that is actually
needed causing a pacman error.

Adding the -u option will cause pacman to skip needed packages and give
a nice warning as it does so. It does not fix the root issue but works
for now.
2018-02-15 21:41:49 +00:00
Jguer 3f69df424f
fixes some display messages and eliminates secret sauce 2018-02-08 22:51:43 +00:00
Jguer 28515c8beb adds conflicting packages prompt 2018-02-07 12:37:24 +00:00
Michael Rees 3df03c3291
Prettify repository download messages 2018-02-05 14:05:58 -06:00
Simon Legner 750ae0254c Fix typos in code/comments 2018-01-31 22:07:02 +01:00
Jguer 5286f3858c
References #109. Begins to add escape codes and string constants 2018-01-26 10:18:49 +09:00
morganamilo a33ef81794
Fix numbermenu not working with new install alg 2018-01-21 11:48:09 +00: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
Jguer 61065dc930
Satisfied linter 2018-01-19 23:51:18 +09:00
morganamilo 93a861c725
Fix makepkg not behaving correctly
This bug was caused by me not thinking when passing flags to aurInstall.
Currently a bunch of functions take an array of flags but we don't really
use them any more after the argument parsing update. These should be
refactored out eventually but I'm holding off until I'm more sure about
how these functions should look.
2018-01-17 04:14:44 +00:00
morganamilo 142cb25f95
Fix deps not being passed to pacman properly 2018-01-05 22:15:12 +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 44f83e03ea
Move makepkg handling to its own function 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