Commit Graph

313 Commits

Author SHA1 Message Date
morganamilo
9c882614a3
Rework completion
Bash seperates on whitespace, so the fish completion file
actually works for bash and zsh. So remove the concept of shells
entirley and just use the singular aur_sh.cache file.

If for some reason output without the repository data is needed, the
user could always just pipe it into awk like so
`yay -Pc | awk '{print $1}'`. Or perhaps a --quiet option could be added
where yay will strip the output itself.

The completion cache now updates when installing AUR packages. This is
done as a goroutine with no wait groups. This ensures the program will
never hang if there is a problem.

The completion is stil updated during -Pc but as long as an AUR package
has been installed recently it should not need to update.

The cache will now also wait 7 days instead of 2 before refreshing.
A refresh can be forced using -Pcc.
2018-07-26 13:54:10 +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
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
morganamilo
ec48698f35
Add --{no,ask}removemake 2018-07-21 14:20:00 +01:00
morganamilo
257653047b
Move sudoloop code to exec.go 2018-07-19 18:58:04 +01:00
morganamilo
8427dc3804
Move passToFoo() functions to their own file 2018-07-19 18:48:46 +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
morganamilo
686e1baaf4
Update readme, depreciate -Pu and -Pn 2018-07-17 22:01:52 +01:00
morganamilo
4f1a46eed8
Add bash and zsh completion for new flags 2018-07-01 17:21:54 +01:00
Jguer
89b5a1b798
Fix invalid uppercasing in flags
Signed-off-by: Jguer <me@jguer.space>
2018-07-01 14:53:48 +01:00
morganamilo
a91dc9e557
Document --[no]useask and --[no]combinedupgrade 2018-07-01 14:35:01 +01:00
morganamilo
3bdb534321
Separate Pacman upgrade and AUR Upgrade by default
Currently When performing a system upgrade, Yay will first refresh the
database then perform the repo and AUR upgrade. This allows Yay to add
some features such as better batch interaction, showing potential
dependency problems before the upgrade starts and combined menus
showing AUR and repo upgrades together.

There has been discussion that this approach is a bad idea. The main issue
people have is that the separation of the database refresh and the upgrade
could lead to a partial upgrade if Yay fails between the two stages.

Personally I do not like this argument, there are valid reasons to Yay
to fail between these points. For example there may be dependency or
conflict issues during the AUR upgrade. Yay can detect these before any
installing actually starts and exit, just like how pacman will when
there are dependency problems.

If Yay does fail between these points, for the previously mentioned
reasons or even a crash then a simple refresh will not cause a
partial upgrade by itself. It is then the user's responsibility
to either resolve these issues or instead perform an upgrade using
pacman directly.

My opinions aside, The discussions on the Arch wiki has reached
a decision, this method is not recommended. So to follow the decided
best practises this behaviour has been disabled by default.

This behaviour can be toggled using the --[no]combinedupgrade flag

It should be noted that Yay's upgrade menu will not show repo packages
unless --combinedupgrade is used.
2018-06-30 03:40:19 +01:00
Anna
77a5cf5c69
Merge pull request #504 from Morganamilo/noask
Remove default usage of --ask
2018-06-24 16:30:28 +01:00
morganamilo
67817e2a19
Return when no packages are to be installed. 2018-06-23 16:19:25 +01:00
morganamilo
ea5a94e0f8
Remove default usage of --ask
--ask is no longer used when installing AUR packages, instead pass no
confirm when we know there are no conflicts and wait for manual
confirmation when there are.

This means that when there are no conflicts there should be no change in
behaviour and the user will not need to intervene at all.

The old behaviour can still be used with --useask.
2018-06-22 15:17:34 +01:00
morganamilo
1952f88c34
Remove a space 2018-06-12 21:10:41 +01:00
morganamilo
4bfa5f6128
Document --[no]upgrademenu 2018-06-11 20:12:17 +01:00
morganamilo
42f0508625
Add upgrademenu to match {clean,diff,edit}menu 2018-06-11 20:12:17 +01:00
morganamilo
d0bc1d70d9
Document new flags 2018-06-11 20:11:38 +01:00
morganamilo
01fa34093f
Support answerdiff to match answer{clean,edit} 2018-06-11 20:11:38 +01:00
morganamilo
8430c41be9
Rework editing and diff showing
Clean build needs to happen before downloading pkgbuilds so that they
can be deletd before downloading.

