Commit Graph

58 Commits

Author SHA1 Message Date
Jguer
a591b33262
Add errguards throughout the code to enable golangci-lint 2019-10-13 20:56:27 +01:00
Jguer
b01790f752
Moved StringSet definition to types package 2019-10-05 18:39:31 +01:00
morganamilo
cbc2a87c73
Use correct source protocol for VCS checks
Previously it was assumed that "git+https" means: use git and if that
fails fall back to https. What this actually means is just: use git over
https. Similary "git" just means use git and "git+http" means use git
over http.

Thus there is only ever one protocol to use. The current protocols array
has been kept for backwards compatibility with the vcs.json file. The
difference being now it will only ever place one protocol into the
array. Also when reading the array, the last protocol is always used.
This is so that entries that have not been regenerated will use the
correct protocol.
2018-10-09 01:18:23 +01:00
morganamilo
6894ddfd5c
Remove the timeout warning for vcs checks
This message is proving to be more misleading than helpful. For
git+https sources, many hosts seem to always timeout when trying
ls-remote over git:// but then succeed on https://. This leads to
a time out message being displayed even though the URL was queried
successfully on the second try.
2018-08-28 04:38:58 +01:00
morganamilo
cba56c3f9e
Use downloadPkgbuilds for -G 2018-08-18 17:12:42 +01:00
morganamilo
b1ee03a7d8
getBases now wants a slice instead of a map
The one place this function is used, the caller converts its data to
a map just to getBases will accept it. Instead just allow it to take the
slice to begin with.
2018-08-18 17:05:12 +01:00
morganamilo
cd21298355
Return srcinfos instead of using it as a parameter
Also, we do not do a pre and post pkgverbump pass anymore, so theres no
need to name it stale.
2018-08-18 17:05:12 +01:00
morganamilo
29fdf23f50
Remove unneeded code, consistent function names 2018-08-18 17:05:12 +01:00
morganamilo
43feb12c85
Merge handles.Aur and depOrder.Bases
depOrder.Aur contains the order in which AUR packages are to be
installed. While depOrder.bases contains the actual package data
organized by pkgbase.

deoOrder.AUR is kind of counterintuitive, as it only contains one
package from each package base.

For example if you were to install libc++{,abi,experimental},
depOrder.Aur would only contain one of those packages, which one
actually being quite random. depOrder.Bases[pkg.Pkgbase] will then be
looked up and everything under that slice would be installed.

This means that the only real use depOrder.Aur has, is to give the
pkgbase. So to cut out the middleman, lets merge .Aur and .Bases into
a single field.

Doing this has also heped to spot som subtle bugs:

Fix subtle split package errors.

The number menus now correctly list and respect (installed) for bases
that have atleast one of their packages installed.

Entering package names in number menus now always expects the pkgbase
name instead of the random package which happened to make it into .Aur.

--rebuild and --redownload correctly handles split packages.

formatPkgbase is also used more.
2018-08-18 17:05:12 +01:00
morganamilo
86ef1ec077
Include info in the lock 2018-08-09 17:01:29 +01:00
morganamilo
602f386b03
Loop over srcinfos instead of pkglist in gendb 2018-08-09 16:25:14 +01:00
morganamilo
2de67d1b24
Show message for timed out vcs checks 2018-08-09 16:25:14 +01:00
morganamilo
284c87afb6
Parallelize gendb 2018-08-09 16:25:14 +01:00
morganamilo
161bc1a17a
Only check pkgbuild source protocols for vcs fetch
The current check involves checking the entire source url for the word
git. This can lead to yay asumming sources are git repos when they are
not.

For example: https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v2.0.0/LICENSE/

Makepkg seems to also only respect the protocols. For example:
	https://github.com/jguer/yay
will be fetched as a web page. git:// or git+https:// would be needed.
Although this does not seem to work the way yay assumes. You can not simply
+ togther a bunch of protocols. For exaplle: git+http+https:// will not
work, even though individually they do. git must also come first:
https+git:// will not work either.

Yay's method of spliting on each + is fine though, it works and I'm not
going to worry about broken packages that do https+git:// or similar.
2018-08-09 16:25:14 +01:00
morganamilo
b5b6928803
Fix devel updates
Commit 474cc56f8d refactored the
getCommit() function to use the standard passToGit() and capture()
functions.

Unlike every other external call, here we use .Wait() and kill the
command after 5 seconds. This was missed and ended up breaking the
function.

