Commit Graph

54 Commits

Author SHA1 Message Date
morganamilo
5ce740068e
Always pass PacmanConf to pacman
Normaly we only pass --config to pacman if the user specifies it on the
command line. Otherwise we let pacman use it's default config location.

If the user has changed pacmanconf in Yay's config file then this could
cause a miss match between the config we use to init alpm and the config
pacman is using.
2018-07-28 19:54:41 +01:00
Anna
74f4a44da6
Merge pull request #584 from Morganamilo/completion-slow
Rework completion
2018-07-26 13:56:06 +01:00
morganamilo
bc6028348b
Make the completion refresh time configurable
The default setting is 7 days. The user can specify a different time in
days. -1 can be set to never refresh while 0 can be used to always
refresh.
2018-07-26 13:54:13 +01:00
morganamilo
c4fec3dad0
Wrap -Sp
Currently we do not handle -Sp, this leads to yay trying a proper
install and failing. So instead pass it to pacman and exit. Ideally we
would extend -Sp to include AUR packages but for now don't bother.
2018-07-25 11:16:30 +01:00
Anna
96532c0b27
Merge pull request #562 from Morganamilo/#560
Add --makepkgconf
2018-07-24 13:08:21 +01:00
morganamilo
4af671afac
Add --[no]makepkgconf 2018-07-24 13:07:17 +01:00
morganamilo
562a21fb4d
Support --aur/--repo with -Sc 2018-07-24 02:49:45 +01:00
morganamilo
253d162b5b
Remove unused code, fix typo for -g flag
As it turns out, the times you need root also tend to be the time you
need to manipulate the database. So the needWait() function can be
removed and repllaced by needRoot()
2018-07-21 17:40:32 +01:00
J Guerreiro
f9972da763
Wait for db.lck to become available before starting a db operation (#573)
* Wait for db.lck to become available before starting a db operation

* Fix err!=nil issues and avoid spamming users

* Remove redundant cases

* Remove return
2018-07-21 16:18:19 +01:00
J Guerreiro
a97034fc8b
Merge pull request #524 from AlexWayfer/support_commas_in_parse_number_menu
Support commas in parserNumberMenu
2018-07-02 16:40:05 +01:00
Alexander Popov
6eded7c4a3
Support commas in parserNumberMenu 2018-07-02 18:21:00 +03:00
Daniel Wendler (@cassandra)
fef91ab371 run pacman -Qk(k) as root
fixes #525
2018-07-02 14:15:57 +02:00
morganamilo
01fa34093f
Support answerdiff to match answer{clean,edit} 2018-06-11 20:11:38 +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
b2d3eb5c49
Add new dependency code to replace the old code
This is a rewrite of the dependency system, It aims to be cleaner
written, with a better idea of what is needed from the start, meaning
less new code being hacked on for things that were not thought about.
This version also aims to use as many small functions as possible, for
cleaner code and better testing.

Added dep.go:
    general dependency functions
Added depPool.go:
    Replacement of depTree, dependencies were never ordered so
    a tree did not really make sense. Instead the term pool
    makes more sense.
Added depOrder.go:
    Replacement of depCatagories, This simply orders the
    dependencies, dependencies are still catagorized as repo and AUR
    but I believe this to be a better name
Added depCheck.go:
    Replaces conflicts.go and also contains the missing dependency
    code

This version is mostly the same as the old version with a few
improvments:
    Missing packages will print the full dependency tree
    Versioned dependency checking errors should be fixed
    Make depends should be calculated properly
    Experimental AUR provide searcher

This code has been added along side the old code for testing and is not
currently used by the install process. Once the install process is moved
to use this code, the old code will be removed.
2018-05-29 13:13:27 +01:00
morganamilo
c399996cab
Fix typos 2018-05-12 17:16:48 +01:00
morganamilo
38818757c8
Lint 2018-05-10 20:18:16 +01:00
morganamilo
21b7899083
Use built in html escaping 2018-05-07 06:26:29 +01:00
morganamilo
a10241f7ab
Print descriptions of news
Print the full descriptions of each news item.

The description is formatted as html, basic parsing is done to display
it properly. -q/--quiet can be used to diplay title only.
2018-05-07 01:46:08 +01:00
morganamilo
debe19278a
Fix warning by megacheck in parser 2018-04-27 02:43:10 +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
440004a80c
Fix exist sometimes being false for flags 2018-04-17 18:24:39 +01:00
morganamilo
63471b9ede
Fix misspellings and typos 2018-04-17 18:01:34 +01:00
morganamilo
ef5fda0264
Hanlde double args of mixed short and long types
99% of the time if a user wants to pas an argument twice they would do
`-cc` or `--clean --clean`. Still doing `-c --clean` is still a valid
thing to do. This commits allows getArg() to this properly.
2018-04-17 13:53:37 +01:00
morganamilo
6d876a738c Add --gitflags and --[no]gitclone flags 2018-04-16 13:42:15 +01:00
morganamilo
f1e98e45a6
Support flags when using the editor
Added --editorflags alongside --editor
$VISUAL and $EDITOR are split on whitespace
2018-04-09 20:50:18 +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
Michael Düll
fcf0ee34d1 Default action (running yay without any args) is now to -Syu. 2018-03-31 22:55:15 +02:00
morganamilo
0c0cd4f883
Add utils.go 2018-03-22 16:38:21 +00:00
Sergio Correia
9f62663888
Minor cleanups to keep the linter happy
* Unexported:
  - QuestionCallback
  - SliceToStringSet

* Unreachable return in parser.go

* Unneded else in dependencies.go

* Punctuation in error message in install.go
2018-03-19 11:39:47 -04:00
Sergio Correia
32f8396eca
Add --gpg' and --gpgflags` flags
`--gpg' is the GnuPG binary, while `--gpgflags' are extra
arguments to be passed to  GnuPG.

Also Update man page and usage regarding GnuPG options.
2018-03-17 19:15:29 -04:00
morganamilo
b0961e866d
Add full support for reading from stdin
Previosuly when reading from stdin we did not redirect back to the real
stdin afterwards so it was imposible to interact with y/n questions.

Now redirect back to "/dev/tty" just like pacman does.
2018-03-12 00:04:50 +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
2bb8070213
Add flags for all missing config options
With this The user should never have to manually edit the yay config
file. All options can be set directly through yay using
`yay --<option> <value> --save`
2018-03-08 14:56:53 +00:00
morganamilo
cee0d74643
Add --mflags option to pass args to makepkg 2018-03-07 23:18:00 +00:00
Jguer
fc3738c060 add missing options and operations to zsh
Signed-off-by: Jguer <me@jguer.space>
2018-03-04 00:12:19 +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
Daniel Martí
73d6f9b1ab all: remove unused code
And simplify some code too.
2018-02-27 10:16:53 +00:00
morganamilo
85a99198c3
Fix handling of -- in parser 2018-02-20 17:03:50 +00:00
morganamilo
0f0100b4d0
Fixes #122 properly
Options such as --devel are now striped from the parser before handling
the command but the option is still processed so that config.devel would
be true.

Also changed `changedConfig` to a global in config.go
2018-01-31 17:44:15 +00:00
morganamilo
66f2c8f869
Filter out yay command line options 2018-01-31 16:09:15 +00:00
morganamilo
a33ef81794
Fix numbermenu not working with new install alg 2018-01-21 11:48:09 +00:00
J Guerreiro
69c8bf37c8
Merge pull request #106 from Jguer/print
Basic new Print option implementation
2018-01-21 08:05:02 +09:00
Jguer
42889821d3
New print option, added new completion syntax, fixed fish completion 2018-01-21 02:48:40 +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
c0fc086a07
Pass command line arguments to alpmConf before init
This allows us to use command line options such as '--root' and '-b' when
performing operations that use out alom handle.

Sadly this does not apply to passToMakepkg which will ignore options
such as '--root' and because we pass '-i' to makepkg it installs for us
using the default options.

Currently I have not planned a solution for this but one which I thought
of but not looked into is. Always call makepkg without arguments (except
from '--noconfirm' and others which might still be needed) and manage
the dependancies and post install outselves.

Another option might be to use makepkg's $PACMAN enviroment variable and
redirect the pacman calls to yay. Although I am unsure about both
stratergys they are just my current thoughts.

Also while editing the flow of cmd.go, I managed to refactor away all
os.Exit calls apart from the very last so it should be more clear as to
where the program exits.
2018-01-04 22:48:54 +00:00
morganamilo
16b747cb2d
Make the parser aware of global pacman arguments
Allows globals to be tracked more easily so that thay can be seperated
from normal arguments and passed easily while not passing other
arguments.

Also fixed some missing checks and bugs.
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