Editing and diff viewing needs to happen after downloading the
pkgbuilds.

Prevously we asked to clean and edit at the same time. Then clean,
download pkgbuilds and open the editor.

This poeses a problem for diff viewing and editing. It's likley that the
user will see the diff and use that to decide if they want to edit the
pkgbuild. Using the current method, the user will be asked to view diffs
and edit before actually seeing any diffs.

Instead split cleaning diff showing and editing to three seperate menus
in the following order:
	show clean menu
	clean
	download pkgbuilds
	show diff menu
	show diffs
	show edit menu
	edit pkgbuilds

Also each menu is seperatly enableable. By default only the diff menu is
shows. If the user wishes to clean build, edit pkgbuilds or disable
diffs then the user can use the --[no]{clean,diff,edit}menu flags. This
replaces the --[no]showdiffs flags.
2018-06-10 16:11:23 +01:00
morganamilo
ced35af515
Support --aur/--repo for -Ss and -Y 2018-06-04 20:36:10 +01:00
morganamilo
a71784684c
Add new options to usage 2018-06-04 19:16:43 +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
f20fbd25c1
Implement diffs for pkgbuild viewing.
diff viewing can be toggled via --[no]showdiffs. When enabled diffs will
be shown for packages between the current HEAD and upstream's HEAD.
Packages downloaded via tarballs will be shown in full using the editor

git diff is used to show diffs. Therefore the pager for diffs can be
set via the PAGER and GIT_PAGER enviroment variables.
2018-06-01 18:11:13 +01:00
morganamilo
682040319e
Add config option for pgp key fetching 2018-05-31 16:36:36 +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
morganamilo
c464af6b9b
Implement config option for provider searching 2018-05-29 17:40:35 +01:00
Jonas Thiem
976876961b Add completions for --news 2018-05-06 03:31:09 +02:00
Jonas Thiem
8dd08327b1 Add --news to --print 2018-05-06 02:26:03 +02:00
morganamilo
99c7b5bb44
Update man page and tweak usage 2018-04-23 02:24:23 +01:00
morganamilo
63471b9ede
Fix misspellings and typos 2018-04-17 18:01:34 +01:00
morganamilo
86bfacd253
Remove unneeded vars and fix missing err check 2018-04-17 17:57:02 +01:00
morganamilo
683890c1b8
Add support for -Sc
-Sc will delete cached AUR data from Yay's build dir according to
the `CleanMethod` specified in the Pacman config file.

-Scc will delete all cached AUR data.

Additionally -Sc will also delete all untracked files in the AUR cache.
This will delete things such as downloaded sources and built packages
but will leave directories behind.

This is very usefull because the only reason a directoiry should exist
in the cache is because of downloaded VCS sources. Non VCS sources are
redownloaded every update because when a new version is released a new
tarball has to be downloaded. But VCS sources are never redownloaded,
updates are simply pulled. For this reason the user probably wants to
keep this data as it is still usefull even after building and installing
a package.
2018-04-17 13:53:37 +01:00
Jguer
cfd244f377 Add missing entries
Signed-off-by: Jguer <me@jguer.space>
2018-04-16 14:13:11 +01:00
morganamilo
cf47746d20 Use git clone for pkgbuild downloading
Use git clone over tarballs for pkgbuild downloading during -S. This
option can still be toggled using the config flags.

The config option for selecting clone or tarball will be overiden if an
existing package is cached. The method used to download the package
perviously will be used regardless of the config.
2018-04-16 14:12:02 +01:00
morganamilo
6d876a738c Add --gitflags and --[no]gitclone flags 2018-04-16 13:42:15 +01:00
morganamilo
24f596959d
Dont bump pkgver() while downloading sources
Previously we ran pkgver() right after dowloading sources. This is
a problem because prepare() should be called and all dependencies
should be installed before pkgver().

