Commit Graph

276 Commits

Author SHA1 Message Date
morganamilo
ff5ed12181
Parallelize pkgbuild download 2018-08-09 16:25:14 +01:00
morganamilo
08ac9036ad
Ensure AUR upgrades actually use the AUR
Yay's dependency resolving takes provides into account. When upgrading
AUR package 'foo', if a repo package provides 'foo' then yay would get
confused and pull in the package providing 'foo' instead of the AUR
package.

This commit ensures AUR upgrades always exclusively check the AUR.
2018-08-03 23:15:01 +01:00
morganamilo
4a254303c5
Don't show .SRCINFO in diffs 2018-08-02 15:21:01 +01:00
morganamilo
2a60dd7052
Remove unneeded variables 2018-07-30 14:14:16 +01:00
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
0ebaa8a750
Don't print nothing to do every time
When using nocombinedupgrade "there is nothing to do" is printed when
insinstalling repo packages. This is because as far as AUR
installer is concerned, there is nothing to do. Instead only print that
when doing a sysupgrade.
2018-07-24 00:13:34 +01:00
morganamilo
e28f4f3431
Refactor continueTask()
The main reason behind this is for future localisation. yes and no can
be set to the localized equivalent and it should just work.

This Refactor also changes the function in ways which make it much less
confusing.

The param is no longer reversed and changed to a boolean. Before you had
to pass in Yy to get a default of no and vice versa.

The function now retuens false for no and true for yes. Before it would
return true if the default option was choosen.
2018-07-23 13:49:45 +01:00
morganamilo
ec48698f35
Add --{no,ask}removemake 2018-07-21 14:20:00 +01:00
Anna
23e0064382
Merge pull request #569 from AlexWayfer/unify_output_with_pacman
Make output more similar to `pacman`s
2018-07-19 23:02:59 +01:00
Alexander Popov
900dfd1851
Make output more similar to pacmans
Before:

* Empty line after `Searching AUR`
* `There is` starts with capital letter without space before

```
> yay --combinedupgrade -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
:: Searching databases for updates...
:: Searching AUR for updates...

:: Starting full system upgrade...
 there is nothing to do

> yay --nocombinedupgrade -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
:: Starting full system upgrade...
 there is nothing to do
:: Searching databases for updates...
:: Searching AUR for updates...

There is nothing to do
```

After:

```
> yay --combinedupgrade -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
:: Searching databases for updates...
:: Searching AUR for updates...
:: Starting full system upgrade...
 there is nothing to do

> yay --nocombinedupgrade -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
:: Starting full system upgrade...
 there is nothing to do
:: Searching databases for updates...
:: Searching AUR for updates...
 there is nothing to do
```
2018-07-20 00:36:06 +03:00
morganamilo
d1146de6d5
Show tar diffs as diffs instead of editing
When looking at diffs of packages downloaded as tar achives actually
show a diff instead of opening the files in the ediror. This diff
is against /var/empty so it is not that useful. In realiy this is an
excuse to move the srcinfo parsing back down to after the git merge.

Viewing the build files in the editor requires the .srcinfos to be
parsed to know what .install files are used. Now viewing diffs does not
need the srcinfos so they can be moved to after we git merge.

Before now the srcinfo would have been of the previous version. This is
not much of a problem because we don't really use the srcinfo for much.
Checking the arch and pgpkeys which never really change.

Recently libc++ changed their pgp keys and yay missed that because it
parsed the old srcinfo without the new keys.

Viewing a proper diff for tars can be tossed on the todo by doing
something along the lines of:
	mv pkg{,.old}
	diff pkg{,.old}
	rm -rf pkg.old

