Commit graph

80 commits

Author SHA1 Message Date
Motkov Kirill 14ac756298 Code improvements
- Removed yoda condition.
- Renamed/removed variables which shadows built-in names.
- Rewrited if-else-if-else chains to switch statements.
2019-03-10 16:36:01 +03:00
morganamilo 895788e01b
Update go-alpm 2019-02-14 20:45:18 +00:00
morganamilo 5ce4a49687
Update go-alpm 2019-02-04 16:56:02 +00:00
Joe Groocock 52bf777e67
Print errors on stderr
This makes a start on fixing https://github.com/Jguer/yay/issues/715
It is by no means a complete solution, but instead a start
2018-11-20 22:27:30 +00:00
Jguer 2ed7df4f5a
Unexport consts. Make default a literal
Signed-off-by: Jguer <me@jguer.space>
2018-10-22 21:00:16 +01:00
morganamilo b3e647aee4
Use MultiError in other goroutines 2018-08-09 16:25:14 +01:00
morganamilo 06a45bad59
Don't return length with queryRepo 2018-07-31 22:01:14 +01:00
morganamilo 3180c66f39
Use alpm's built in searching for -Ss
This allows us to support the usage option in pacman.conf
This also speeds up the searching
2018-07-26 14:00:08 +01:00
morganamilo 473a2de225
Refactor pssToFoo() functions
Previously each call to an external command had two functions.
PassToFoo() and PassToFooCapture(). These functions are always similar
and end up with duplicated code.

So instead have the passToFoo() functions return the cmd itself and
create small helper functions show() and capture() which will run the
command and either forward it to std{out,err,in} or capture the output

Also the saveVCSInfo() function which was called after every makepkg
call is now only called after the pacman -U succeeds.
2018-07-19 18:37:28 +01:00
Govind KP 219e50e668
Fixed trivial typo
packags -> packages
2018-06-10 13:58:21 +05:30
morganamilo ced35af515
Support --aur/--repo for -Ss and -Y 2018-06-04 20:36:10 +01:00
morganamilo 5f2933271a
Use slices for targets instead of stringsets
The order of targets does somewhat matter. For example doing something
like 'pacman -S db1/foo db2/foo' should cause the second package to be
skipped.

The order of targets also effects in which order they are resolved. This
should make errors more reproducable if any ever occur.
2018-06-02 17:56:09 +01:00
morganamilo 444ccce925
Filter out invalid tatgets instead of ignoring them
Invalid targets that occur when combining aur/foo with --repo or db/foo
with --aur. Instead of ignoring them, filter them out and give a warning
as it happens.
2018-06-01 05:06:58 +01:00
morganamilo 477d3b937e
Fix mixing of db prefix with --repo/--aur flags 2018-06-01 03:26:22 +01:00
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 6d70716ba2 Quick fix to yay -Si error code #430. Will return all possible values and then error
Signed-off-by: Jguer <me@jguer.space>
2018-05-28 13:43:02 +01:00
Jguer 3f15788c6a
Unexport functions and structures 2018-05-20 16:17:05 +01:00
morganamilo d6ab6ed9ac
Use native build date when printing news
Use the build date of the newest native package instead of the install
date of any package.
2018-05-17 20:11:07 +01:00
morganamilo 9f071a8e9b
Only show new news when calling -Pw
New news is defined as news that is newer than the install date of the
newest package on the users system.

All news can be shown using -Pww
2018-05-16 17:19:09 +01:00
morganamilo ef7e8acb13
Refactor complex map types into their own type
map[string][]string  -> mapStringSlice
mao[string]stringSet -> mapStringSet
2018-05-07 23:42:41 +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 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
Reeto Chatterjee 992c27e82e
Merge branch 'master' into master 2018-04-07 16:42:56 +00: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 5bcb51bf00
Don't abort during AUR search error 2018-04-03 06:49:41 +01:00
morganamilo fe3743c5ba
Try each search term against RPC if one fails
Allows searching the RPC for words that may be too short or have
too many results as long as another word in the search will work.

If no words can be used without error then the last error will be
returned and the program will exit.
2018-04-02 15:27:07 +01:00
Reeto Chatterjee b103a34f3b Use exisiting util function 2018-03-24 18:31:55 +00:00
Reeto Chatterjee 51f7b14777 Remove assumption of unique provides 2018-03-24 12:40:51 +00:00
Reeto Chatterjee 21df6b1d57 Update deps properly and lint 2018-03-24 00:04:28 +00:00
Reeto Chatterjee 1b704a869d Add recursive removal of packages 2018-03-23 23:45:46 +00:00
morganamilo 074ea4465a
Make aurInfo return a pointer 2018-03-22 18:11:00 +00:00
morganamilo 0c0cd4f883
Add utils.go 2018-03-22 16:38:21 +00:00
morganamilo 3ceda128fc
Dont use FindSatisfier() in packageSlices()
Now that install() no longer relies on packageSlices() we can drop the
use of FindSatisfier() so that only direct package names are understood,
this is how pacman -Si works.

This also fixes a small issue where `yay -Si mysql` would fail. This is
because two repo packages provide `mysql`. This causes Yay to not bother
checking the AUR even though there is a package in the AUR called `mysql`
2018-03-20 15:56:13 +00:00
morganamilo fae0c506cc
Support db/name for groups 2018-03-16 01:14:34 +00:00
morganamilo 62e244db0f
Improve db/name system and add support for -Si 2018-03-13 21:38:10 +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 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 6988537552
Add parseNumberMenu()
This function is designed to replace the existing number menu
in upcoming commits.
2018-03-10 03:04:44 +00:00
morganamilo e6b36eaf74
Fix min() 2018-03-08 04:07:51 +00:00
morganamilo 5f4c6e136b
Fix for yay locking when querying AUR 2018-03-08 02:26:06 +00:00
Peter Dyer c0402e61a6
Spellchecked comments and formatted to commenting standards.
Reformatted comments to have a space between // and the start of the
comment.
Added capital letters and punctuation.
Fixed most grammar and spelling mistakes.
Fixed date to yyyy/mm/dd.
2018-03-03 02:57:30 +00:00
morganamilo cfd391b423
Add comments to describe certain functions
Comments have been added to a couple of functions here and there
where I feel warrent some explanation. Hopefully this makes it a little
easier for people to contribute.

I commented on a couple of functions but my main focus is:
	DepTree
	DepCatagories
	StringSet
	Arguments

These are parts that have been mostly written by me and might seem
confusing without taking a while to study the code. Especially the first
two mentioned. They're a little complex, I'm not sure if they need to be
This is just how I came up with them. Hopefully helping other people
understand them will let them come up with improvments I did not see.
I'm not the best at explaining things but I did try my best here.
2018-03-03 01:34:39 +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
Daniel Martí 73d6f9b1ab all: remove unused code
And simplify some code too.
2018-02-27 10:16:53 +00:00
morganamilo 4ef282c54e
go fmt 2018-02-27 02:02:33 +00:00
morganamilo 46cc1f2c09
Display missing, orphans and out of date in groups
Instead of printing each warning on a seperate line, group up the
warnings by type (missing, orphan, out of date) and display each
group on its own line.
2018-02-27 02:02:33 +00:00
morganamilo 3f7c731f99
Make aurInfo concurrent 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