Instead bump the pkgver while building then get the new pkgver used for
install. Previously we parsed `makepkg --printsrcinfo` to get the new
version. Insead use `makepkg --packagelist` as it is much faster.
2018-04-16 00:17:56 +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
Morgana
13ef6f66ab
Merge pull request #275 from ratorx/master
Recursively remove dependencies when using yay -Yc
2018-04-09 17:01:00 +01:00
morganamilo
e05d86b31b
Document fcf0ee34d1 2018-04-08 15:49:56 +01:00
Reeto Chatterjee
992c27e82e
Merge branch 'master' into master 2018-04-07 16:42:56 +00:00
morganamilo
855c6c841c
Update usage and man page for new flags 2018-04-05 19:25:17 +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
morganamilo
faf607c624
Allow help to be used with all Operators 2018-04-03 18:01:18 +01:00
morganamilo
b8ef531b76
Strip request targets instead of making a new one 2018-04-03 17:48:56 +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
J Guerreiro
91eb2585e9
Merge pull request #286 from Morganamilo/noerr
Suppress pacman error printing
2018-03-25 18:05:25 +02:00
Reeto Chatterjee
1b704a869d Add recursive removal of packages 2018-03-23 23:45:46 +00:00
morganamilo
7768fab978
Supress pacman error printing
add22f5957 added error checks to all the
passToPacman commands. This makes `yay -Q nonexistantpackage` return
non 0 as it should. Annoyingly it also made yay print `exit status = n`
which is the error string from passToPacman calls. This error doesn't
add much and is quite annoying, expecially when calling pacman commands
like `-Q` or `-Si` where yay should be kind of 'hidden' and print just
like pacman does.

Now set the error string to "" for pacman commands and don't print an
error if it == "" (avoids empty line printed).

Also behave more like pacman when using `yay -Qu`.
2018-03-23 19:56:28 +00:00
morganamilo
1e01eafb43
Separate gendb from install 2018-03-22 18:23:20 +00:00
morganamilo
7fd2a74bd2
Lint 2018-03-22 16:39:27 +00:00
morganamilo
7655bd9c62
Add main.go 2018-03-22 16:38:21 +00:00
morganamilo
1864ec3083
Respect --color
`--color auto` is the same as `--color always` until a suitable method
for auto has been decided.
2018-03-21 05:42:19 +00:00
morganamilo
add22f5957
Extend aur support for -Qu
-Qu now has AUR support, it functions identically to `-Pu` and may replace
it in the futre.

Aditionally the pacman options `-n` and `-m` are also supported to
filter out native and non native packages. Other flags are not supported
currently.

Using any other `-Q` will fallback to Pacman.
2018-03-21 05:03:22 +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
c091460d8c
Use a question callback for ignorepkg
The callback is set to allways silently say yes, When passing to pacman
for the intall pacman will then ask the question giving the user
a chance to answer.
2018-03-16 00:18:13 +00:00
morganamilo
ca4dac0685
Update doc for --rebuild 2018-03-14 15:02:24 +00:00
morganamilo
18af700053
Add --rebuild flag
Similar to the --redownload flag, when specifed targets will be rebuilt
even if an up to date version is cached. --rebuildall can be used to
ensure uninstalled dependencies are rebuilt as well.

Additionally, unlike --redownload there is also --rebuildtree. This
causes a rebuild and reinstall of a package and all of it's dependencies
recursivley. This is designed for when a libary updae, breaks an
installed AUR package due to a partial upgrade. polybar is a common
example

--rebuild allows you to easily skip the cache and rebuild against a newer
libary version. --rebuildtree is a more nuclear option where you can
rebuild the whole dependency tree.
2018-03-14 15:01:20 +00:00
Morgana
f9d4d9bafb
Merge pull request #235 from Morganamilo/fix#228
Add support for db/name
2018-03-13 17:14:22 +00:00
morganamilo
74196306fa
Respect --ignore and --ignoregroup flags
And enable version colouring on repo ignore and devel ignore
2018-03-12 23:46:23 +00:00
morganamilo
2bd4cdc590
Pass yay -Sl to pacman 2018-03-11 23:34:09 +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
Jguer
803d957282 Fix typos
Signed-off-by: Jguer <me@jguer.space>
2018-03-11 21:19:19 +00:00
morganamilo
d03890a3c4
Remove unneeded functions 2018-03-10 03:04:54 +00:00
morganamilo
287bac04c9
Use parseNumberMenu() for yogurt mode 2018-03-10 03:04:54 +00:00
morganamilo
296f59f855
Handle sudoloop flag 2018-03-08 16:06:40 +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
15409ad4e5
Add doc for --mflags 2018-03-07 23:36:09 +00:00
morganamilo
cee0d74643
Add --mflags option to pass args to makepkg 2018-03-07 23:18:00 +00:00
morganamilo
dec395753c
Remove accidental debug string 2018-03-07 22:58:13 +00:00
morganamilo
5a7654909d
Add doc for --save 2018-03-07 22:37:44 +00:00
morganamilo
33b76045e7
Add --save option
Before setting options such as --topdown would be saved to the config
file automaticly when used. Now this is no longer done by default and
isntead the --save flag must be passed for this to happen.