But I doubt there are many people out there using tar so it's not much
of an issue.
2018-07-19 22:19:24 +01:00
morganamilo
0196a47ad2
Refactor combinedupgrade code 2018-07-19 20:43:03 +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
d4d36397fe
Show .install files with pkgbuilds when editing 2018-07-18 09:24:57 +01:00
morganamilo
f3635cd14d
Fix group installs for --nocombinedupgrade 2018-07-16 17:03:39 +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
2437937372
Show nothing to do message for nocombinedupgrade 2018-07-12 11:12:12 +01:00
morganamilo
dcaf1e5595
Fix -Y and remove debug messages 2018-07-06 15:24:03 +01:00
morganamilo
8dd0d97ae0
Properley seprate aur and repo targets.
When not doing combined upgrade the repo targets need to be extracted
for the early pacman call.
2018-07-05 22:20:18 +01:00
morganamilo
43c52c69d2
Also remove -u when not doing combined upgrade
When not doing combined upgrade we do pacman -Syu early. So there is no
need to use -u when installing repo dependencies of AUR packages.
2018-07-04 14:54:24 +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
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
9ecc604558
Reset before editing
Edits where reset via git before building packages. This allows edits to
actually effect the build package.
2018-06-12 21:08:15 +01:00
morganamilo
42f0508625
Add upgrademenu to match {clean,diff,edit}menu 2018-06-11 20:12:17 +01:00
morganamilo
01fa34093f
Support answerdiff to match answer{clean,edit} 2018-06-11 20:11:38 +01:00
morganamilo
ab38507bea
Correctly set op and ignore for repo only installs 2018-06-11 18:49:35 +01:00
morganamilo
fcb8c35046
Pass to pacman when there's no AUR packages
Instead of doing all the AUR stuff just pass to pacman and return. No
need for any of Yay's stuff when there's no AUR involved.

Of couse everything before that still happens. Upgrade menu ect.
2018-06-11 00:41:39 +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
00da26a3ce
Always show diffs for newly cloned packages
Newly cloned packages already start out at origin/master, so there is no
diff to show. Track if we cloned a package and if so make sure to show
the full diff
2018-06-10 03:41:25 +01:00
morganamilo
2b925aefa3
Lint 2018-06-10 03:21:08 +01:00
morganamilo
4f8b43cd60
Show diffs before merging
This is what 5775e3..43d2a6 has been leading up to. Git fetch will be
called on all pkgbuilds, then the user is offered a chance to view the
diffs. If they choose to continue, merging happens. This allows users to
abort the install after viewing diffs and still be able to see thoes
diffs again if they try to install later on.

This also makes the git stuff a little more modular which should help in
organzing diff showing + pkgbuild editing.
2018-06-10 03:21:08 +01:00
morganamilo
43d2a6601a
Split pkgbuild downloading and merging 2018-06-10 03:18:50 +01:00
morganamilo
73bd713217
Split hash fetching and pkgbuild downloading 2018-06-10 03:17:59 +01:00
morganamilo
1b8d9317e4
Split pkgbuild downloading and up to date checks 2018-06-10 03:17:28 +01:00
morganamilo
5775e3c0b7
Split git clone/pull and merge function 2018-06-10 03:17:23 +01:00
morganamilo
64ab60f4b4
Print true pkgver when skipping build 2018-06-05 14:49:18 +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
Anna
bd162cc317
Merge pull request #454 from Morganamilo/makepkg
Stop prepare running twice
2018-06-02 15:23:51 +01:00
morganamilo
942e389d85
Stop prepare running twice
Prepare ends up getting ran twice every time we install a package,
theres not problems with doing so apart from a little inefficiency.

Previously the install flow would be like this:
	downlod sources + verify
	prepare + pkgver bump
	full build (prepare included)

Now on the last point pass no extract to use the srcdir from the
previous command and pass noprepare and holdver because we allready did
these steps previously.
2018-06-02 14:16:00 +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
9afd671905
Support any PKGDEST and PKGEXT
Pacman 5.1 removes the symlink to the current directory for built
packages. This causes Yay to break for people who have set an external
PKGDEST.

Pacman 5.1 also brings an improved --packagelist option. This makes
it much simpler to find where packages will be placed. Hence this fix
also simplifies the code.