So instead don't use capture but the manual .Wait() call. passToGit() is
still used.
2018-07-20 18:59:12 +01:00
morganamilo
1d443c0d40
Merge GIT_TERMINAL_PROMPT with the current env 2018-07-19 20:52:30 +01:00
morganamilo
474cc56f8d
Use passToGit() in getCommit() 2018-07-19 18:51:57 +01:00
Anna
d6b862357d Replace gopkgbuild with go-srcinfo (#528)
* Prefer vercmp over gopkgbuild

* Replace gopkgbuild with go-srcinfo
2018-07-16 15:28:18 +01:00
morganamilo
d627df7288
Support source URLs that contain ? again
Turns out the query part of a source url can be dirrectly after the URL
or after the # fragment. So the branch needs to be stripped too.
2018-07-05 01:58:34 +01:00
morganamilo
b46b111c07
Support source URLs that contain ?
Since pacman 5.1 makepkg supports  ? to signal some stuffg in
a similar way to #. Cut this out so URLs with ? no longer fail.
2018-07-04 15:29:54 +01:00
morganamilo
1b8d9317e4
Split pkgbuild downloading and up to date checks 2018-06-10 03:17:28 +01:00
morganamilo
ced35af515
Support --aur/--repo for -Ss and -Y 2018-06-04 20:36:10 +01:00
morganamilo
bad0af1a8a
Fix typos 2018-06-04 20:12:26 +01:00
morganamilo
c4d319268c
Disable git terminal prompt
This allows requests that want authentication to fail instantly and
silently. Rather than delying the program and printing to the terminal.
2018-06-02 13:52:18 +01:00
Jguer
d319576303 Use megacheck to lint project
Signed-off-by: Jguer <me@jguer.space>
2018-04-27 01:25:40 +01:00
morganamilo
55e7ed8ef7
Remove duplicate cmd.Run()
There was a duplicate cmd.Run() that somehow went unnoticed. It was also
missing an error check, so it was in the code but had no ill effects.
In 86bfacd253 the error check was added.
This caused it to fail every time sure to the cmd already being ran.

Remove the duplicate cmd.Run() altogether.
2018-04-17 20:14:16 +01:00
morganamilo
86bfacd253
Remove unneeded vars and fix missing err check 2018-04-17 17:57:02 +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
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
Jguer
307daf32e7 Rename functions to more standard go form and typo fix some variables 2018-04-01 19:54:33 +02:00
morganamilo
82871e2172
Lint 2018-03-25 22:31:20 +01:00
morganamilo
e331c01143
Print when a vcs source has been found 2018-03-22 18:30:56 +00:00
morganamilo
1e01eafb43
Separate gendb from install 2018-03-22 18:23:20 +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
1d2b07fa84
Use channels over WaitGroup in needsUpdate()
Using a WaitGroup forced the code to wait for every goroutine to finish.
Using channels allows us to exit early if any of a packages sources need
an update. No point in waiting for the other requests to finish if we
know there is an update.
2018-03-13 17:18:46 +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
7e6def5a5f
Add GitBin and tweak defaults
Use cacheHome for builddir instead of hardcoding ~/.cache
Use the command names in config.*Bin options.

For example PacmanBin is changed to just "pacman" this means yay will
call the pacman commit in PATH. If the user wants to use a different
binary they can still specify a full path in the config.
2018-03-07 23:14:42 +00:00
morganamilo
1d3a87bd70
Move ~/.config/yay_vcs.json to ~/.cache/vcs.json
And refactor the file paths to constants in config.go
2018-03-06 17:43:57 +00:00
morganamilo
fc72bdfcd0
Update vcs_test.go for new vcs method 2018-03-06 15:20:53 +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
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
Jguer
41c37153e5
remove unneeded struct entries. Minor linting fix 2018-02-13 17:52:33 +00:00
Jguer
4bfeb6d9da Merge branch 'master' of https://github.com/BrianAllred/yay into BrianAllred-master 2018-02-13 17:36:24 +00:00
Brian Allred
7471478352 Make devel operations respect default branch 2018-02-10 17:12:44 -06:00
Jguer
3f69df424f
fixes some display messages and eliminates secret sauce 2018-02-08 22:51:43 +00: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
J Guerreiro
3913673c8c
Merge pull request #67 from maximbaz/print_vcs_error_details
Print VCS error details
2017-11-21 13:41:04 +09:00
Maxim Baz
fdf41a6418
Print VCS error details 2017-11-21 01:34:27 +01:00
Maxim Baz
34d0f372fd
Prevent file corruption by truncating the files 2017-11-21 00:41:55 +01:00