If --save is passed the config is now saved as soon as the argument
parsing is finished apposed to before where it was saved when yay exits.
This means that config changes will now apply if the user does a ^C
before yay finishes.
2018-03-07 22:34:45 +00:00
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
9b4264f346
Set default config in the correct place 2018-03-07 16:26:15 +00:00
morganamilo
74ef0beaed
Fix error when cacheHome does not exist
And refactor initYay out into smaller parts
2018-03-07 05:27:54 +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
d5fc1e0de5
Update docs for --redownload and --noredownload 2018-03-06 15:17:55 +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
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
J Guerreiro
35599cdccf
Merge pull request #193 from Morganamilo/updatemanpage
Update manpage and usage
2018-03-01 09:47:49 +00:00
morganamilo
8e7af3e186
Update manpage and usage
Reword a lot of manpage and usage options.

Remove the `-Yg` and `-Y --getpkgbuild` options from documentation and
code as they have moved to `-G` and `--getpgkbuild`.

Update the version in the man page. Because our version is based on our
commit number added a `+` after the version number to indicated that
this is the version the manpage was written at but it also applies to
newer versions.

Added missing `-c --complete` and `-f --fish` options to the manpage.
But left them out of usage.

Added myself to the authors section. I do feel a bit bad about adding
myself and only myself but I thought it was not a good idea to add 20
names and fill up the page. There's currently no rules on who should be
added and not really a huge need for them right now. I guess we can just
add more people when we deem they belong there whatever that criteria
is.
2018-03-01 02:09:24 +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
Morgana
9c4b4d73f9
Merge pull request #183 from Morganamilo/fix#88
Save the VSC info when install finishes.
2018-02-27 19:08:01 +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
Daniel Martí
73d6f9b1ab all: remove unused code
And simplify some code too.
2018-02-27 10:16:53 +00:00
morganamilo
04a9830e0b
Fix tests 2018-02-27 03:41:39 +00:00
morganamilo
716d775d5f
Improve formatting
Ignorepkg also colours version differences like the upgrade menu
Tweaked formatting when asking for users to eneter number
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
3fb77b1d72
Use aurInfo() for -G 2018-02-27 02:02:33 +00:00
J Guerreiro
f000afaa42
Merge pull request #168 from seankhliao/master
add config.String() to pretty print default config in valid json
2018-02-27 01:44:45 +00:00
morganamilo
85a99198c3
Fix handling of -- in parser 2018-02-20 17:03:50 +00:00
Sean Liao
56db82ed10 fix stray tab 2018-02-20 23:12:07 +08:00
Sean Liao
d12685debc separate printing default and current config 2018-02-20 23:08:29 +08:00
Sean Liao
57773b6c2d add config.String() to pretty print default config in valid json 2018-02-20 22:24:48 +08:00
morganamilo
4298e77632
Fix passing incorrect flags during yay -Sy[s,i] 2018-02-17 23:00:18 +00:00
morganamilo
d04ca15228
Hang on first sudo
Currently sudoloop is run in parallel with the rest of the code this
causes the first sudo prompt to ask for a password while the code
continues running.