Yay has an -Sc option to clear it's cache. If using an external PKGDEST
this is now mostly useful for clearing out old pkgbuilds and sources.
paccache should be used for cleaning build packages.
2018-05-31 05:42:03 +01:00
morganamilo
7a1e2de6cd
Simplfy upgrade skipping 2018-05-30 03:21:17 +01:00
morganamilo
e76f978d63
Only show warnings for pkgs that are being updated
The previous warning system would show warnings recursivley for all
packages being resolved. While I like this, other have complained at it
being overly verbose.

Either way the main purpose of this is to allow warnings to be printed
before the upgrade menu shows. This is mostly just to get a usable
warning system.

This may change if a better solution is found.
2018-05-29 23:39:02 +01:00
morganamilo
b140e66f6a
Improve --asdeps and --asexplicit handling
Correctly handle --asdeps and --asexplicit for both repo packages and
aur packages.
2018-05-29 22:35:58 +01:00
morganamilo
33d056e9ac
Split Targets to Targets and Explicit
Targets are used for tracking wether a package should be marked as
explicitly installed or as a dependency. This is not ideal because you
can have a target such as java-environment that resolves to a different
package.

Therefore Targets are now used only for the initial dependency resolving
and checking for missing dependencies. The Explicit set is now used to
mark what packages are explicit, seperate from the targets.
2018-05-29 16:47:43 +01:00
morganamilo
d51205194e
Support skiping updates and showing warnings
The warnings were moved down to after the upgrade menu, mainly because
it is a lot easier to do this way, it may get moved back if it can be
done in a non hacky way,
2018-05-29 13:15:40 +01:00
morganamilo
b76d085418
Improve provider menu
Sort the provider menu alphabetically. Always ensure direct matches show
up first. This ensures hitting enter for the default value will always
be the same package that the user/dependency requested if an exact match
exists.

If a package is already installed pick that instead of providing a menu.

Ensure duplicates do not show up in the menu.
2018-05-29 13:13:33 +01:00
morganamilo
671f836ec5
Calculate makeDeps properly
MakeOnly would be set to true when moving from normal deps to make deps
But would incorrectly stay set to true when moving to the deps of the
following packages.

depOrder.Aur now only holds one package from each base like
depCatagories does.
2018-05-29 13:13:33 +01:00
morganamilo
2e7a022b7c
Use new dependency code in install()
The old depTree and depCatagories has been changed to depPool and
depOrder in the install function.
2018-05-29 13:13:33 +01:00
J Guerreiro
0c49f0f7cb
Merge pull request #419 from Jguer/impgopkgchange
Implement new gopkgbuild Newer method
2018-05-15 12:48:39 +01:00
Jguer
3dc5238bd2 Implement new gopkgbuild Newer method
Signed-off-by: Jguer <me@jguer.space>
2018-05-14 22:22:47 +01:00
Jguer
d15f899809 Fixes #417
Signed-off-by: Jguer <me@jguer.space>
2018-05-14 18:33:48 +01:00
morganamilo
1b6d80f122
Fix --ignore flag while skipping updates ammended
Ammend to 58d53b1
Thought this was already included in the commit.
2018-05-12 00:24:47 +01:00
morganamilo
2bf310d37c
Fix --ignore flag while skipping updates
If --ignore was specified on the command line and the user skips
packages using the number menu, packages would not be properly skipped
because they the manual --ignore would overide the --ignore from the
menu.

Now correctly combine both --ignore flags into a single combined flag
when passing to pacman.
2018-05-12 00:17:10 +01:00
morganamilo
5e712b221e
Add missing --ignorearch arg to makepkg call 2018-05-10 21:02:03 +01:00
Jguer
66362aa981 Bump MAJOR_VERSION
This bump reflects the big change introduced with using git cloning.
Therefore we know all versions pre-6 do not use git clone

