Commit graph

256 commits

Author SHA1 Message Date
l4 8c1d64c06b local repo goes first
remove the old function

local repo goes first

exit on err passToPacman()
2018-01-16 00:09:32 +07:00
l4 b1e01b3af5
Merge branch 'master' into fix_query_info 2018-01-15 21:02:44 +07:00
Jguer 41e9f8694e Merge branch 'Morganamilo-fix#71' 2018-01-15 02:23:36 +09: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 92e9eed230
Updated go-alpm vendored version 2018-01-15 02:21:50 +09:00
Jguer 9cbef8d643 Merge branch 'Morganamilo-fix#62' 2018-01-15 02:13:19 +09:00
Jguer 62af87bb0f
Merged argument parsing system 2018-01-15 02:12:51 +09:00
J Guerreiro efbda98094
Merge pull request #94 from Morganamilo/fixnl
Fix formatting on -Si for aur packages
2018-01-14 00:50:58 +09:00
J Guerreiro 45e0b5509f
Merge pull request #93 from Morganamilo/addbottomup
Add missing --bottomup option
2018-01-14 00:48:44 +09:00
J Guerreiro ed6f05eb19
Merge pull request #84 from Morganamilo/fix#78
Fix crash when package version is "invalid"
2018-01-14 00:47:14 +09:00
morganamilo 0fb4b3bab3
Use go-alpm for ignorepkg/ignoregroup 2018-01-10 00:38:32 +00:00
morganamilo a3df41368b
Merge branch 'master' into fix#62 2018-01-07 21:59:39 +00:00
morganamilo 92683dc3ed
Fix formatting on -Si for aur packages
Add missing \n
Remove trailing [ and ] on slices
2018-01-07 17:36:31 +00:00
morganamilo 40a881927c
Add missing --bottomup option 2018-01-06 23:28:07 +00:00
l4 ba143bdb36 fix query info with -Si 2018-01-06 20:50:54 +07:00
J Guerreiro 32ecd8b1dd
Merge pull request #83 from Morganamilo/searchfrom1
Count from 1 instead of 0 when searching packages
2018-01-06 22:47:45 +09:00
J Guerreiro 65c0c52a75
Merge pull request #91 from Jguer/revert-82-master
Revert "Add missing --bottomup option"
2018-01-06 22:46:47 +09:00
J Guerreiro 04ebd39b53
Revert "Add missing --bottomup option" 2018-01-06 22:46:07 +09:00
J Guerreiro 82a4b30484
Merge pull request #82 from Morganamilo/master
Add missing --bottomup option
2018-01-06 09:46:34 +09:00
morganamilo 60deeb2ceb
Update manpage 2018-01-05 22:29:49 +00:00
morganamilo 142cb25f95
Fix deps not being passed to pacman properly 2018-01-05 22:15:12 +00: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 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 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 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 3084f91ba7
Reimplement getpkgbuild
Futre todos:
	Add option to fetch deps
	Add option to set download path
2018-01-04 08:32:50 +00:00
morganamilo 68a9771327
Move passToPackman from config.go to cmd.go 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 2b47a4d9f0
Refactor away os.Exit
Try to minimise the useage of os.Exit

Apart from init, os.Exit is only used once as the final function call.
Now we can ensure there are no random exits hidding in the code. We can
also allow part of the code to error and continue on while also
remembering that we did error and return non 0 when we finally do reach
the os.Exit. This comes in very handy for trying to save the vcs info
after an error and ensuring that alpmHandle.Release is always called.
2018-01-04 08:32:50 +00:00
morganamilo 765b767333
Rework some of the yay specific operations
Some of the yay specific operations such as:
	'-Qstats' '-Cd'
Break the standard pacamn has set.

Most yay specific specific options have been moved into their own
operator:
	'-Y' '--yay'
	'-Qstats' -> '-Y --stats'
	'--Cd' -> '-Y --cleandeps'
	'--gendb' -> '-Y --gendb'
Although:
	'-G'
has been kepts and and alias has been added for is:
	'--getpkgbuild'

This shouldnt feel too different for most people given that yay will
default to:
	'-Y'
when no operator has been specified. So calls like:
	'yay --gendb'