Instead hang on the first sudo, giving the chance for the user to enter
a password then continue the loop in the background.
2018-02-16 18:12:22 +00:00
Jguer
6913770b4d Merge branch 'lessmakepkg' of https://github.com/Morganamilo/yay into Morganamilo-lessmakepkg 2018-02-16 17:16:56 +00:00
Jguer
9f734bdf8d References #147. Sudo loop is off by default 2018-02-16 13:15:05 +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
Brian Allred
510bd7e172 Fix extended info (-Sii) not passing to pacman 2018-02-14 10:10:07 -06:00
Jguer
78742a9429
fix #147 with a sudo loop 2018-02-13 18:20:15 +00:00
J Guerreiro
3bc33c1b64
Revert "Respect --noconfirm in config" 2018-02-09 20:27:34 +00:00
J Guerreiro
20128f4776
Merge pull request #142 from Morganamilo/fix#122
Respect --noconfirm in config
2018-02-09 09:52:00 +00:00
morganamilo
519014af3d
Respect --noconfirm in config 2018-02-09 03:34:29 +00:00
Kaushal M
22d10f287a
Re-add support for PacmanBin 2018-02-08 15:04:47 +05:30
Jguer
c0901ff86b Fixes --noconfirm. Changes default build location to ~/.cache/yay/ 2018-02-07 12:06:56 +00:00
J Guerreiro
d2db36ac7a
Merge pull request #129 from simon04/typos
Fix typos in code/comments
2018-02-05 09:00:41 +00:00
Jonas Platte
9c524a4ece s/PKGBuild/PKGBUILD 2018-02-01 10:13:32 +01:00
Simon Legner
750ae0254c Fix typos in code/comments 2018-01-31 22:07:02 +01: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
Jguer
fa479c2670 Updates fish completions
Updates man page and usage
Changes -G to -Yg but doesn't remove previous option yet.
2018-01-31 19:27:11 +09:00
Jguer
f466fc74f5
Ports more text to new colour format. 2018-01-26 11:30:33 +00:00
Jguer
a4d0ef108f
Fixes #75. Needs sudo. Prints number of updates and update list. 2018-01-25 20:39:26 +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
9d55882ce2
Added statistics to new interface. Removed old. 2018-01-21 03:39:53 +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
J Guerreiro
479e2f0ce0
Merge pull request #97 from samosaara/master
Support for ranges when selecting packages
2018-01-18 21:02:35 +09:00
morganamilo
4da65a6a22
Fix error when no vsc_config exists 2018-01-14 20:26:30 +00:00
Samuel Henrique Oliveira da Silva
12641befac Keeping up with master
- Minor linting fixes.
2018-01-14 17:17:15 -02:00
Samuel Henrique Oliveira da Silva
d737c99c81 Excluding from installation
#ItWoksOnMyMachine
2018-01-14 16:53:37 -02:00
Samuel Henrique Oliveira da Silva
0301eb0440 Negation for upgrading 2018-01-14 15:48:16 -02:00
Jguer
62af87bb0f
Merged argument parsing system 2018-01-15 02:12:51 +09:00
Samuel Henrique Oliveira da Silva
6d2dcad091 Replicates the range functionally to upgrade 2018-01-14 14:04:15 -02:00
Samuel Henrique Oliveira da Silva
29cd864bbe Support for ranges when selecting packages
- Also, minor formatting to cmd.go
2018-01-14 13:15:32 -02:00
morganamilo
a3df41368b
Merge branch 'master' into fix#62 2018-01-07 21:59:39 +00:00
morganamilo
40a881927c
Add missing --bottomup option 2018-01-06 23:28:07 +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
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
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
Jguer
6305f86a3a
Minor polishing using gometalinter. 2017-12-04 15:24:20 +09:00
Jguer
4c7f341dd2
References #64. Added optional afterclean. Updates man page. Adds entries to --help 2017-12-04 11:39:23 +09:00
Pietro Carrara
e0050a63db Using '-' doesn't raise an error 2017-11-27 10:46:18 -02:00
Anthony Lam
ba8e3c98e7 Add -V and -h for flag parsing 2017-11-08 22:00:29 -08:00
Jguer
83e8c54caa ./yay - no longer crashes yay 2017-10-25 17:16:35 +09:00
Jguer
58ab6fd06f File closure fixed on init 2017-10-19 14:59:26 +09:00
Jguer
a46e6bfa7b Rollback on aggressive permission changes 2017-10-19 11:56:19 +09:00
Jguer
a6a0b9b441 git devel package support restored, house keeping, fixes related to config files. 2017-10-19 11:30:37 +09:00
Jguer
bc7ff1799b Github package updates are back, missing generate Database on fresh installs 2017-10-18 14:46:21 +09:00
Jguer
8fa7c4069e Resolves #57. Added Package ignoring to AUR. Handles made private. 2017-10-18 11:38:19 +09:00
Jguer
b016bf6d53 Added support for XDG_CACHE_HOME, fixes relating to file location not covered in the commit relating to #50. 2017-10-18 11:12:16 +09:00
Jguer
93de8ba9b3 Use XDG_CONFIG_HOME as default config directory instead of hardcoded when available. Fixes #50 2017-10-16 23:38:51 +09:00
Jguer
35b975a03c Fixes #45 2017-09-12 11:38:42 +09:00
jguer
226d0f89dd Flatten now compiles 2017-08-04 10:26:53 +01:00
Jguer
b4f4a42d50 Flattened architecture. Does not compile 2017-08-02 18:24:03 +01:00
Jguer
5ad1772bba Refactoring 2017-08-01 17:43:20 +01:00