Signed-off-by: Jguer <me@jguer.space>
2018-04-26 20:53:34 +01:00
Tom Swartz
1c9715dddf Fix typos 2018-04-23 13:06:56 -04:00
morganamilo
8ccb5de6ac
Prefix aur/ to aur updates 2018-04-17 19:54:44 +01:00
morganamilo
63471b9ede
Fix misspellings and typos 2018-04-17 18:01:34 +01:00
morganamilo
110a905a0c
Use filepath.Join() for adding paths together 2018-04-17 01:32:31 +01:00
Jguer
0216b116f4 Fix typos and lint
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
694c74f5b4
Remove no longer needed function and lint 2018-04-16 00:18:01 +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
J Guerreiro
aa649d9b41
Merge pull request #349 from Morganamilo/fix#331
Lots of formatting tweaks
2018-04-12 15:40:22 +01:00
morganamilo
ac571d314a
Support entering package name during askCleanEdit 2018-04-12 13:01:54 +01:00
morganamilo
c75bfe4947
Ask if user wants to contunue right after askedit 2018-04-11 20:23:43 +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
morganamilo
906748ebde
Don't mark repo upgrades as deps during sysupgrade
Before `yay -Syu` called `pacman -Sy <pkgs to upgrade>`
We then later switched to it calling `pacman -Syu` this lead to yay
seeing no targets to when it was upgrading a bunch of packages it
assumed they must be deps. Correct this by adding repo packages to the
targets list.

Also ensure we dont mark packages as dependencies if they are already
installed. For example we install `foo` which requires `bar>5` but we
only have `bar=4` installed. In this case installing `foo` will pull bar
in as a dependency but it should not be marked as such because it
already exists.
2018-04-11 05:35:44 +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
072e8e6189
Fix number menu 2018-04-05 14:10:30 +01:00
morganamilo
a33414b723
Repect --answer* flags when --noconfirm is set
This means that menus are now printed in noconfirm mode, I don't see
this as a problem because Pacman still prints its questions during
noconfirm.

When the user has edited pkgbuilds Yay will prompt if they want to
continue with the intall. This prompt is also enabled during noconfirm
to ensure the user is happy with the pkgbuilds.
2018-04-04 22:22:33 +01:00
morganamilo
00a1baf509
Fix number menu 2018-04-04 21:54:03 +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
b8ef531b76
Strip request targets instead of making a new one 2018-04-03 17:48:56 +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
morganamilo
e5c99778df
Strip db prefix from request targets 2018-04-02 17:50:04 +01:00
morganamilo
ed964bf04d
Try alpmArch and any when looking for built pkgs.
Instead of trying to figure out if the package is of arch any just try
both.
2018-04-02 14:56:07 +01:00
J Guerreiro
5b7daa129a
Merge pull request #302 from Morganamilo/fix#287
Only pass needed upgrades to deptree
2018-04-02 12:48:53 +02:00
Jguer
307daf32e7 Rename functions to more standard go form and typo fix some variables 2018-04-01 19:54:33 +02:00
morganamilo
a04dd94282
Only pass needed upgrades to deptree
To know what AUR packages need updating a rpc request is needed for all
packages. The dep tree is designed to cache everything to minimize the
amount of rpc requests. The downside of this is the dep tree ends up
with all sorts of packages in cache that it doesn't need. Then the
deptree tries to resolve deps for all of thoes packages.

By spliting the sysupgrade from the dep tree this stops this from
happening, it uses one more rpc request but also may lower the amount of
total rpc requests needed lated on.

This fixes a couple of tiny bugs such as triggering providers prompts
and printing AUR out of date messages for packages that are not going
to be installed.

This also fixes another display bug where repo packages from -Su would
not apear when printing the packages to be installed under [Repo].
2018-03-29 19:05:38 +01:00
J Guerreiro
85238c2a93
Merge pull request #277 from Morganamilo/gendb
Separate gendb from install
2018-03-25 18:04:36 +02:00
morganamilo
2b9437741e
Handle db/name with --redownload and similar flags
--redownload is meant to only download the targets the user provides.
If the user enters aur/foo then Yay will find the package foo from the
aur, --redownload will see thats not what the user entered and skips the
download.