will still work as they did.

Internally handleConfig has been partially refactored. Now all that
remians in setters for config. All flags that did anything beond setting
config have been moved to handleYay(). This means less nasty
os.Exit()'s and nicer flow control.

The usage has also been updated. The options changes have been added but
the layout has also been tweaked a bit.

Lastly on the things not done:
	Man page has not been updated
	Shell completion has not been updated

This will be done in further commits as the usage is not guaranteed
to stay the same between now the completion of the argument system.
2018-01-04 08:32:44 +00:00
morganamilo 19efb1f121
Foundation for re writing the argument parsing system
Currently the foundation for a new fuller argument parsing has been implemented in
parser.go. Most of the parsing is now done through the argParser object
instead of seperate arrays for options and packages. The rest of the
code still expects the old system so I have left most of the operations
unimplemented for now until I redo it with the new system. Currently
only '-S' and number menu have any functionality for testing purposes.

This new system parses arguments fully instead of just looking for
predefined strings such as:
	'-Sqi' '-Siq'.
This allows:
	'-Syu', '-S -y -u', '--sync -y -u'
to all be parsed as the same.

This system tries to be as similar to pacman as possible, eventually
aming to fully wrap pacman, allowing yay to be used instead of pacman in
all instances.

The current implementation is not as strict as pacman when checking
arguments.  If you pass
--someinvalidflag to yay then yay will simply ignore it. The flag should
still be passed to pacman which should then cause an error.

Although operations '-S' '-R' '-U' ect. are checked to make sure you can not
try to use two operations at once.

conflicting flags such as:
	'--quiet' and '--info'
will not raise an error and which options gains precedence is depend on
the implementation.

Another minor issue which is worth noting is. Due to the way double
arguments are parsed:
	'-dd' '-cc' '--deps --deps'
if you pass the long version and the short version:
	'-d --deps'
yay will not realize its a double argument. Meanwhile pacman will
reconise it when yay calls pacman.

Currently there are a few things that need to be done before this new
system can be fuly released:
	Reimplement all operations to use to new parsing system so that
		the new system is at least as functional as the old one
	Strip yay specific flags before passing them to pacman
	Move parts of config into the argument system and only use
		config for options that are meant to be saved to disk
	Move yay specific operations into its own operator '-Y'
	Update documentation to show the altered syntax
2018-01-04 01:14:25 +00:00
morganamilo 952d95273a
Fix crash when package version is "invalid" 2017-12-30 22:52:33 +00:00
morganamilo c0eac580a8
Count from 1 instead of 0 when searching packages
I feel like starting from 1 is much better ergonomically while not using
a numpad. This could be added as a config option instead if you would
prefer.
2017-12-30 06:18:09 +00:00
morganamilo 04bd59450c
Add missing --bottomup option
This option was mentioned in --help and the man page but not implemented
in the arg parsing
2017-12-30 05:54:43 +00:00
J Guerreiro 1fabad45e2
Updated Pictures and Changelog 2017-12-06 10:11:03 +09:00
Jguer 6305f86a3a
Minor polishing using gometalinter. 2017-12-04 15:24:20 +09:00
Jguer 2ca3f4d726
Fixed man page indenting. 2017-12-04 12:03:10 +09:00
Jguer 4c7f341dd2
References #64. Added optional afterclean. Updates man page. Adds entries to --help 2017-12-04 11:39:23 +09:00
J Guerreiro 22931a77a3
Merge pull request #68 from PietroCarrara/master
Using '-' doesn't raise an error
2017-11-28 11:51:53 +09:00
Pietro Carrara e0050a63db Using '-' doesn't raise an error 2017-11-27 10:46:18 -02: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
J Guerreiro 324ff366bc
Merge pull request #66 from maximbaz/truncate_config_files_before_writing
Prevent file corruption by truncating the files
2017-11-21 13:31:16 +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
J Guerreiro 878c606556
Merge pull request #63 from AnthonyLam/issue-49
Add -V and -h for flag parsing
2017-11-12 10:48:27 +09:00
Anthony Lam ba8e3c98e7 Add -V and -h for flag parsing 2017-11-08 22:00:29 -08: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