This makes it so after the dep searching is done, all db/ prefixes are
dropped.
2018-03-23 17:07:20 +00:00
morganamilo
1e01eafb43
Separate gendb from install 2018-03-22 18:23:20 +00:00
morganamilo
2ea16836eb
Fix nothing to do if upgrading only repo packages
Dont display clean/edit menu when upgrading only repo packages.
2018-03-22 17:12:33 +00:00
morganamilo
0c0cd4f883
Add utils.go 2018-03-22 16:38:21 +00:00
Morgana
ac02498177
Merge pull request #269 from Morganamilo/conflicts
More conflict checking
2018-03-22 15:27:39 +00:00
morganamilo
a1a05bced4
Don't mark targets as dependencies 2018-03-22 15:22:05 +00:00
morganamilo
4a8ec944bf
Move conflict checking to its own file 2018-03-22 07:19:25 +00:00
morganamilo
804bd45f2c
More conflict checking
This commit extends the conflict checking a lot, it adds support for:
	Conflicting with provides as well as actual package names
	Reverse conflicts
	Inner conflicts

Both normal conflicts and inner conflicts are run in parallel.
Messages are now printing when checking conflicts.

This also fixes packages sometimes being listed as conflicting with
themselves.

The inner conflict is a little verbose and could be toned down a little
but I am insure exactly how to tone it down.
2018-03-22 07:18:58 +00:00
morganamilo
98ea801004
Pass -Su to pacman during sysupgrade
Previosly during `yay -Su` Yay would pass
`pacman -S <packages that need upgrade>` to pacman.

Instead pass `pacman -Su --ignore <number menu choices>`

This allows yay to handle replaces and package downgrades `-Suu`
2018-03-22 07:13:18 +00:00
morganamilo
885614ef45
Move repo install to after numbermenus 2018-03-21 00:45:26 +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
4bcd3a6297
Handle pkgbuilds with an unsupported arch
When pkgbuilds are built by makepkg, if the pkgbuild's arch=() array
does not include the current carch set in makepkg.conf, makepkg will
fail to build the package.

Now, Yay detects if a pkgbuild does not support the arch set in
pacman.conf Yay will ask the user about this and ask them if they want
to build anyway, passing `--ignorearch` to makepkg.`

Note that Yay will check against the arch set in pacman.conf which is
what pacman uses to only allow installs of package of that arch. makepkg
will still use carch set in makepkg.conf to build packages. These two
values are expected to be the same otherwise Yay will fail.

The on disk .srcinfo is needed for this as the user should be asked pre
source download. This and pgp checking both use the on disk .srcinfo so
it is no longer a one off. Store the 'stale' srcinfos so they can be
accesed by both functions.
2018-03-19 19:24:51 +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
a5b5cc38ee
Remove unused functions after #227
After #227, the following functions became unused, so remove them:
- askCleanBuilds
- askEditPkgBuilds
2018-03-19 11:28:46 -04:00
morganamilo
e09752c23d
Be more exact when looking for cached packages
Instead of looking for `pkgname-pkgver-pkgrel*`
Look for `pkgname-pkgver-pkgrel-arch.pkg*` using the arch set in goalpm.
2018-03-19 10:53:40 +00: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
7eea7eb9b5
Fix and improve version checking
Fix typo where adding to has instead of depStrings

Error correcly when missing packages

Also handle cases where a package is provided multiple times. If one
package provies `foo=1` and another provides `foo=2` before the latter
would just overide the former version. Now both versions will be checked
against.
2018-03-17 02:09:17 +00:00
Morgana
4c4737d952
Merge pull request #247 from Morganamilo/versions
Check versioned deps during the dep fetching process
2018-03-17 00:40:43 +00:00
morganamilo
158b80c5bc
Fix updating of vsc packages
With the addition of pgp key checking in Yay, the srcinfo parsing was
moved to before the pkgver() bump, leading to outdated pkgbuild
information.

Srcinfo parsing must be done after the pkgver() bump
The pkgver() bump must be done after downloading sources
makepkg's PGP checking is done as the sources download
yays PGP importing requires the srcingo to be parsed

Quite the chicken and egg problem

It is possible to skip the integ checks after the sources download
then parse the srcinfo
do the yay PGP check
then run the integ checks

the problem here is that to generate the srcinfo `makepkg --printsrcingo` is ran
This causes the pkgbuild to be sourced which I am not comftable with
doing without the integ checks.

Instead we parse the on disk .SRRCINFO that downloads with the PKGBUILD
just for the PGP checking. Later on we parse a fresh srcinfo straight
from `makepkg --printsrcingo`. This is a little bit less efficient but
more secure than the other option.
2018-03-17 00:10:38 +00:00
morganamilo
fae0c506cc
Support db/name for groups 2018-03-16 01:14:34 +00: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
69a86c6a78
Check versioned deps during the dep fetching process
Check versioned deps such as `foo>1` `foo=2` `foo<3`
2018-03-15 17:05:17 +00:00
J Guerreiro
e0b8c92433
Merge pull request #243 from Morganamilo/rebuild2
Add --rebuild flag
2018-03-15 09:40:37 +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
morganamilo
de29fc1b0f
Error when installing AUR packages as root 2018-03-14 13:08:04 +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
Sergio Correia
6f25da860c Ask if yay should try to import missing PGP keys
When building a package from the AUR for which there are missing keys,
yay will now prompt the user whether it should try to import such keys
using gpg:

[...]
:: Parsing SRCINFO (1/3): libc++ (libc++abi libc++)
:: Parsing SRCINFO (2/3): aurutils
:: Parsing SRCINFO (3/3): cower
==> GPG keys need importing:
        487EACC08557AD082088DABA1EB2638FF56C0C53, required by: cower
        11E521D646982372EB577A1F8F0871F202119294, required by: libc++ (libc++abi libc++)
        B6C8F98282B944E3B0D5C2530FC3042E345AD05D, required by: libc++ (libc++abi libc++)
        DBE7D3DD8C81D58D0A13D0E76BC26A17B9B7018A, required by: aurutils
==> Import?  [Y/n]
[...]

Default is to try to import the problematic keys ([Y/n]).
2018-03-12 17:11:31 -04:00
Jguer
e86e39a21d Add left padding to number menu
Signed-off-by: Jguer <me@jguer.space>
2018-03-12 21:01:53 +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
f7abb1b0ac
Use numbermenu for cleanBuilds and editPkgbuilds 2018-03-11 18:14:16 +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
fd95855a49
Fix group installs 2018-03-07 16:42:26 +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
1597fb1cf0
Fix Yay showing AUR prompts when it shouldnt
In a very specific case where the user runs `yay -Syu` then uses the
number menu to ignore all AUR upgrades after the Repo install the user
will still be prompted to install and download packages.
2018-03-03 04:14:35 +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
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
morganamilo
0b6e4e0872
Correctly mark packages as dependencies
Previously Installing repo targets and repo dependencies of aur targets
was done in two steps.

doing `yay -S repo1 repo2 aur1 aur2` would lead to yay calling
`pacman -S repo1 repo2`. Then after we find all the dependencies of the
aur packages we call `pacman -S --asdeps <all repo dependencies>`. This
was an easy way to correctly mark dependencies. Since 005635b4 Both
these calls were merged into one command but dependency marking was
forgoten about.

Now correctly mark the dependencies through `pacman -D`
2018-02-28 15:29:54 +00:00
morganamilo
695927c4cd
Abort if editor does not return 0
This allows the user to abort the install by telling the editor to exit
with a non zero status. e.g. `:cq` in vim. This should also catch errors
if the editor does actually fail or if the configured editor does not
exist.
2018-02-28 11:39:19 +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
morganamilo
04a9830e0b
Fix tests 2018-02-27 03:41:39 +00:00
morganamilo
4cdcdc30e9
Further formatting tweaks
Ask clean builds is now asked early and remembers what you choose when
the install finishes.
Fixup "there is nothing to do" message.
2018-02-27 02:52:06 +00:00
morganamilo
4ef282c54e
go fmt 2018-02-27 02:02:33 +00:00
morganamilo
31d6a95c2a
Tweak some of the printting and fix formatting 2018-02-27 02:02:33 +00:00
morganamilo
b50fae1dd4
Reword conflicting package message
The old message was probably easy to confuse with the `replaces` term.
2018-02-27 02:02:33 +00:00
morganamilo
deed5e6794
Fix yay not installing repo deps properly 2018-02-27 02:02:33 +00:00
morganamilo
e015c612d8
Remove -s from makepkg
The -s was kept aroung because the package base `python-virtualfish`
failed to build without it. I first blamed this on some aur rpc bug
because it was missing some deps that were listed in python-virtualfish.
As is turned out python-virtualfish actually does some things wrong in
it's package build and if it was formated correctly this wouldnt be
a problem.

I kept the -s in just so it would build even though it might have had
some side affects. makepkg not respecting the --dbpath for example.

From now on python-virtualfish will fail to build when you dont have all
the deps installed. This is their fault and will not be fixed here.
2018-02-27 02:02:33 +00:00
morganamilo
2f39f5ddc4
Only print "querying aur" when using the aur 2018-02-27 02:02:33 +00:00
morganamilo
dab8f1b5d2
Improve gendb and formatting
Exit after parsing srcinfo with db do it actually does something.
when using gendb dont bother generating srcinfos.
Improved the formatting for some things mainly downloading and parsing.
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
7558f8fcf8
Use aurInfo for -S and -Su
This also improves the dependency by switching to stringSets for some
structures that previously contained duplicates.
2018-02-27 02:02:33 +00:00
morganamilo
4350752e32
Give error when failing to parse .SRCINFO
Instead of panicking later on.
2018-02-18 15:39:04 +00:00
morganamilo
e88bf0f5b7
Improve conflict handling
Renable conflict checking, was disabled for testing, forgot to reenable
Use pacman --ask to remove conflicting packages, dont do it directly.
Say what each package conflicts with
Check for conflicts before aking for clean build

Reverse conflict are still not checked
2018-02-16 22:39:46 +00:00
Jguer
433f5b6ce1
Apply linting to patch 2018-02-16 17:18:59 +00:00
morganamilo
03295c3f3f
Install repo deps for aur packages after questions 2018-02-16 15:50:54 +00:00
morganamilo
cdaee7d1d4
Improve support for split packages
Split packages are now grouped together when printing displaying the
package base and the packages inside of the base to beinstalled. If only
one packge is to be installed from a base and the package name matches
the base name print normally

Only build and install once per package base

Only ask questions once per package base for editing pkgbuils and clean
build
2018-02-16 15:49:18 +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
morganamilo
e61263ff96
Install repo deps for aur packages at the start
Install all deps for aur packages after the user confirms they want to
continue installing. This takes most of the load off of makepkg -s but
the -s is still left in for some edge cases with split packages.
2018-02-15 21:41:49 +00:00
morganamilo
f58421953b
Skip build if package is already built in cache 2018-02-15 21:41:49 +00:00
morganamilo
8c3c125900
Bump pkgver before parsing .SRCINFO 2018-02-15 21:41:49 +00:00
morganamilo
83491069d3
Split .SRCINFO parsing to its own function 2018-02-15 21:41:49 +00:00
morganamilo
ad898b2d33
Regenerate .SRCINFO if editing the PKGBUILD 2018-02-15 21:41:49 +00:00