Compare commits

...

1788 Commits
v4.505 ... next

Author SHA1 Message Date
dependabot[bot]
6f3bc5cc4c
chore(deps): bump golang.org/x/net from 0.40.0 to 0.41.0 in the go-all group (#2632)
chore(deps): bump golang.org/x/net in the go-all group

Bumps the go-all group with 1 update: [golang.org/x/net](https://github.com/golang/net).


Updates `golang.org/x/net` from 0.40.0 to 0.41.0
- [Commits](https://github.com/golang/net/compare/v0.40.0...v0.41.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.41.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-all
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-11 15:38:14 +02:00
dependabot[bot]
c2caf9c7d7
chore(deps): bump github.com/leonelquinteros/gotext from 1.7.1 to 1.7.2 in the go-all group (#2629)
chore(deps): bump github.com/leonelquinteros/gotext in the go-all group

Bumps the go-all group with 1 update: [github.com/leonelquinteros/gotext](https://github.com/leonelquinteros/gotext).


Updates `github.com/leonelquinteros/gotext` from 1.7.1 to 1.7.2
- [Release notes](https://github.com/leonelquinteros/gotext/releases)
- [Commits](https://github.com/leonelquinteros/gotext/compare/v1.7.1...v1.7.2)

---
updated-dependencies:
- dependency-name: github.com/leonelquinteros/gotext
  dependency-version: 1.7.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-all
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-04 23:45:08 +02:00
transifex-integration[bot]
8615239329
Updates for file po/en.po in zh_CN (#2628)
Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-05-28 14:07:22 +02:00
transifex-integration[bot]
c9a8507654
Updates for file po/en.po in ko (#2626)
* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-05-27 14:59:55 +02:00
dependabot[bot]
75e90c3a6d
chore(deps): bump the go-all group with 2 updates (#2622)
Bumps the go-all group with 2 updates: [golang.org/x/net](https://github.com/golang/net) and [golang.org/x/term](https://github.com/golang/term).


Updates `golang.org/x/net` from 0.39.0 to 0.40.0
- [Commits](https://github.com/golang/net/compare/v0.39.0...v0.40.0)

Updates `golang.org/x/term` from 0.31.0 to 0.32.0
- [Commits](https://github.com/golang/term/compare/v0.31.0...v0.32.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.40.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-all
- dependency-name: golang.org/x/term
  dependency-version: 0.32.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-all
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-27 12:15:33 +02:00
Jo
8ab3652846
Fix locale initialization logic (#2619)
* Fix locale initialization logic

* add comment

* Update main.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update GitHub Actions workflow for testing

* Update GitHub Actions workflow to allow artifact overwrite

* Update GitHub Actions workflow to allow artifact overwrite

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-06 18:16:47 +02:00
dependabot[bot]
98be3fec97
chore(deps): bump golang.org/x/sys from 0.32.0 to 0.33.0 in the go-all group (#2620)
chore(deps): bump golang.org/x/sys in the go-all group

Bumps the go-all group with 1 update: [golang.org/x/sys](https://github.com/golang/sys).


Updates `golang.org/x/sys` from 0.32.0 to 0.33.0
- [Commits](https://github.com/golang/sys/compare/v0.32.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-version: 0.33.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-all
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-06 18:08:17 +02:00
Jo
c6a2226ce1
add locale tooling (#2618) 2025-05-01 22:07:39 +00:00
transifex-integration[bot]
3e82496057
Updates for file po/en.po in hu (#2617)
* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-05-01 23:08:02 +02:00
Jo
a26ac1ba95
Add SECURITY.md with contact and supported version policy (#2616)
* docs: add SECURITY.md with contact and supported version policy

* fix image render
2025-05-01 08:18:31 +00:00
Jo
b745f87210
chore(ci): update golangci lint v2.1.5 (#2615)
* chore(ci): update golangci-lint to v2.1.5 in ci.Dockerfile

* add golangci

* fix lint

* fix lint pkg/upgrade

* reenable lint
2025-05-01 10:00:10 +02:00
dependabot[bot]
b4a41700ee
chore(deps): bump golang.org/x/net from 0.38.0 to 0.39.0 (#2609)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.38.0 to 0.39.0.
- [Commits](https://github.com/golang/net/compare/v0.38.0...v0.39.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.39.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-01 09:58:03 +02:00
dependabot[bot]
0aa80e521e
chore(deps): bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#2612)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-version: 1.10.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-01 09:55:03 +02:00
Jo
bce9f2fc72
Update dependabot.yml (#2614) 2025-05-01 09:54:47 +02:00
dependabot[bot]
5a71db2526
chore(deps): bump github.com/deckarep/golang-set/v2 from 2.7.0 to 2.8.0 (#2611)
Bumps [github.com/deckarep/golang-set/v2](https://github.com/deckarep/golang-set) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/deckarep/golang-set/releases)
- [Commits](https://github.com/deckarep/golang-set/compare/v2.7.0...v2.8.0)

---
updated-dependencies:
- dependency-name: github.com/deckarep/golang-set/v2
  dependency-version: 2.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-01 08:40:49 +02:00
dependabot[bot]
535370bca0
chore(deps): bump golang.org/x/term from 0.30.0 to 0.31.0 (#2613)
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.30.0 to 0.31.0.
- [Commits](https://github.com/golang/term/compare/v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-version: 0.31.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-01 08:37:38 +02:00
Jo
9a3be07887
Create dependabot.yml (#2608)
* Create dependabot.yml

* Update dependabot.yml

* Update dependabot.yml
2025-04-30 21:49:38 +00:00
Jo
2f205ee96c
chore(ci): update golangci-lint to v2.1.5 in ci.Dockerfile (#2607) 2025-04-30 21:45:29 +00:00
Jo
1982ce0366
chore(devcontainer): add devcontainer for clean builds (#2606)
chore(devcontainer): set up passwordless sudo for docker user for clean development and testing
2025-04-30 23:08:02 +02:00
Jo
2dcf94544c
refactor(build): optimize allocations and add tests (#2601)
* perf(build): optimize map/slice allocations and use strings.Builder

* test(build): add tests for parsePackageList
2025-04-29 22:45:24 +02:00
Ferdinand Bachmann
95fc0938fd
fix(installer): Fix the same pkgbase being built multiple times on error (#2561)
fix(installer): Fixes the same pkgbase being built multiple times on error

The previous fix commit ec837c8 failed to address the case where the
build fails, as packages are only added to builtPkgDests on a successful
build. This commit addresses this by adding the package to the map earlier.

Fixes #2560.
2025-04-29 22:45:10 +02:00
transifex-integration[bot]
ff176c0dd2
Updates for file po/en.po in hu (#2605)
* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-04-28 10:17:56 +02:00
Jo
bf315041b1
refactor(upgrade): optimize code and improve maintainability (#2600)
* refactor(upgrade): reduce code duplication in Print methods and fix typo in Filter documentation

* refactor(upgrade): optimize UserExcludeUpgrades with early return and simplify GraphUpgrades function
2025-04-24 12:06:27 +02:00
dependabot[bot]
559bc06b31
chore(deps): bump golang.org/x/net from 0.37.0 to 0.38.0 (#2598)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.37.0 to 0.38.0.
- [Commits](https://github.com/golang/net/compare/v0.37.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.38.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-17 11:41:44 +02:00
transifex-integration[bot]
35019f95b6
Updates for file po/en.po in nl (#2592)
* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-03-20 15:11:04 +01:00
transifex-integration[bot]
50cbf70bf4
Updates for file po/en.po in zh_TW (#2591)
* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-03-20 15:10:57 +01:00
Jo
0b5f5f0ccd
fix(main): return 1 exit code on panic (#2590) 2025-03-09 22:59:50 +01:00
Jo
a300330b94
fix(ci): prefer ghcr image (#2589)
prefer ghcr image
2025-03-09 22:50:58 +01:00
Jo
670598912e
fix: correct Docker manifest creation in builder image workflow (#2588)
* fix: correct Docker manifest creation in builder image workflow

- Fix "invalid reference format" error by properly separating Docker Hub and
  GitHub Container Registry tags
- Use short SHA format instead of long format for more manageable tags
- Improve manifest list creation process to handle multiple registries correctly
- Ensure proper handling of ghcr.io prefix for GitHub Container Registry

* update golangci and comment out community
2025-03-09 22:20:50 +01:00
Jo
257b230e39
chore(yay): update deps (#2587)
update deps
2025-03-09 20:45:10 +01:00
Jo
d2c67ae0a4
fix(yay): fix minor performance and safety issue (#2581) 2025-02-25 17:15:34 +01:00
Jo
4432c60246 fix(ci): fix issue with builder image CI 2025-02-20 17:16:35 +00:00
Jo
33ba07fe0d
fix(yay): update go mod (#2580)
update go mod
2025-02-17 15:54:21 +01:00
Dominik Link
d37e365ac3
fixed issue #2471 where it wouldn't show info when packages are in a group (#2576)
fixed issue #2471 where it wouldn't show info when packages are in a group and modified test
2025-02-17 15:28:35 +01:00
transifex-integration[bot]
6807ecc081
Updates for file po/en.po in zh_TW (#2571)
* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

* Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-02-14 14:36:32 +01:00
transifex-integration[bot]
b07d8c1447
Updates for file po/en.po in de (#2572)
Translate po/en.po in de

100% translated source file: 'po/en.po'
on 'de'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-02-14 14:36:13 +01:00
transifex-integration[bot]
3da808847f
Updates for file po/en.po in ru_RU (#2574)
Translate po/en.po in ru_RU

100% translated source file: 'po/en.po'
on 'ru_RU'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-02-05 12:01:03 +01:00
transifex-integration[bot]
590a3d3a8c
Updates for file po/en.po in ru (#2575)
Translate po/en.po in ru

100% translated source file: 'po/en.po'
on 'ru'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-02-05 12:00:33 +01:00
Ikko Eltociear Ashimine
69685d0fb5
docs: update README.md (#2564)
minor fix
2025-01-23 14:42:52 +01:00
transifex-integration[bot]
5572d1817e
Updates for file po/en.po in zh_TW (#2569)
Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-01-15 11:11:08 +01:00
transifex-integration[bot]
2f403a4f28
Updates for file po/en.po in zh_CN (#2568)
* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-01-15 11:09:49 +01:00
transifex-integration[bot]
9322197d0c
Updates for file po/en.po in ca_ES (#2556)
Translate po/en.po in ca_ES

100% translated source file: 'po/en.po'
on 'ca_ES'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-01-03 16:06:02 +01:00
transifex-integration[bot]
46f3842e6f
Updates for file po/en.po in ca (#2555)
Translate po/en.po in ca

100% translated source file: 'po/en.po'
on 'ca'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-01-03 14:55:04 +01:00
transifex-integration[bot]
76000ae987
Updates for file po/en.po in fr (#2557)
* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-01-03 14:54:45 +01:00
transifex-integration[bot]
e27979d21d
Updates for file po/en.po in fr_FR (#2558)
* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2025-01-03 14:54:16 +01:00
transifex-integration[bot]
c0baacd633
Updates for file po/en.po in sv (#2559)
Translate po/en.po in sv

100% translated source file: 'po/en.po'
on 'sv'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-12-30 10:57:45 +00:00
transifex-integration[bot]
43567b5d85
Updates for file po/en.po in it_IT (#2548)
Translate po/en.po in it_IT

100% translated source file: 'po/en.po'
on 'it_IT'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-12-23 14:22:27 +00:00
transifex-integration[bot]
e18cc87307
Updates for file po/en.po in hu (#2549)
Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-12-23 14:22:06 +00:00
transifex-integration[bot]
81a2a19101
Updates for file po/en.po in id (#2550)
Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-12-22 15:28:42 +00:00
transifex-integration[bot]
669d7af6d1
Updates for file po/en.po in nl (#2551)
Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-12-22 15:27:33 +00:00
transifex-integration[bot]
65ce4b9f6f
Updates for file po/en.po in pt (#2553)
Translate po/en.po in pt

100% translated source file: 'po/en.po'
on 'pt'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-12-22 15:27:04 +00:00
transifex-integration[bot]
5f2b94ce7c
Updates for file po/en.po in pt_BR (#2552)
* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-12-22 15:26:31 +00:00
dmitrodem
3f2f6eae31
socks5 support (#2543)
* socks5 support

socks5 support via environment variable, e.g. SOCKS5_PROXY=localhost:1080 yay ...

* use default transport and update tests to work on arm
2024-12-20 16:49:05 +00:00
scarf
da53d3855f
fix: use positional argument for "providers available" translation (#2537) 2024-12-20 16:43:28 +00:00
Matthias Kurz
f23fe98a66
Fix comments: AUR_SEEN is the correct name (#2535)
Fix comments: AUR_SEEN is the correct name
2024-11-21 12:00:11 +01:00
Ferdinand Bachmann
ec837c831d
fix(installer): Fixes the same pkgbase being built multiple times (#2534)
* fix(installer): Fixes the same pkgbase being built multiple times

When building a PKGBUILD pkgbase with multiple pkgnames,
installAURPackages() invokes buildPkg() multiple times for the same
pkgbase. This causes prepare() to be run multiple times for the same
pkgbase, since detection of already built packages happens after
prepare().

Additionally, detection of already built packages can fail if the split
debug packages are enabled and the package does not contain any
binaries, causing no -debug package to be created by makepkg even though
it is listed by makepkg --packagelist.

This commit fixes this by keeping track of the pkgdests built by
buildPkg() and avoiding rebuilds of the same pkgbase in the same yay
invocation.

Fixes #2340.

Signed-off-by: Ferdinand Bachmann <ferdinand.bachmann@yrlf.at>

* fix(installer): Fixes buildPkg() isTarget param being order-dependent

Previously, the buildPkg invocation for a pkgbase only considered
whether the current pkgname is part of installer.origTargets. This made
the decision whether to rebuild the package order-dependent.

This commit fixes this by keeping track of which pkgbases are part of
installer.origTargets and rebuilding the pkgbase if any of its pkgnames
is part of origTargets.

* fix(tests): Test that installing split packages avoids rebuilds

The previous two commits changed how split packages (packages with the same
pkgbase) are built, ensuring that those packages aren't built multiple
times.

This commit updates the lists of commands that the tests expect to be
run so that `makepkg` isn't run multiple times per pkgbase.

---------

Signed-off-by: Ferdinand Bachmann <ferdinand.bachmann@yrlf.at>
2024-11-19 11:08:28 +01:00
transifex-integration[bot]
f100c1d54b
Updates for file po/en.po in uk (#2533)
Translate po/en.po in uk

100% translated source file: 'po/en.po'
on 'uk'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-11-15 14:52:12 +01:00
April Hall
3f5d26c4f9
Replace "⚠️ {warning}" with Github Warning Blocks (#2531)
Update README.md
2024-11-12 20:03:03 +00:00
Alice Jacka
3003f1667c
Add missing sudo to binary install instructions (#2525) 2024-10-25 11:12:49 +02:00
Anmol W
fb168fb176
fix swapped fish completion descriptions for --repo and --aur (#2523)
fix swapped fish completions for --repo and --aur
2024-10-25 10:35:07 +02:00
transifex-integration[bot]
842067256b
Updates for file po/en.po in id (#2522)
* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

* Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-10-25 10:30:32 +02:00
transifex-integration[bot]
a6a6dc0acb
Updates for file po/en.po in hu (#2521)
* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-10-25 10:30:21 +02:00
transifex-integration[bot]
2e06552211
Updates for file po/en.po in zh_CN (#2524)
* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-10-25 10:30:11 +02:00
transifex-integration[bot]
138c2dd6cd
Updates for file po/en.po in sk (#2516)
Translate po/en.po in sk

100% translated source file: 'po/en.po'
on 'sk'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-09-30 09:32:30 +02:00
transifex-integration[bot]
4872b8b829
Updates for file po/en.po in pl_PL (#2513)
Translate po/en.po in pl_PL

100% translated source file: 'po/en.po'
on 'pl_PL'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-09-27 10:33:58 +02:00
transifex-integration[bot]
1b6ad7b305
Updates for file po/en.po in hu (#2512)
Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-09-27 10:33:51 +02:00
transifex-integration[bot]
d6e961af70
Updates for file po/en.po in pl (#2514)
Translate po/en.po in pl

100% translated source file: 'po/en.po'
on 'pl'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-09-27 10:33:41 +02:00
Jo
89b32ee9ce
fix(parser): allow disable-sandbox option. fixes #2509 (#2511) 2024-09-24 08:12:41 +00:00
transifex-integration[bot]
f68a57129f
Updates for file po/en.po in hu (#2510)
* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-09-24 09:57:49 +02:00
Absobel
bea53a4a09
fix: added missing spaces (#2386) 2024-09-19 14:15:44 +02:00
Rodrigo Barrios
13df7e79eb
Document -Ycc in manpage (#2482)
Signed-off-by: r.b4rr10s <rodrigoedu11@gmail.com>
2024-09-19 14:14:16 +02:00
Tim Konick
0f496c9af9
Fixes syntax error #2506 (#2507)
* Fixes syntax error

* Use escape-chars instead
2024-09-18 07:46:51 +00:00
Jo
84d8f1b7b3
chore: update default po (#2505)
update default po
2024-09-17 16:50:02 +00:00
Jo
3a118b7690
chore: fix failing build actions (#2503) 2024-09-17 17:14:26 +02:00
transifex-integration[bot]
a32f5e7e2c
Updates for file po/en.po in nl (#2504)
* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-09-17 14:01:14 +02:00
Oliver Tzeng
3c881d577f
fix(zh_TW.po): fixed a lot of simplified chinese (#2498)
- Changelog
 * Added myself as the initial translator, got removed for some
   reason(#1776)
 * Converted simplified to traditional Chinese
 * Formatting
2024-09-14 17:52:30 +02:00
transifex-integration[bot]
86f5c08ec4
Updates for file po/en.po in he (#2491)
* Translate po/en.po in he

100% translated source file: 'po/en.po'
on 'he'.

* Translate po/en.po in he

100% translated source file: 'po/en.po'
on 'he'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-09-14 17:20:59 +02:00
Stephan Burns
675f0ba3f3
Add sudo to install instructions so it can be run without user switching (#2483)
* Add sudo to install instructions so it can be run without user switching

* Add sudo to one liner and a note for people using different root tools
2024-09-02 15:21:57 +02:00
transifex-integration[bot]
d7d67e3fd3
Updates for file po/en.po in hu (#2490)
* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-09-02 15:21:04 +02:00
transifex-integration[bot]
c28be1d8b0
Updates for file po/en.po in ru_RU (#2481)
* Translate po/en.po in ru_RU

100% translated source file: 'po/en.po'
on 'ru_RU'.

* Translate po/en.po in ru_RU

100% translated source file: 'po/en.po'
on 'ru_RU'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-08-07 09:56:31 +02:00
iTrooz
1b8f823f7c
Refactor part of UserExcludeUpgrades() (#2450) 2024-07-29 09:15:20 +02:00
Daniel Oh
836fc5922a
add short option for --repo (#2380)
* add short option for --repo

* run pre-commit

* update man page

* add fish completion

* add a N options

* add long options

---------

Co-authored-by: jguer <me@jguer.space>
2024-06-28 16:40:35 +02:00
Joey Holtzman
0165486bf4
Respect provided targets when using -Si flag (#2460) 2024-06-28 16:39:49 +02:00
Jo
5149e3714d
fix(query): match empty pacman -Si with AUR info (#2459) 2024-06-21 10:06:02 +02:00
Marcus B Spencer
9ed9b0b4e1
Update README.md (#2458)
Update the README to prevent partial upgrades.

Partial upgrades are dangerous on Arch Linux.
Partial upgrades may occur when a `-y` operation is given without a corresponding `-u` operation.

Quote from the ArchWiki:
> Do not use:
> `pacman -Sy package`
> `pacman -Sy` followed by `pacman -S` package (Note the absence of `-S**u**` in the installation of the package.)
> `pacman -Syuw` (Note that `pacman -Syuw` does imply the same risks like pacman -Sy`, as it will update the pacman sync database without installing the newer packages.)

https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported
2024-06-20 14:15:14 +02:00
transifex-integration[bot]
e19700234f
Updates for file po/en.po in he (#2447)
* Translate po/en.po in he

100% translated source file: 'po/en.po'
on 'he'.

* Translate po/en.po in he

100% translated source file: 'po/en.po'
on 'he'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-06-03 09:56:18 +02:00
transifex-integration[bot]
965f8956e9
Updates for file po/en.po in he_IL (#2448)
Translate po/en.po in he_IL

100% translated source file: 'po/en.po'
on 'he_IL'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-06-03 09:38:39 +02:00
transifex-integration[bot]
53c9d0ef34
Updates for file po/en.po in es (#2441)
* Translate po/en.po in es

100% translated source file: 'po/en.po'
on 'es'.

* Translate po/en.po in es

100% translated source file: 'po/en.po'
on 'es'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-05-13 09:23:23 +02:00
Adivardhan Maheshwari
9b41f136d6
Add a package update command (#2205)
* Add a package update command

when running these commands on archlinux-base proxmox lxc, found out that these commands return 404 error unless the pacman -Sy command is run.

This although seeming simplistic might be something unknown when someone uses yay and archlinux for the first time.

* Update README.md
2024-05-02 11:00:29 +00:00
Tom
d956dd7888
Fix incorrect formatting of some msgstr of the spanish translation (#2437)
fix: Fix incorrect formatting for "%s to upgrade/install." and "%s will also be installed for this operation." in Spanish translation
2024-05-02 12:58:59 +02:00
eveneast
61dd708a4a
chore: fix function name in comment (#2430)
Signed-off-by: eveneast <qcqs@foxmail.com>
2024-05-02 10:54:16 +00:00
transifex-integration[bot]
ff3ad18fa8
Updates for file po/en.po in fr (#2425)
* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

* Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-05-02 12:53:37 +02:00
transifex-integration[bot]
803f708106
Updates for file po/en.po in fr_FR (#2424)
* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-05-02 12:53:29 +02:00
transifex-integration[bot]
9b6d40d7f9
Updates for file po/en.po in hu (#2431)
* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-05-02 12:53:20 +02:00
transifex-integration[bot]
779a9f16bd
Updates for file po/en.po in fr_FR (#2423)
* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-04-03 14:32:00 +02:00
transifex-integration[bot]
02d3e2e1c0
Updates for file po/en.po in ru_RU (#2422)
Translate po/en.po in ru_RU

100% translated source file: 'po/en.po'
on 'ru_RU'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-04-03 14:31:51 +02:00
transifex-integration[bot]
8de397ed11
Updates for file po/en.po in fr (#2419)
Translate po/en.po in fr

100% translated source file: 'po/en.po'
on 'fr'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-04-03 10:37:48 +02:00
transifex-integration[bot]
de7ad4070f
Updates for file po/en.po in zh_TW (#2420)
Translate po/en.po in zh_TW

100% translated source file: 'po/en.po'
on 'zh_TW'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-04-03 10:37:41 +02:00
transifex-integration[bot]
3b18e2197c
Updates for file po/en.po in ca_ES (#2421)
Translate po/en.po in ca_ES

100% translated source file: 'po/en.po'
on 'ca_ES'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-04-03 10:37:33 +02:00
transifex-integration[bot]
127b3a5b1a
Updates for file po/en.po in fr_FR (#2414)
* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

* Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-03-31 16:53:36 +02:00
Jo
2ff794da32
chore: update go-alpm (#2409)
* update go alpm

* update golangci

* add missing ldflag
2024-03-23 23:46:02 +01:00
James Raspass
6c2330528f
Use Go 1.21's min/max built-ins (#2405)
This simplifies the code compared to either rolling our own or awkwardly
using math's float functions with integers.
2024-03-23 23:27:30 +01:00
transifex-integration[bot]
a1d530cbf4
Updates for file po/en.po in hu (#2401)
* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-03-17 14:14:46 +01:00
James Raspass
5d887cbd41
Replace github.com/pkg/errors with stdlib errors/fmt (#2400) 2024-03-16 09:10:49 +01:00
Jo
05b76852bd
chore(yay): fix missing command (#2399)
fix missing command
2024-03-16 01:22:48 +01:00
Jo
9524cbbaed
chore: ensure pacman update in builder (#2398)
* ensure pacman up

* lint step fix
2024-03-16 01:13:30 +01:00
Jo
48d1d3d2d5
chore(yay): update dependencies and builder (#2396)
* fix libalpm14 build

* update deps

* try alternative arch
2024-03-16 00:55:05 +01:00
transifex-integration[bot]
741d83c1f0
Updates for file po/en.po in fr_FR (#2388)
Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-03-15 23:30:13 +01:00
transifex-integration[bot]
9c02af429a
Updates for file po/en.po in ru (#2389)
* Translate po/en.po in ru

100% translated source file: 'po/en.po'
on 'ru'.

* Translate po/en.po in ru

100% translated source file: 'po/en.po'
on 'ru'.

* Translate po/en.po in ru

100% translated source file: 'po/en.po'
on 'ru'.

* Translate po/en.po in ru

100% translated source file: 'po/en.po'
on 'ru'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-03-11 15:27:27 +01:00
Jo
03e89d660f
chore: fix min go version (#2383)
fix min go version
2024-03-02 16:40:21 +01:00
transifex-integration[bot]
f7f2169992
Updates for file po/en.po in nl (#2377)
* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

* Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-02-23 08:28:24 +01:00
Jo
e8080f87c2
chore(yay): fix breaking -git ci test (#2373)
* chore(yay): fix breaking test

* chore(yay): fix breaking test

* chore(yay): fix breaking test

* update gomod

* remove debug commands
2024-02-19 17:04:06 +01:00
Jo
26aa171b2b
fix(query): remove -debug packages from missing list if base package is installed (#2372)
* chore(yay): fix pre-commit

* chore(yay): fix git ignore
2024-02-19 10:29:47 +00:00
transifex-integration[bot]
92d7cb0faa
Updates for file po/en.po in id (#2366)
Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-02-02 09:41:56 +01:00
transifex-integration[bot]
f3a4fc8987
Updates for file po/en.po in cs (#2367)
Translate po/en.po in cs

100% translated source file: 'po/en.po'
on 'cs'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-02-02 09:41:48 +01:00
transifex-integration[bot]
aa6cad75a3
Updates for file po/en.po in ca (#2353)
Translate po/en.po in ca

100% translated source file: 'po/en.po'
on 'ca'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-25 16:44:40 +01:00
transifex-integration[bot]
2078bc936f
Updates for file po/en.po in es (#2354)
Translate po/en.po in es

100% translated source file: 'po/en.po'
on 'es'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-25 16:44:23 +01:00
transifex-integration[bot]
d778be4f9f
Updates for file po/en.po in de (#2352)
Translate po/en.po in de

100% translated source file: 'po/en.po'
on 'de'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-25 16:44:06 +01:00
transifex-integration[bot]
aeafe23027
Updates for file po/en.po in hu (#2355)
Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-25 16:43:51 +01:00
transifex-integration[bot]
6c31477ccd
Updates for file po/en.po in pt_BR (#2357)
Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-25 16:43:39 +01:00
transifex-integration[bot]
0a930c9ffc
Updates for file po/en.po in id (#2358)
Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-25 16:43:15 +01:00
transifex-integration[bot]
d411524481
Updates for file po/en.po in pt (#2356)
Translate po/en.po in pt

100% translated source file: 'po/en.po'
on 'pt'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-25 16:42:51 +01:00
transifex-integration[bot]
15ef062bb5
Updates for file po/en.po in zh_CN (#2359)
Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-25 16:42:28 +01:00
transifex-integration[bot]
c2d7d99e43
Updates for file po/en.po in it_IT (#2360)
Translate po/en.po in it_IT

100% translated source file: 'po/en.po'
on 'it_IT'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-25 16:42:20 +01:00
transifex-integration[bot]
86207fce64
Updates for file po/en.po in sv (#2361)
Translate po/en.po in sv

100% translated source file: 'po/en.po'
on 'sv'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-25 16:42:00 +01:00
Jo
dc68b1a8fa
chore: update locale files (#2351)
update po
2024-01-25 15:16:21 +00:00
Joey Holtzman
d02c45e5b6
Remove deprecated flags in favor of boolean flags (#2350) 2024-01-25 16:03:47 +01:00
Joey Holtzman
8d773aa6a3
Remove deprecated warning when using -yc together (#2347) 2024-01-24 16:11:51 +01:00
transifex-integration[bot]
b81d34d5cc
Updates for file po/en.po in zh_CN (#2341)
Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-18 15:10:57 +01:00
transifex-integration[bot]
d77dd77141
Updates for file po/en.po in hu (#2338)
* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-01-04 17:51:26 +01:00
transifex-integration[bot]
e34bce003d
Updates for file po/en.po in hu (#2337)
* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

* Translate po/en.po in hu

100% translated source file: 'po/en.po'
on 'hu'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-12-27 16:59:38 +01:00
Eng Zer Jun
d23e8925fa
fix(dep_graph): fix panic on selecting AUR providers (#2333)
This commit fixes https://github.com/Jguer/yay/issues/2289 by making
`provideMenu` returns the first option when it receives an error input
from the user (e.g. user sends EOF).

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-12-11 17:45:54 +01:00
Jo
643830fccd
chore: Use custom image (#2328)
* self-host image

* update deps
2023-11-30 09:39:56 +01:00
transifex-integration[bot]
cb4cd7b451
Updates for file po/en.po in sv (#2321)
Translate po/en.po in sv

100% translated source file: 'po/en.po'
on 'sv'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-29 11:17:30 +01:00
transifex-integration[bot]
350ff1c70a
Updates for file po/en.po in id (#2323)
Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-29 11:17:16 +01:00
transifex-integration[bot]
26dc74ed67
Updates for file po/en.po in ca (#2320)
Translate po/en.po in ca

100% translated source file: 'po/en.po'
on 'ca'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-29 11:16:57 +01:00
transifex-integration[bot]
a00ff6b3cc
Updates for file po/en.po in de (#2324)
Translate po/en.po in de

100% translated source file: 'po/en.po'
on 'de'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-29 11:16:43 +01:00
transifex-integration[bot]
9e665a98b9
Updates for file po/en.po in pt_BR (#2325)
* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

* Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-29 11:16:30 +01:00
transifex-integration[bot]
4169f0ee42
Updates for file po/en.po in es (#2326)
* Translate po/en.po in es

100% translated source file: 'po/en.po'
on 'es'.

* Translate po/en.po in es

100% translated source file: 'po/en.po'
on 'es'.

* Translate po/en.po in es

100% translated source file: 'po/en.po'
on 'es'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-29 11:16:15 +01:00
transifex-integration[bot]
5a6b18fe23
Updates for file po/en.po in pt (#2322)
* Translate po/en.po in pt

100% translated source file: 'po/en.po'
on 'pt'.

* Translate po/en.po in pt

100% translated source file: 'po/en.po'
on 'pt'.

* Translate po/en.po in pt

100% translated source file: 'po/en.po'
on 'pt'.

* Translate po/en.po in pt

100% translated source file: 'po/en.po'
on 'pt'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-23 16:34:20 +01:00
transifex-integration[bot]
c8577bb613
Updates for file po/en.po in pt_BR (#2317)
Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-21 14:10:18 +01:00
transifex-integration[bot]
965f41b938
Updates for file po/en.po in it_IT (#2316)
Translate po/en.po in it_IT

100% translated source file: 'po/en.po'
on 'it_IT'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-21 14:10:06 +01:00
Kirill Motkov
0771ded99b
Refactor AURPKGBUILDRepos and Fix Localization Command in Makefile (#2313)
* optimize mutex usage and logging in AURPKGBUILDRepos function

* fix localization script

Fix localization script Makefile by adding missing semicolon and --no-translator flag
2023-11-20 16:58:20 +01:00
transifex-integration[bot]
8f98ab3d4b
Updates for file po/en.po in de (#2312)
Translate po/en.po in de

100% translated source file: 'po/en.po'
on 'de'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-11-15 16:43:40 +01:00
Joey Holtzman
d368f99be0
feat(yay): add boolean flags (#2285)
* feat(yay): add boolean flags

This feature now allows users to specify --<option>=<bool value> instead
of using --<option> and --no<option>. Specifying nothing results in the
boolean value being true. The flags prefixed with `no` are deprecated.

* chore(args): Print warning when using deprecated flags

* chore(yay): Update man page for deprecated options and add examples of
boolean flags being used
2023-09-27 12:36:57 +02:00
Eng Zer Jun
a1121556be
refactor: remove redundant len check (#2291)
`len` returns 0 if the slice or map is nil. From the Go specification
[1]:

  "1. For a nil slice, the number of iterations is 0."
  "3. If the map is nil, the number of iterations is 0."

Therefore, an additional `len(v) != 0` check for before the loop is
unnecessary.

[1]: https://go.dev/ref/spec#For_range

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-09-27 12:36:08 +02:00
Jo
299aa1e123
fix(download): do not garble download output by default (#2283)
limit default concurrent downloads to 1
2023-09-18 09:51:32 +02:00
Joey Holtzman
04c76a404e
feat(install): add --keepsrc to keep pkg/ and src/ directories (#2272)
* feat(install): add --nocleanbuild to keep pkg/ and src/ directories for
AUR packages

Providing this flag during installation of AUR packages allows for keeping
the src/ and pkg/ directories produced my makepkg. If the user wants to
delete the directories, they can either select to cleanBuild in the
cleanmenu or run the installation without the --nocleanbuild flag (yay
will only remove the directories if the package is rebuilt)

* fix(completion): simplify description for --nocleanbuild in fish

This makes the description consistent with the descriptions in the
man page, --help, and zsh completion.

* refactor(install): Rename --nocleanbuild to --keepsrc

This naming scheme is more familiar to users since it is the name of the
flag in Paru.

---------

Co-authored-by: jguer <me@jguer.space>
2023-09-18 09:21:42 +02:00
Jo
e60ccdf8b7
Fix image recursive build (#2280)
* fix image recursive build

* add test fixes

* disable buildvcs

* fix integration
2023-09-15 11:17:18 +02:00
transifex-integration[bot]
b6c72ce7a2
Updates for file po/en.po in he on branch next (#2274)
Translate po/en.po in he

100% translated source file: 'po/en.po'
on 'he'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-09-08 18:21:41 +02:00
Esteban Blanc
87d1fd1c06
Add oneliner install for binray source (#2268) 2023-09-07 10:58:30 +02:00
transifex-integration[bot]
92d50910de
Updates for file po/en.po in ko on branch next (#2266)
* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-09-07 10:44:11 +02:00
Joey Holtzman
a0e6838a5f
fix(yay): fix missing placeholders in translations (#2271) 2023-09-07 10:43:45 +02:00
Jo
8916cd174b
refactor(yay): move cfg inside of runtime (#2259)
* rework relationship between runtime and cfg

* separate runtime from cfg

* simplify instantiation logic

* move installer to appropriate package

* move operator to sync package

* add tests for srcinfo service

* consolidate srcinfo service in sync

* add logger to srcinfo

* add logger to preparer

* remove unused text functions

* remove remaining text.* from srcinfo

* remove global logger parts

* remove global org method exports

* remove global logger

* move text->input

* add rule to prevent fmt.Print

* update golangci go version

* remove outdated FAQs

* remove outdated FAQs
2023-08-06 21:39:41 +02:00
Jo
7483393377
fix(sync): add missing Replaces to -Si (#2257) 2023-08-02 07:45:14 +00:00
jguer
9aefb8440e
add missing login 2023-07-30 23:16:30 +02:00
Jo
6c1998f6eb
chore(ci): update builder image ci (#2254) 2023-07-30 22:07:28 +02:00
smolx
688434b242
chore(yay): remove unnecessary Graph initialization (#2251)
Just an additional correction to one of my commits.
2023-07-26 10:28:23 +02:00
Jo
5995e55ddb
chore(topo): move topo to where it's used (#2250)
move topo into dep
2023-07-23 20:20:05 +00:00
Jo
04c82b8112
chore(yay): replace custom set package with dep (#2249)
* replace string set with dep

* remove unused field

* remove custom string set package
2023-07-23 17:29:01 +00:00
transifex-integration[bot]
abd398a787
Updates for file po/en.po in nl on branch next (#2243)
Translate po/en.po in nl

100% translated source file: 'po/en.po'
on 'nl'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-07-16 09:08:11 +00:00
Jo
23b053bccf
fix(aur): only check gpg signature after gpg import . fixes #2165 (#2239)
only check gpg on install
2023-07-10 09:54:43 +02:00
Joey Holtzman
dadc8c0d98
Re-add functionality for Installed and NotInstalled options in the menus (#2233)
* fix(menus): Handle Installed and NotInstalled options correctly in the
menus

This functionality was temporarily removed. This commit adds that
functionality back.

* fix(tests): Mock InstalledRemotePackageNamesFn when necessary
2023-07-06 06:54:21 +00:00
smolx
6dd7933fbe
Fix handling targets with specified db (#2218)
* Fix handling targets with specified db

Handle it in a similar way to handling targets with unspecified db.

Also refactored GraphSyncPkg method to make stuff more DRY.

* update go-mod
2023-07-06 06:53:46 +00:00
Joey Holtzman
d9029face3
Don't upgrade repo packages when --aur is specified (#2234)
fix(aur_install): Don't upgrade repo packages when --aur is specified
2023-07-06 06:20:51 +00:00
transifex-integration[bot]
64f5c2b0a9
Updates for po/en.po in zh_CN (#2232)
* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

* Translate po/en.po in zh_CN

100% translated source file: 'po/en.po'
on 'zh_CN'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-07-06 06:19:41 +00:00
transifex-integration[bot]
93afb03738
Updates for po/en.po in pt (#2231)
* Translate po/en.po in pt

100% translated source file: 'po/en.po'
on 'pt'.

* Translate po/en.po in pt

100% translated source file: 'po/en.po'
on 'pt'.

* Translate po/en.po in pt

100% translated source file: 'po/en.po'
on 'pt'.

* Translate po/en.po in pt

100% translated source file: 'po/en.po'
on 'pt'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-26 08:33:32 +02:00
transifex-integration[bot]
0dcf911e99
Updates for po/en.po in it_IT (#2229)
Translate po/en.po in it_IT

100% translated source file: 'po/en.po'
on 'it_IT'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-23 20:46:09 +02:00
transifex-integration[bot]
2be57cb312
Updates for po/en.po in ko (#2226)
Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-23 20:45:59 +02:00
transifex-integration[bot]
f070cff9f9
Updates for po/en.po in sv (#2227)
Translate po/en.po in sv

100% translated source file: 'po/en.po'
on 'sv'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-23 20:45:52 +02:00
transifex-integration[bot]
c46f5d31cc
Updates for po/en.po in ru (#2225)
Translate po/en.po in ru

100% translated source file: 'po/en.po'
on 'ru'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-23 20:45:47 +02:00
transifex-integration[bot]
74c1cdb254
Updates for po/en.po in id (#2224)
Translate po/en.po in id

100% translated source file: 'po/en.po'
on 'id'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-23 20:45:37 +02:00
transifex-integration[bot]
79b03fdac1
Updates for po/en.po in pt_BR (#2223)
Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-23 20:45:30 +02:00
transifex-integration[bot]
5a3c3ae4d0
Updates for po/en.po in fr_FR (#2228)
Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-23 20:45:04 +02:00
transifex-integration[bot]
710ff0097a
Updates for po/en.po in es (#2222)
Translate po/en.po in es

100% translated source file: 'po/en.po'
on 'es'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-23 20:44:34 +02:00
transifex-integration[bot]
ddeaf47a53
Updates for po/en.po in ca (#2221)
Translate po/en.po in ca

100% translated source file: 'po/en.po'
on 'ca'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-23 20:44:23 +02:00
Jo
4f7b3edefe
chore(yay): update deps (#2220)
* update deps

* update po
2023-06-23 20:15:47 +02:00
Jo
5b8cc98afa
fix(dep_graph): do not package provides when providing itself. fix: #2215 (#2216)
fix #2215. package provides itself
2023-06-19 08:13:47 +00:00
transifex-integration[bot]
e25d00015a
Updates for po/en.po in ru (#2212)
Translate po/en.po in ru

100% translated source file: 'po/en.po'
on 'ru'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-17 21:02:31 +00:00
smolx
c5a18e5000
Fix install reason preservation when package is reinstalled (#2195) 2023-06-11 16:16:05 +00:00
smolx
adde043514
Add --askyesremovemake option (#2199)
Same as --askremovemake option but with "Y" as a default answer.
2023-06-11 16:13:01 +00:00
smolx
7dc4fae155
Fix excluding of packages with unsatisfied deps (#2203)
* Fix excluding of packages with unsatisfied deps

When dependency is unsatisfied, add to the graph not only a dep node,
but relationship with parent too.

* Remove excess(duplicate) logic

* Add test cases of upgrading with unsatisfied deps
2023-06-11 16:10:48 +00:00
transifex-integration[bot]
599a5a9073
Updates for po/en.po in pt_BR (#2206)
Translate po/en.po in pt_BR

100% translated source file: 'po/en.po'
on 'pt_BR'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-11 16:10:06 +00:00
smolx
12282fb28a
Fix sorting by name in package search (#2198)
Slightly reorganize and add more tests for SourceQueryBuilder.
2023-06-03 14:01:17 +00:00
smolx
0607090719
Fix deps resolving for installs from SRCINFO (#2190)
Also made MockBuilder and MockRunner thread-safe.
2023-06-03 13:53:33 +00:00
transifex-integration[bot]
1568e64d55
Updates for po/en.po in ko (#2201)
* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

* Translate po/en.po in ko

100% translated source file: 'po/en.po'
on 'ko'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-03 13:50:17 +00:00
transifex-integration[bot]
d08f217b3a
Updates for po/en.po in fr_FR (#2202)
Translate po/en.po in fr_FR

100% translated source file: 'po/en.po'
on 'fr_FR'.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-06-03 13:50:02 +00:00
transifex-integration[bot]
29f47a4413
Translations for po/en.po in es (#2197)
Translate po/en.po in es

100% translated source file: 'po/en.po'
on the 'es' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-05-30 08:43:35 +00:00
smolx
35ee42d343
Remove redundant attempts to set install reasons (#2196)
Redundant attempts took place when the installation by pacman was
exited with code 1, i.e. an real error occurred or installation
was simply cancelled.
2023-05-30 08:40:57 +00:00
moson-mo
1335e9b4e0
fix(pkgbuild): convert package name for gitlab URLs (#2191)
Convert package names to gitlab repo names

Signed-off-by: moson-mo <mo-son@mailbox.org>
2023-05-25 11:00:33 +02:00
Jo
e28319fece
chore(yay): lift legacy engine (#2189)
* remove legacy engine

* remove legacy dep handlers

* use prepare for gendb

* remove unused method

* remove aur client old interface

* remove unused menu fns

* remove inactive upgrademenu option

* unexport printInfo
2023-05-24 08:22:18 +00:00
smolx
c1aa71bee1
Fix AUR dependency resolving (#2169)
Before this fix dependencies for AUR targets were added to the graph
after each addition of a target node. Now dependencies are added only
after all target nodes are added to the graph.

Also added some tests for previously bugged cases.
2023-05-23 21:18:41 +00:00
smolx
56d1b7ed1c
Fix --rebuild option (#2163)
* Reimplement --rebuild option in the new engine (#2153)

* Refactor --rebuild option

* Fix comment formatting
2023-05-23 21:16:27 +00:00
transifex-integration[bot]
036a53882d
Translations for po/en.po in sv (#2188)
Translate po/en.po in sv

100% translated source file: 'po/en.po'
on the 'sv' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-05-23 21:08:20 +00:00
transifex-integration[bot]
330b9ab920
Translations for po/en.po in id (#2187)
Translate po/en.po in id

100% translated source file: 'po/en.po'
on the 'id' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-05-23 15:43:27 +02:00
transifex-integration[bot]
98d5352b78
Translations for po/en.po in ca (#2186)
Translate po/en.po in ca

100% translated source file: 'po/en.po'
on the 'ca' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-05-23 11:58:15 +02:00
Jo
27f336e68c
chore(deps): update deps (#2184)
update deps
2023-05-23 07:41:58 +00:00
transifex-integration[bot]
23937356eb
Translations for po/en.po in it_IT (#2183)
Translate po/en.po in it_IT

100% translated source file: 'po/en.po'
on the 'it_IT' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-05-23 09:22:10 +02:00
Jo
9641d2a608
chore(yay): add warning for yay -c (#2181)
add warning for yay -c
2023-05-22 22:02:14 +00:00
Jo
df3dbfa125
chore(yay): update po (#2180)
* update po

* avoid extra translate work
2023-05-22 21:52:06 +00:00
Jo
fdcf6ef664
ci(yay): add integration test framework (#2178)
* add integration test framework

* fix integration tests

* fix integration tests
2023-05-22 21:38:02 +00:00
Jo
39f0d4e9a1
chore(yay): remove unused constant (#2179)
remove unused constant

Co-authored-by: christian-heusel <christian@heusel.eu>
2023-05-22 20:59:30 +00:00
Andrew Geng
d33bf8841d
Fix yay -Sc wiping ~/.cache/yay on 3rd question. (#2175)
If you answer yes to
    :: Do you want to remove all other AUR packages from cache? [Y/n]
then we run cleanAUR(), intending to remove subdirectories of
~/.cache/yay that do not share a name with installed packages not
found in the sync repositories.

Where this was going wrong was cleanAUR() was getting an empty map from
dbExecutor.InstalledRemotePackages()---because InstalledRemotePackages
only recomputes its result if installedRemotePkgMap is nil, whereas
NewExecutor initialized it to an empty map. The symptom was it emptied
my ~/.cache/yay.

We do want a non-nil, empty installedRemotePkgMap to block recomputing
(that is, to indicate the user really has no remote packages), so now
NewExecutor initializes it to nil, and getPackageNamesBySource is
responsible for making sure it's non-nil before writing to it.

Fixes #2152, which seems to have been introduced in
4626a0409c4d34bcffe0d5ed499ebff893115c69.
2023-05-22 20:34:51 +00:00
Jo
bd79057fd9
feat(pkgbuild): use gitlab git repo for retrieving PKGBUILDs (#2177)
use gitlab git repo for retrieving PKGBUILDs
2023-05-22 20:22:49 +00:00
smolx
a0a5e45fe7
Fix -Qu exit code for empty update lists (#2162)
Fix -Qu exit code for empty update lists (#2061)

Previously, -Qun and -Qum without available updates could exit
with code 0 in some cases.
Also fix present and add more tests for such cases.
2023-05-22 18:35:27 +00:00
smolx
ec15a5b363
Implement tests for -Qu/q (#2156)
Implement tests for -Qu/q (#2061)
2023-05-15 10:33:12 +02:00
Jo
d568a73ab8
fix(metadata): reduce cache validity (#2161)
fix metadata cache validity too long
2023-05-15 08:30:41 +00:00
Joaquim Monteiro
490ebe4f7f
Fix formatting of error message that occurs on AUR errors (#2154)
fix: fix formatting of error message that occurs on AUR errors
2023-05-08 21:43:50 +00:00
transifex-integration[bot]
4dfee1f82f
Translate 'po/en.po' in 'fr_FR' (#2150)
Translate po/en.po in fr_FR

100% translated for the source file 'po/en.po'
on the 'fr_FR' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-05-04 16:14:26 +00:00
transifex-integration[bot]
5cf215a00a
Translate 'po/en.po' in 'es' (#2151)
Translate po/en.po in es

100% translated for the source file 'po/en.po'
on the 'es' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-05-04 16:14:15 +00:00
Jo
f7731d7cf9
fix(groups): fix sync group getting passed to reason setter (#2148)
fix sync group install #2137
2023-05-01 16:21:40 +00:00
Jo
966bfb74ee
feat(dep): add provider resolution on first layer (#2147)
add provider resolution on first layer
2023-05-01 15:56:42 +00:00
Jo
c721fe7f3b
fix(search): fix -Si crash when using metadata engine (#2146)
fix missing By query in metadata search
2023-05-01 12:52:43 +00:00
Jo
b51c10ca3e
doc(yay): specify search narrowing in man (#2145)
specify search narrowing in man
2023-05-01 12:33:19 +00:00
Tanmay Chaudhry
4832ec59db
Fix version diff word detection (#2124)
* Fix version diff word detection

* remove double negation

* preserve text color after tests
2023-04-27 07:23:25 +00:00
Jo
49267b9cd9
feat(upgrade): separate menu for pulled along dependencies (#2141)
try separate menu for pulled along

use installed as term

fix order gap

fix tests

add aur db + aur scenario
2023-04-27 07:20:21 +00:00
Jo
e6344100e6
fix(upgrade): fix local pulled dependencies replacing upgrade information (#2140)
avoid upgrade info loss

fix colormap
2023-04-27 07:04:09 +00:00
Tanmay Chaudhry
15400c5fc5
Switch the TZ to UTC temporarily for running the News tests (#2121)
* switch the TZ to UTC temporarily for running the tests

* Remove unnecessary environment reset

* Set test specific environment.

Co-authored-by: Jo <me@jguer.space>

---------

Co-authored-by: Jo <me@jguer.space>
2023-04-26 13:54:37 +02:00
transifex-integration[bot]
822b11b4d6
Translate 'po/en.po' in 'pt' (#2133)
Translate po/en.po in pt

100% translated for the source file 'po/en.po'
on the 'pt' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-26 13:53:54 +02:00
transifex-integration[bot]
71432a447e
Translate 'po/en.po' in 'cs' (#2130)
Translate po/en.po in cs

100% translated for the source file 'po/en.po'
on the 'cs' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-26 13:53:29 +02:00
transifex-integration[bot]
957292a911
Translate 'po/en.po' in 'zh_TW' (#2138)
Translate po/en.po in zh_TW

100% translated for the source file 'po/en.po'
on the 'zh_TW' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-26 13:46:06 +02:00
transifex-integration[bot]
8c69356bd4
Translate 'po/en.po' in 'it_IT' (#2126)
Translate po/en.po in it_IT

100% translated for the source file 'po/en.po'
on the 'it_IT' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-20 08:58:19 +02:00
transifex-integration[bot]
64bb346fbe
Translate 'po/en.po' in 'de' (#2119)
* Translate po/en.po in de

100% translated for the source file 'po/en.po'
on the 'de' language.

* Translate po/en.po in de

100% translated for the source file 'po/en.po'
on the 'de' language.

* Translate po/en.po in de

100% translated for the source file 'po/en.po'
on the 'de' language.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-16 16:23:42 +00:00
transifex-integration[bot]
797b7485ab
Translate 'po/en.po' in 'sv' (#2118)
* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-16 16:23:27 +00:00
Jo
57a3a090f1
fix(vcs): improve timeout handling for vcs upgrade check (#2120)
remove timeout from full operation and increase timeout for single checking
2023-04-16 16:23:10 +00:00
transifex-integration[bot]
f0bfe63ced
Translate 'po/en.po' in 'ko' (#2116)
* Translate po/en.po in ko

100% translated for the source file 'po/en.po'
on the 'ko' language.

* Translate po/en.po in ko

100% translated for the source file 'po/en.po'
on the 'ko' language.

* Translate po/en.po in ko

100% translated for the source file 'po/en.po'
on the 'ko' language.

* Translate po/en.po in ko

100% translated for the source file 'po/en.po'
on the 'ko' language.

* Translate po/en.po in ko

100% translated for the source file 'po/en.po'
on the 'ko' language.

* Translate po/en.po in ko

100% translated for the source file 'po/en.po'
on the 'ko' language.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-13 06:50:20 +00:00
Jo
83214fbc1c
chore(yay): add local newer to AUR warnings (#2113) 2023-04-11 21:15:47 +00:00
Jo
161fede450
chore(yay): use new aur client for -Si (#2112)
* chore(yay): use new aur client for -Si

* chore(yay): use new client for clean
2023-04-11 21:15:21 +00:00
Jo
26c9ab5a87
fix(yay): fix panic -Si when package is missing (#2111)
fix panic -Si
2023-04-11 16:45:20 +00:00
Jo
4a9c736e2a
chore(upgrade): add makedep explain to the upgrade menu (#2110)
* display required by

* cutoff at 2
2023-04-11 16:41:34 +00:00
adasauce
76e5ee1fa6
fix: querybuilder GetTargets start iteration at 1, when include is 0 causes a crash (#2109) 2023-04-11 16:23:19 +00:00
Jo
88008e4eb3
feat(yay): skip confirmed confirms (#2107)
* skip pacman confirmations when yay confirmations are done

* default to double confirm

* fix tests
2023-04-11 11:51:39 +00:00
Jo
c7a51a1614
fix(text): ensure error logs go to stderr (#2105)
ensure Error logs go to stderr
2023-04-10 16:26:09 +00:00
transifex-integration[bot]
6a971df635
Translate 'po/en.po' in 'ca' (#2100)
* Translate po/en.po in ca

100% translated for the source file 'po/en.po'
on the 'ca' language.

* Translate po/en.po in ca

100% translated for the source file 'po/en.po'
on the 'ca' language.

* Translate po/en.po in ca

100% translated for the source file 'po/en.po'
on the 'ca' language.

* Translate po/en.po in ca

100% translated for the source file 'po/en.po'
on the 'ca' language.

* Translate po/en.po in ca

100% translated for the source file 'po/en.po'
on the 'ca' language.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-10 15:47:31 +00:00
Jo
511b95769e
docs(yay): correct order of editor var evaluation (#2104)
correct documentation on order of editor preference. Use logger for editfn
2023-04-10 15:46:46 +00:00
transifex-integration[bot]
4e9a865388
Translate 'po/en.po' in 'id' (#2092)
Translate po/en.po in id

100% translated for the source file 'po/en.po'
on the 'id' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-08 07:58:54 +00:00
transifex-integration[bot]
9270f00c7e
Translate 'po/en.po' in 'pt' (#2093)
Translate po/en.po in pt

100% translated for the source file 'po/en.po'
on the 'pt' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-08 07:58:37 +00:00
transifex-integration[bot]
527c3a5058
Translate 'po/en.po' in 'tr' (#2089)
* Translate po/en.po in tr

100% translated for the source file 'po/en.po'
on the 'tr' language.

* Translate po/en.po in tr

100% translated for the source file 'po/en.po'
on the 'tr' language.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-06 20:57:20 +00:00
Jo
1ee94f28d3
fix(new_engine): add missing warnings to AUR updates (#2087)
* add missing warnings to AUR updates

* fix tests
2023-04-06 17:06:46 +00:00
Jo
a64180464b
chore(man): fix wording on operation order to make it more clear (#2088)
fix wording on operation order to make it more clear
2023-04-06 16:49:18 +00:00
transifex-integration[bot]
a31ca0d7dc
Translate 'po/en.po' in 'it_IT' (#2084)
* Translate po/en.po in it_IT

100% translated for the source file 'po/en.po'
on the 'it_IT' language.

* Translate po/en.po in it_IT

100% translated for the source file 'po/en.po'
on the 'it_IT' language.

* Translate po/en.po in it_IT

100% translated for the source file 'po/en.po'
on the 'it_IT' language.

* Translate po/en.po in it_IT

100% translated for the source file 'po/en.po'
on the 'it_IT' language.

* Translate po/en.po in it_IT

100% translated for the source file 'po/en.po'
on the 'it_IT' language.

* Translate po/en.po in it_IT

100% translated for the source file 'po/en.po'
on the 'it_IT' language.

* Translate po/en.po in it_IT

100% translated for the source file 'po/en.po'
on the 'it_IT' language.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-06 16:32:53 +00:00
transifex-integration[bot]
1bc3171abd
Translate 'po/en.po' in 'sv' (#2075)
* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

* Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-06 16:32:45 +00:00
Jo
2d7297ae6d
fix(upgrades): don't include makedeps into -Qu/a (#2085)
don't include makedeps into -Qu/a
2023-04-06 16:32:22 +00:00
Jo
ce0cb35510
feat(new_engine): add support for --nocombinedupgrade (#2083)
* feat(new_engine): add support for --nocombinedupgrade

* update en.po
2023-04-06 11:54:03 +00:00
transifex-integration[bot]
d9b57790fa
Translate 'po/en.po' in 'pt' (#2081)
Translate po/en.po in pt

100% translated for the source file 'po/en.po'
on the 'pt' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-06 11:45:53 +00:00
Jo
5a3f277574
chore(yay): make warning less scary (#2074) 2023-04-05 11:53:11 +00:00
Jo
d1c012085c
fix(yay): ensure yay -Qu & -Quq don't get stuck looking for deps (#2072) 2023-04-05 11:43:30 +00:00
Jo
89f47f8ebe
fix(yay): correct operation order for preparer (#2071)
* fix(yay): reset to origin/HEAD for clean_menu

* fix(yay): correct operation order for preparer

* test(yay): fix flaky test
2023-04-05 11:27:42 +00:00
transifex-integration[bot]
5b5617c7e7
Translate 'po/en.po' in 'it_IT' (#2065)
Translate po/en.po in it_IT

100% translated for the source file 'po/en.po'
on the 'it_IT' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-05 10:36:52 +02:00
transifex-integration[bot]
b80ef15add
Translate 'po/en.po' in 'sv' (#2063)
Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-05 10:36:42 +02:00
transifex-integration[bot]
e0fbb4495a
Translate 'po/en.po' in 'id' (#2068)
Translate po/en.po in id

100% translated for the source file 'po/en.po'
on the 'id' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-04-05 10:36:35 +02:00
jguer
5c7f9ba159
update en.po 2023-04-04 00:14:39 +02:00
Jo
0892fc7cdd
fix(query): reduce verbosity of -Qu (#2060) 2023-04-03 22:05:45 +00:00
jguer
c78d031b32
Revert "ci(yay): execute release-notary publish on ci (#2056)"
This reverts commit 6983a9ee7e760764df1fe7a25b3f5aa9ca3341dc.
2023-04-03 18:54:19 +02:00
Jo
6983a9ee7e
ci(yay): execute release-notary publish on ci (#2056) 2023-04-03 16:49:00 +00:00
Jo
ada8261bca
fix(yay): check if downgrade has smaller version (#2054) 2023-04-03 16:37:41 +00:00
Jo
3f09397816
Update bug_report.md (#2053) 2023-04-03 16:34:39 +00:00
Jo
9532e7b7da
fix(yay): show yay usage always on --help -h (#2051)
fix yay usage not showing
2023-04-03 13:50:49 +02:00
bittin
956c4cb100
Add bittin as translator (#2050) 2023-04-03 11:10:10 +00:00
Jo
16cce4384b
ci(lint): update builder image (#2048)
* last min ci changes

* readme update
2023-04-03 07:32:25 +00:00
Jo
c3888d9881
chore(ci): add missing translation files to release package (#2047)
add missing pos
2023-04-03 07:25:59 +00:00
Jo
c63576c36d
fix(search): always trust search if there's only one term (#2046)
always trust search if there's only one term
2023-04-03 07:16:03 +00:00
Jo
dd42593ba1
fix(search): only do exact trim in certain modes (#2045)
only do exact trim in certain modes
2023-04-02 17:50:35 +00:00
Jo
d13bdb0ce1
feat(search): improve exact match for separate source (#2044)
* unify query builder

* remove uneeded code

* reorganize code
2023-04-02 00:23:02 +00:00
Jo
6390d1c2b0
chore(query_builder): tweak mixed sources similarity matcher. related to #1719 (#2043)
tweak mixed sources similarity matcher. related to #1719
2023-04-01 13:30:50 +00:00
Jo
9028f5d8be
ci(release): update release notary (#2042)
update release notary
2023-04-01 10:48:46 +00:00
Jo
5d1c54413c
fix(query_builder): use correct aur client for mixed query builder (#2041)
* use same repo search as pacman

use logger child from runtime

* use common interface for aur clients
2023-04-01 10:33:05 +00:00
Jo
e615f8e07e
fix(new_engine): exclude menu removing new deps (#2040)
fix exclude menu removing new deps
2023-03-31 22:15:57 +00:00
Jo
d75e0a001d
fix(clean): modify clean args (#2039) 2023-03-31 21:22:57 +00:00
Ferdinand Bachmann
2bdbc3e06b
fix(aur_install): fix debug packages being added to deps even if not found (#2038) 2023-03-30 21:48:33 +00:00
Jo
01666aef37
fix(vcs): add extra context to errors and increase timeouts (#2037)
* give a more complete message on vcs error

* bump timeouts for vcs checking
2023-03-30 18:57:56 +00:00
transifex-integration[bot]
68337a58c1
Translate 'po/en.po' in 'it_IT' (#2035)
Translate po/en.po in it_IT

100% translated for the source file 'po/en.po'
on the 'it_IT' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-03-30 17:08:28 +00:00
transifex-integration[bot]
ca12cd7156
Translate 'po/en.po' in 'tr' (#1993)
Translate po/en.po in tr

100% translated for the source file 'po/en.po'
on the 'tr' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-03-29 11:47:47 +02:00
Ferdinand Bachmann
bebe80bb84
fix(aur_install): fix debug pacakges not being found (#1977) 2023-03-29 09:08:25 +00:00
transifex-integration[bot]
9137c1e95f
Translate 'po/en.po' in 'zh_CN' (#1978)
Translate po/en.po in zh_CN

100% translated for the source file 'po/en.po'
on the 'zh_CN' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-03-29 09:06:59 +00:00
transifex-integration[bot]
bdd888c59d
Translate 'po/en.po' in 'ko' (#1992)
Translate po/en.po in ko

100% translated for the source file 'po/en.po'
on the 'ko' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-03-29 09:06:38 +00:00
transifex-integration[bot]
16b9516f96
Translate 'po/en.po' in 'fr_FR' (#1974)
Translate po/en.po in fr_FR

100% translated for the source file 'po/en.po'
on the 'fr_FR' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-03-15 09:34:10 +01:00
Jo
dfa7ed51c1
chore(yay): change found repo to debug (#1966)
change found to debug
2023-03-13 08:55:08 +00:00
Jo
7bc4a666e6
refactor(runtime): Build runtime after cmdargs parsing (#1965)
* extract runtime building from cfg

* respect AURRPCURL

* use -Syu if there are no targets, allows to pass extra options

* one more step towards removing runtime from cfg
2023-03-13 08:48:39 +00:00
transifex-integration[bot]
210512a5d6
Translate 'po/en.po' in 'ko' (#1963)
Translate po/en.po in ko

100% translated for the source file 'po/en.po'
on the 'ko' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-03-12 15:49:31 +00:00
transifex-integration[bot]
57250fec4b
Translate 'po/en.po' in 'sv' (#1962)
Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-03-12 15:49:23 +00:00
transifex-integration[bot]
e56b9cd72b
Translate 'po/en.po' in 'id' (#1960)
Translate po/en.po in id

100% translated for the source file 'po/en.po'
on the 'id' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-03-11 13:16:10 +00:00
transifex-integration[bot]
794a38fa28
Translate 'po/en.po' in 'pt' (#1959)
Translate po/en.po in pt

100% translated for the source file 'po/en.po'
on the 'pt' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-03-10 12:10:57 +01:00
Jo
f11f9058c2
fix(logger): respect --debug for setting debug logger (#1955)
respect --debug parse
2023-03-08 21:33:43 +00:00
Jo
7e7764a797
chore(new_engine): use new engine for -Qu (#1954)
* use new engine for -Qu

* fix devel search showing up in -Quq

* test empty upgrade menu
2023-03-08 21:30:54 +00:00
Jo
c744058b20
Update manual page and remove deprecate/removed options (#1951)
* add new options and remove deprecated

* add new -Bi
2023-03-08 13:07:15 +00:00
transifex-integration[bot]
7073939cdc
Translate 'po/en.po' in 'ca' (#1950)
Translate po/en.po in ca

100% translated for the source file 'po/en.po'
on the 'ca' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-03-08 10:47:21 +01:00
Jo
3d5a43c294
chore(yay): bump version (#1949)
bump major
2023-03-07 21:04:06 +00:00
transifex-integration[bot]
46bf36a160
Translate 'po/en.po' in 'sv' (#1948)
Translate po/en.po in sv

100% translated for the source file 'po/en.po'
on the 'sv' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-03-07 20:48:08 +00:00
Jo
463e60e045
chore(deps): update goalpm (#1947)
* update dependencies

* use logger in cmd runner
2023-03-06 09:19:21 +00:00
Jo
e6ed869df1
chore(yay): remove global cfg (#1946)
remove global cfg
2023-03-05 21:58:18 +00:00
Jo
8b8d6001a4
fix(new_engine): Improve partial upgrade protection and pinned deps (#1945)
* fix dep graph, existing in graph

* do not change from same dep reason

* roll up layer installs in case of fail

* re-use pacman exclude mechanism

should finish the reimplementation of the missing guards from the legacy
engine.

* include update in debug log

* test rollups
2023-03-05 17:31:11 +00:00
Joey H
0387dfdb59
fix(install): use global arguments when removing make dependencies (#1940)
fix(install): use global arguments when removing make dependencies

One example where this would fail before is when the `--root` argument
was passed in by the user. Yay would install the make dependencies to
the new root directory, but would try to remove them from / causing the
installation to fail if the make dependencies were not found in the
default installation path (/).
2023-02-26 11:25:02 +00:00
Jo
fa2e726ca6
chore(text): use logger in new engine services (#1939)
* use logger in vcs

* use logger in query builder

* use logger in migrations
2023-02-25 19:03:27 +00:00
Jo
841395c318
feat(local_install): check PKGBUILD and .SRCINFO presence and generate .SRCINFO if necessary (#1938)
check build file presence and generate if needed
2023-02-25 17:44:24 +00:00
Jo
4e0a5c8520
feat(new_engine): respect -w in AUR package building (#1923)
respect -w in AUR package building
2023-02-21 02:49:48 +00:00
Jo
61f1bdf291
fix(cmd): propagate sigterm to spawned processes (#1927)
propagate sigterm to spawned processes
2023-02-21 02:49:33 +00:00
Jo
3ef4664d99
fix(devel): timeout devel check after 5 secs (#1929)
timeout devel check after 5 secs
2023-02-21 02:48:56 +00:00
Jo
4780a974d9
fix flaky tests (#1928) 2023-02-21 02:42:56 +00:00
Jo
7c8f273cdf
fix(git): add git denylist for workspace variables (#1926)
add git denylist for workspace variables
2023-02-21 02:23:48 +00:00
Jo
a3d51a42da
fix(yay): match -Qu return (#1924)
match -Qu return
2023-02-21 02:00:39 +00:00
jguer
096ff7a544
fix -Si aur & repo mix 2023-02-21 02:55:49 +01:00
Jo
6c870db1f1
fix(aur): respect -uu for AUR downgrade (#1925)
respect -uu for AUR downgrade
2023-02-21 01:51:52 +00:00
Jo
f0433cc339
feat(metadata): respect regex in search (#1922)
respect regex in search
2023-02-21 01:24:48 +00:00
Jo
fad26c078d
fix(getpkgbuild): check AUR pkgs exist before GetPKGBUILD (#1921)
check AUR pkgs exist before GetPKGBUILD
2023-02-20 23:58:13 +00:00
Jo
7490836991
fix(new_engine): respect --needed on target gathering (fixes #1552) (#1920)
* use logger in dep graph

* use logger in dep graph

* use logger in dep graph

* only query for AUR packages once per tier. useful for rpc

* fix performance regression for ros-melodic

* prefer name search first

* implement needed at target gathering

* set default config

* fixup tests for needed
2023-02-20 23:14:59 +00:00
Jo
8d18f1be18
fix(new_engine): add aur client support to mixed source display (#1919)
* update aur client and use correct aur client

* add aur query client support for mixed source engine
2023-02-20 12:14:16 +00:00
Jo
f1d086df1d
Allow use of rpc client as an alternative to the metadata client (#1918)
* use updated aur client

* add logger to rpc client

* update go.mod
2023-02-20 11:20:48 +00:00
Jo
2f5fd5cb1c
fix(new_engine): add missing version for devel packages in combi (#1917)
* fix missing latest-commit in devel upgrade menu

* move test grapher to inner test
2023-02-20 09:51:39 +00:00
Jo
0a8bc1fe2e
fix(new_engine): add missing latest-commit in devel upgrade menu (#1916)
* fix missing latest-commit in devel upgrade menu

* move test grapher to inner test
2023-02-17 19:29:46 +00:00
Jo
0bf4c2e502
feat(new_install): show (#1915)
* show new packages in upgrade form if they exist

* refactor up select

* remove unused graph parts

* readd len

* Complete upgrade graphing

* Extract to upgrade pkg

* remove unused dep method

* remove uneeded dep

* cleanup method

* specify io Reader for testing

* use specified input vector

* fix non-active devel

* test base cases

* add devel test cases

* add range tests

* add logger struct

* use logger struct in upgrade

* follow golangci recommendations

* update deps

* update golangci
2023-02-17 19:01:26 +00:00
Jo
4f50b799ef
feat(local_install): add choice menu for yay -Bi (#1903)
add choice menu for yay -Bi
2023-01-23 23:54:15 +00:00
Jo
4626a0409c
fix(vcs): do not vcs update gather orphan info (#1902)
* reduce complexity of devel upgrade gathering

* clean orphans devel
2023-01-23 23:03:32 +00:00
Jo
1bfbd01f94
fix(sync): do not update vcs info of failed packages (#1901)
* extract srcinfo service to pkg

* take into account failed installs for vcs update. Fixes #1892

* fix tests
2023-01-23 21:43:58 +00:00
transifex-integration[bot]
04c4b0aa59
Translate '/po/en.po' in 'ru' (#1898)
Translate /po/en.po in ru

translation completed for the source file '/po/en.po'
on the 'ru' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-23 17:03:14 +01:00
Jo
9356481d1c
fix(config): expand tilde for some config fields. Fixes #1774 (#1897)
expande tilde for some fields. Fixes #1774
2023-01-22 23:21:05 +00:00
transifex-integration[bot]
2f1ebb9fde
Translate '/po/en.po' in 'tr' (#1888)
Translate /po/en.po in tr

translation completed for the source file '/po/en.po'
on the 'tr' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
Co-authored-by: jguer <me@jguer.space>
2023-01-19 10:51:43 +01:00
transifex-integration[bot]
5626ed3ff4
Translate '/po/en.po' in 'he' (#1895)
Translate /po/en.po in he

translation completed for the source file '/po/en.po'
on the 'he' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-18 11:46:45 +01:00
Balki
e09209bb19
fix(zsh): fix zsh completion for yay specific flags (#1893) 2023-01-13 13:50:09 +00:00
Jo
c40e949752
fix(build): fix issue where shell conditional output is passed to go build (#1887)
fix issue where shell conditional output is passed to go build

(cherry picked from commit 6744fa721f4737f695b40eac0571e3b4b1504b65)
2023-01-05 15:50:53 +00:00
Jo
b8debd1ae7
chore(yay): fix small linting issues (#1885)
* replace context.TODO() in tests context.Background()

* remove mock TODOs

* prettier

* apply missing linting
2023-01-03 21:43:56 +00:00
Joey H
8948278568
fix(parser): ensure data is piped when using '-' argument (#1881)
fix(parser): ensure data is piped when using '-' argument

Fixes #1626.

Check to see if data was actually piped to yay, otherwise it will hang
forever. This error will give users better feedback of how to use the
'-' argument (it is also the same exact error pacman throws for invalid
piped data).

Two tests were added. However, I didn't know how to add a test for the
actual part that detects whether data was piped or not (which is
essentially what this commit adds).
2023-01-03 19:43:15 +00:00
Jo
86bba8a289
fix(ci): run ci on all PRs (#1884)
* fix devel sysupgrade

* fix ci stuck on .po
2023-01-03 19:35:44 +00:00
transifex-integration[bot]
47b1428a25
Translate '/po/en.po' in 'fr_FR' (#1882)
Translate /po/en.po in fr_FR

translation completed for the source file '/po/en.po'
on the 'fr_FR' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-03 19:30:47 +00:00
Jo
b3c334e014
fix(new_engine): fix devel sysupgrade (#1883)
fix devel sysupgrade
2023-01-03 19:24:28 +00:00
transifex-integration[bot]
b41e67f31e
Translate '/po/en.po' in 'sv' [manual sync] (#1876)
Translate /po/en.po in sv

at least 90% translated for the source file '/po/en.po'
on the 'sv' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-02 19:06:30 +01:00
transifex-integration[bot]
13109992c5
Translate '/po/en.po' in 'zh_CN' [manual sync] (#1877)
Translate /po/en.po in zh_CN

at least 90% translated for the source file '/po/en.po'
on the 'zh_CN' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-02 19:04:56 +01:00
transifex-integration[bot]
ed95688c1b
Translate '/po/en.po' in 'zh_TW' [manual sync] (#1878)
Translate /po/en.po in zh_TW

at least 90% translated for the source file '/po/en.po'
on the 'zh_TW' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-02 19:04:32 +01:00
transifex-integration[bot]
b8b085599a
Translate '/po/en.po' in 'fr_FR' [manual sync] (#1879)
Translate /po/en.po in fr_FR

at least 90% translated for the source file '/po/en.po'
on the 'fr_FR' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-02 19:03:50 +01:00
transifex-integration[bot]
7a2db4f448
Translate '/po/en.po' in 'it_IT' [manual sync] (#1880)
Translate /po/en.po in it_IT

at least 90% translated for the source file '/po/en.po'
on the 'it_IT' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-02 19:02:54 +01:00
transifex-integration[bot]
40f058fd19
Translate '/po/en.po' in 'cs' [manual sync] (#1873)
Translate /po/en.po in cs

at least 90% translated for the source file '/po/en.po'
on the 'cs' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-02 19:00:45 +01:00
transifex-integration[bot]
f771424336
Translate '/po/en.po' in 'de' [manual sync] (#1874)
Translate /po/en.po in de

at least 90% translated for the source file '/po/en.po'
on the 'de' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-02 18:59:38 +01:00
transifex-integration[bot]
36282a8192
Translate '/po/en.po' in 'id' [manual sync] (#1875)
Translate /po/en.po in id

at least 90% translated for the source file '/po/en.po'
on the 'id' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2023-01-02 18:58:51 +01:00
Jo
f372494d74
feat(search): add new bys and misc fixes (#1870)
* use default bin entry of gpg

* fix(dep): fix displayed information in chosen provide

* add new rpc bys to searchby

* man document
2022-12-30 19:02:32 +00:00
Jo
9be51052f7
update deps (#1868)
* update deps

* align struct
2022-12-29 18:42:43 +00:00
Jo
28d90c981e
feat(new engine): local install feature testing (#1867)
* make config into parameter

* test(new engine): local install test

* test(keys): fix test keys

* complete integration test for local install

* add simple mising mechanism
2022-12-29 12:34:53 +00:00
Joey H
d3fbfa26ca
fix(pre-commit): update URL and versions in the pre-commit configuration (#1865)
There was a dead link in the pre-commit-golang URL. Also, Woile/commitizen redirects to commitizen-tools/commitizen, so change that URL as well. Last, update all the versions using pre-commit autoupdate.

This will make it easier for new contributers to use the pre-commit
hooks when contributing.
2022-12-27 18:56:28 +00:00
Joey H
8c61bc9b45
fix(cmd): pass install flags into pacman in yogurt mode (#1864)
Fixes #1560
2022-12-27 18:55:42 +00:00
Joan Bruguera
2bda76e431
fix(clean): notify RemoveAll error when cleaning AUR (#1863)
otherwise if any hard-to-delete file lands in the AUR cache folder, running
`yay -Scc` will appear to succeed to the user, but actually abort midway.
2022-12-21 10:09:59 +01:00
Jo
9a23b792c4
Improve warning messages (#1857)
improve warning messages
2022-12-19 18:17:47 +00:00
Jo
4e3c664ab3
ci(yay) : attempt to use caches more effectively in CI (#1862)
* attempt to use caches more effectively

* fix cache key

* specify cache file
2022-12-18 20:42:22 +00:00
Jo
3eb9eb0d3d
feat(new_engine): add support for noDeps and noCheckDeps (#1861)
* feat(new engine): add support for noDeps and noCheckDeps

* test(new engine): Add tests for -dd and normal split package resolution
2022-12-18 20:14:41 +00:00
Jo
0b1ae938a3
fix(ci): do not install packages at pacman-git CI level (#1860)
* fix(ci): do not attempt to install extra packages for building pacman-git

* install needed in ci image

* fix missing pacman key

* wip

* add missing deps
2022-12-18 18:24:56 +00:00
Jo
f8e7891b0b
refactor(vcs): remove mux and use interface for other packages (#1859)
* refactor(vcs): remove context passing mutex from VCS interface

* simplify devel upgrade gather

* update vcs upgrade tests

* remove unused mock
2022-12-18 16:37:15 +00:00
Jo
4a3e365fc5
AUR provides search rpc (#1856)
* add support for provides search in AUR RPC client

* return provides search to default true
2022-12-18 02:36:49 +01:00
Jo
27cbbf4cb9
tests(new engine): add tests for layering and source handling (#1854)
* add tests for layering and source handling

* add tests for jellyfin split package
2022-12-18 02:00:39 +01:00
Jo
7da9f4869d
feat(new engine): skip built and respect --needed (#1852)
* add built package check

* respect --needed for new engine

* add needed check and test

* add test for not built
2022-12-16 17:23:44 +00:00
transifex-integration[bot]
c826456d4d
Translate '/po/en.po' in 'ko' (#1851)
Translate /po/en.po in ko

translation completed for the source file '/po/en.po'
on the 'ko' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-12-12 09:40:33 +00:00
transifex-integration[bot]
9df087bd3d
Translate '/po/en.po' in 'pt' (#1845)
Translate /po/en.po in pt

translation completed for the source file '/po/en.po'
on the 'pt' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-12-06 18:19:59 +01:00
Jo
1b5f0d66fe
Fix legacy engine install issues (#1842)
* fix debug pkg clearing pkg archive slice

* add debug messages and limit check for srcinfo

* treat pkgbuildDirs as expected directory, not proven directory

Co-authored-by: David Tomaschik <david@systemoverlord.com>

Co-authored-by: David Tomaschik <david@systemoverlord.com>
2022-11-29 13:23:52 +00:00
Jo
4f1f539217
Ignore last layer fails and keep building (#1841)
* fix: do not instantiate cleaning hooks if there's no AUR pkg

* chore: squash local and sync install

* still update completions in local mode

* allow failures on the last install layer
2022-11-29 12:25:36 +00:00
Jo
7612bb5da5
Mutualize local sync install (#1836)
* fix: do not instantiate cleaning hooks if there's no AUR pkg

* chore: squash local and sync install

* still update completions in local mode
2022-11-20 13:02:01 +00:00
Jo
9f67d10d5c
feat(v12): add group install (#1835)
v12engine: add group install
2022-11-20 02:47:23 +00:00
Jo
6ad63cae10
fix: rework menus to work on both flows (#1830)
* rework menus to work on both flows

* add installed package split

* remove unused field

* Add post install hooks
2022-11-20 00:51:55 +00:00
transifex-integration[bot]
63f20599cd
Translate '/po/en.po' in 'ca' (#1833)
Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-11-19 19:18:49 +00:00
Jo
0f45a99efa
yay v12: new AUR query engine, Local PKGBuild install, debug mode, new install engine + bugs (#1826)
yay v12: new AUR query engine, Local PKGBuild install, debug mode, new install engine + bugs (+bugs)
2022-11-16 01:32:26 +00:00
jguer
f52db80a9d
po update 2022-11-16 02:21:35 +01:00
jguer
7f151cd603
move addUpgradeToGraph to depgraph 2022-11-16 01:11:16 +01:00
jguer
2805252365
fix GraphFromTarget bug where empty DB would be used as identifier 2022-11-16 01:03:57 +01:00
jguer
481c63db91
remove local build from -U 2022-11-16 00:56:24 +01:00
jguer
5e8d9ac846
add make to dockerfile 2022-11-16 00:54:21 +01:00
jguer
085e2c8aea
rename -Ui to -Bi 2022-11-16 00:51:57 +01:00
jguer
1153ee6dbb
support multiple targets. Remove working directory logic 2022-11-16 00:45:59 +01:00
jguer
3f5eb36fe2
add gcc to build 2022-11-16 00:29:53 +01:00
jguer
2358a7f66e
use aur package metadata client 2022-11-16 00:25:17 +01:00
jguer
2560cadcc0
update aur package 2022-11-15 19:02:35 +01:00
jguer
c00cd8d88e
rename AUR metadata client 2022-11-15 16:22:57 +01:00
jguer
f042713aaa
fix: fix linting errors 2022-11-15 15:44:50 +01:00
jguer
ae918986f4
Merge remote-tracking branch 'origin/next' into jguer/local-pkgbuild-install 2022-11-15 15:19:30 +01:00
Jo
3f5dffc188
build: update golangci (#1829) 2022-11-15 14:17:56 +00:00
jguer
3f7f55f260
simplify src download 2022-11-14 01:14:13 +01:00
jguer
fd46fa0f33
fix failing errors 2022-11-14 00:25:14 +01:00
jguer
d7851223c6
correct nits from metadata package and remove uneeded functionality 2022-11-14 00:21:36 +01:00
jguer
5aeb0d696c
support contains 2022-11-13 23:53:37 +01:00
jguer
56a46644cc
metadata respect search by 2022-11-13 17:47:19 +01:00
jguer
01721c816c
refactor query builder to include AURClient 2022-11-13 14:29:00 +01:00
jguer
cc8c0a2366
fix non-prefixed version 2022-11-10 01:48:58 +01:00
jguer
6cbf00c5a7
typos 2022-11-08 01:37:54 +01:00
jguer
742b6ad79c
use aur cache for upgrades 2022-11-08 01:32:21 +01:00
jguer
9b576fbab7
update dependencies 2022-11-08 01:12:13 +01:00
jguer
bfb32ea63b
update dependencies 2022-11-08 01:11:57 +01:00
jguer
a724d1554f
check hook is not nil 2022-11-03 16:23:47 +01:00
jguer
3fc5d93243
add graph feeding 2022-11-02 00:37:27 +01:00
jguer
0b3ca79788
reduce scope 2022-11-01 23:51:24 +01:00
jguer
b5bdcfbd1a
add basic sync upgrade capabilities 2022-11-01 23:48:35 +01:00
jguer
776fc9686a
Merge remote-tracking branch 'origin/next' into jguer/local-pkgbuild-install 2022-10-28 23:58:23 +02:00
jguer
d3efb59da3
extract upgrade target adder 2022-10-28 23:58:15 +02:00
Jo
a88fad68d4
fix: fix wrong env var in readme for aur voting (#1823) 2022-10-28 20:57:23 +00:00
jguer
849e8f7b60
restore install support for legacy 2022-10-28 01:01:03 +02:00
jguer
ba935ccf95
add support for target install 2022-10-28 00:38:11 +02:00
Norbert Pfeiler
1f49b7e11c
align test numbers, also color expected output (#1815) 2022-10-11 08:39:08 +02:00
jguer
f496dbac8b
error refactor 2022-09-20 00:44:06 +02:00
jguer
bc4732e9e1
add debug mode 2022-09-20 00:11:10 +02:00
jguer
e4fdc9a4d4
readd makedep primitives 2022-09-20 00:01:19 +02:00
moson-mo
647d160182
add option/setting "AurRpcUrl" (#1809)
Signed-off-by: moson-mo <mo-son@mailbox.org>
2022-09-18 00:05:27 +00:00
jguer
c86c460816
fix typos 2022-09-17 14:45:07 +02:00
jguer
d646cd6c87
add base to name map 2022-09-17 14:31:54 +02:00
transifex-integration[bot]
7f9ac3435f
Translate '/po/en.po' in 'ca' (#1813)
Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-09-16 13:52:25 +02:00
jguer
ed94152cfe
first install 2022-09-12 00:18:38 +02:00
jguer
915799755b
allow pkgdest specification 2022-09-12 00:10:19 +02:00
jguer
351e352f64
basic aur install 2022-09-11 23:15:31 +02:00
jguer
5bb46ac1de
add repo install 2022-09-09 20:57:18 +02:00
jguer
4a73dfb0ca
topo sorted map 2022-09-09 17:38:48 +02:00
jguer
be036c39ff
wip 2022-09-08 18:04:51 +02:00
Mudskipper875
cd4462761a
Fix environment variable name in man-page (#1806) 2022-09-07 18:08:15 +02:00
jguer
d53505be37
allow customizing colors and embedding extra info 2022-09-07 01:03:29 +02:00
jguer
0aa18d61d5
cleanup 2022-09-07 00:01:23 +02:00
jguer
95e7542ade
Merge remote-tracking branch 'origin/next' into jguer/local-pkgbuild-install 2022-09-06 23:39:08 +02:00
jguer
cadeecc4df
add dep graph for local install 2022-09-06 23:38:47 +02:00
jguer
f7286b25ae
add local graph util 2022-09-06 23:25:44 +02:00
jguer
650809eba1
wip 2022-09-04 23:45:40 +02:00
davejab
0d1e339fda
Remove package from VCS on failed install (#1802) 2022-09-03 00:42:37 +00:00
linweiyuan
7ebe64871d
fix(yay): fix -Si alignment when language is Chinese (#1799) (#1803) 2022-08-29 15:33:48 +00:00
transifex-integration[bot]
14cc8d4ef0
Translate '/po/en.po' in 'cs' (#1804)
Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-08-29 15:25:22 +00:00
jguer
1d2d19c323
Merge remote-tracking branch 'origin/next' into jguer/local-pkgbuild-install 2022-08-23 23:29:27 +02:00
Jo
70695d7de7
chore(yay): avoid clearing panics in the main func (#1801) 2022-08-23 16:50:17 +00:00
jguer
a4565b367b
wip 2022-08-23 18:33:40 +02:00
jguer
cce21ce0b6
Merge remote-tracking branch 'origin/next' into jguer/local-pkgbuild-install 2022-08-23 17:22:10 +02:00
Jo
714fee0b18
Chore: Cleanup (#1800) 2022-08-22 22:20:09 +00:00
jguer
b054828aa8
wip 2022-08-22 23:28:53 +02:00
jguer
859b7c703f
add local install handle 2022-08-21 07:15:04 +02:00
jguer
446dc86d1e
add handle upgrade 2022-08-21 07:08:01 +02:00
Jordan Cannon
b6b1888e89
Remove duplicate line from man page (#1792)
Co-authored-by: Jo <me@jguer.space>
2022-08-16 09:08:51 +02:00
transifex-integration[bot]
b882faf48a
Translate '/po/en.po' in 'fr_FR' (#1794)
Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-08-15 20:37:06 +00:00
Jo
2a2040c570
chore: use stdlib vars in code (#1793) 2022-08-14 17:41:54 +00:00
Jo
458c69e179
Update README.md 2022-08-14 16:59:09 +00:00
Jo
6ffa86908a
Bump dependencies (#1791)
* bump deps

* release as minor
2022-08-14 16:03:56 +00:00
transifex-integration[bot]
221b86bea4
Translate '/po/en.po' in 'zh_TW' (#1790)
Translate /po/en.po in zh_TW

translation completed for the source file '/po/en.po'
on the 'zh_TW' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-08-14 15:57:43 +00:00
Jo
ae6c2deda0
remove zh-Hans (#1789)
* remove zh-Hans

* remove zh-Hans from makefile
2022-08-14 15:41:22 +00:00
transifex-integration[bot]
64a26ca2bc
Translate '/po/en.po' in 'zh_CN' (#1788)
* Translate /po/en.po in zh_CN

translation completed for the source file '/po/en.po'
on the 'zh_CN' language.

* Update po/zh_CN.po

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
Co-authored-by: Jo <me@jguer.space>
2022-08-14 15:40:11 +00:00
Jo
888fb4b1d0
Fix minor question and locale issues (#1786)
* add missing locales

* use t.Setenv instead of os.Setenv for tests

* locale: present y/n if localisation is not latin. Always accept y/n in every case

* question: use operation info for question

* edge case where localised n is equal to default y

* add tests for basic locales
2022-08-13 22:56:23 +00:00
transifex-integration[bot]
85934bddea
Translate '/po/en.po' in 'zh-Hans' (#1784)
Translate /po/en.po in zh-Hans

translation completed for the source file '/po/en.po'
on the 'zh-Hans' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-08-13 20:24:16 +00:00
transifex-integration[bot]
c339a605de
Translate '/po/en.po' in 'sv' (#1785)
Translate /po/en.po in sv

translation completed for the source file '/po/en.po'
on the 'sv' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-08-13 20:23:50 +00:00
transifex-integration[bot]
0b6446f927
Translate '/po/en.po' in 'uk' (#1780)
Translate /po/en.po in uk

translation completed for the source file '/po/en.po'
on the 'uk' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-08-09 20:55:20 +00:00
Jo
e2f61255cb
Merge pull request #1779 from Jguer/jguer/migrate-provides
Config: Add migration service and migrate provides default value
2022-08-05 21:41:26 +00:00
jguer
35c91bea50
remove arm v6 support 2022-08-05 23:13:46 +02:00
jguer
c0a9b6af4f
Remake ci.Dockerfile 2022-08-05 23:05:20 +02:00
jguer
1a52da5891
Make provides disabled by default. Add Migration to set provides to disabled 2022-08-05 22:55:54 +02:00
jguer
4d5131d6c7
fixed VCS temp file remove 2022-08-05 18:56:28 +02:00
Oliver Tzeng
2214d99f8e
Created zh_TW.po (#1776) 2022-08-05 14:33:16 +00:00
transifex-integration[bot]
6f60892356
Translate '/po/en.po' in 'ru_RU' (#1745)
Translate /po/en.po in ru_RU

translation completed for the source file '/po/en.po'
on the 'ru_RU' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-07-20 14:29:06 +02:00
transifex-integration[bot]
216acead86
Translate '/po/en.po' in 'tr' (#1754)
Translate /po/en.po in tr

translation completed for the source file '/po/en.po'
on the 'tr' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-07-20 14:28:59 +02:00
transifex-integration[bot]
bda2165205
Translate '/po/en.po' in 'ko' (#1775)
Translate /po/en.po in ko

translation completed for the source file '/po/en.po'
on the 'ko' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-07-20 14:28:52 +02:00
vqrkxo
e0006ec272
feat(aur): add option to limit concurrent downloads (#1768)
* feat(aur): add option to limit concurrent downloads

Adds to config file option 'maxconcurrentdownloads' which if set to
value != 0, limits number of concurrent AUR downloads to specified.
Fixes #1763.

* fix lint issue
2022-06-28 12:05:29 +02:00
vqrkxo
18fbc24e68
fix(cmd): fix support for --defaultconfig (#1767)
This change fixes #1766.
2022-06-27 09:48:34 +02:00
Jguer
0fdfe79943
Add experimental vote util to yay (#1765)
* feat(vote): add vote utility

* update deps

* add vote and unvote capabilities

* use -W for web ops

* add fish completions

* add bash completion

* add zsh completion

* add md instructions
2022-06-17 16:55:22 +00:00
Jguer
44a0a243ed
remove gock from completion package (#1764)
* remove gock from completion package

* fix ci builder

* undo changes to default flow
2022-06-17 16:49:41 +00:00
jguer
70a9765854
bump minor 2022-06-17 10:01:53 +02:00
jguer
5439229c7d
disable noseparatesources by default 2022-06-10 18:31:21 +02:00
jguer
edef790532
update deps 2022-06-10 17:47:37 +02:00
jguer
4ca50e55f0
fix(yay): fix --yay typo. fixes #1752 2022-05-16 23:05:23 +02:00
jguer
c83b48d474
update deps 2022-05-16 23:02:34 +02:00
cubercsl
ed2f533534
docs: remove tuna aur config for China users (#1747)
Tuna has removed the aur proxy service since 01Mar:
- https://mirrors.tuna.tsinghua.edu.cn/news/remove-aur/
- tuna/issues#1424
2022-05-03 22:15:17 +02:00
jguer
74cf1f7542
update deps 2022-04-12 09:40:41 +02:00
transifex-integration[bot]
bd3e6c5236
Translate /po/en.po in id (#1742)
translation completed for the source file '/po/en.po'
on the 'id' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-04-10 16:22:56 +00:00
Drumstickx
94cff87927
Fix ContinueTask user prompt for locales with uppercase yes (#1735)
* Fix ContinueTask user prompt for locales with uppercase yes

The yes/y strings have to be converted to lowercase to enable matching of
the user input converted to lowercase. Otherwise, locales with uppercase
yes/y strings (e.g., German: `Ja/J`) will never match.

* Addess linter issue

* Remove obsolete lowercase conversion
2022-03-31 14:19:43 +02:00
transifex-integration[bot]
85023f7197
Translate /po/en.po in pt (#1732)
translation completed for the source file '/po/en.po'
on the 'pt' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-03-31 14:19:34 +02:00
transifex-integration[bot]
0f62b567ef
Translate /po/en.po in es (#1740)
translation completed for the source file '/po/en.po'
on the 'es' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-03-30 21:22:38 +00:00
transifex-integration[bot]
281ec1c926
Translate /po/en.po in de (#1739)
translation completed for the source file '/po/en.po'
on the 'de' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-03-30 21:22:11 +00:00
transifex-integration[bot]
ed62496025
Translate /po/en.po in it_IT (#1730)
translation completed for the source file '/po/en.po'
on the 'it_IT' language.
2022-03-23 10:08:08 +01:00
jguer
e773c7662c
update go-alpm 2022-03-07 17:57:20 +01:00
J Guerreiro
b8f054f988
fix(po): Update default po file (#1722)
* update default po file

* fix string
2022-03-07 10:35:20 +01:00
J Guerreiro
e4a1f018ea
feat(search): Add fuzzy name matching and mixed sources (#1719)
* fix(alpm): fix callback text

* feat(yay): Add mixed search result

* remove old result structs

* add option for controlling query builder

* only set query builder after parsing args

* add parser args

* update manpage

* write test for results

* write test for results

* mixed source test

* only sort 1 time with every mode
2022-03-06 23:48:15 +00:00
J Guerreiro
ae01f8e4a0
feat(config): Add version marker (#1720)
* only run on PRs

* prefer manual tags

* add defaults for tests

* cuddle assignment
2022-03-04 23:30:15 +00:00
J Guerreiro
dc9bef0115
fix(ci): fix builds against pacman-git (#1718)
* fix(ci): fix builds against pacman-git

* fix(ci): fix builds against pacman-git

* update dockerfile

* update dockerfile

* update dockerfile

* fix(ci): fix builds against pacman-git

* fix(ci): fix builds against pacman-git

* update go-alpm

* update alpm

* return to lopsided images

* go mod tidy
2022-03-04 23:04:55 +00:00
xvqxy
b52e3cf0d2
fix(aur): -Ss fails on multi arg if no results. (#1716)
This fixes #1674.

If search command included multiple packages and no results were found
in AUR, response from `query.queryAUR` was returned
as nil slice instead of non-nil empty slice and as nil slice is treated
during subsequent validation in `query.SourceQueryBuilder.Results` as
meaning that searching in AUR was not executed, command was failing.
Now empty non-nil slice is returned if results were not found.
2022-02-21 09:14:11 +00:00
Eng Zer Jun
83a257b16b
test: use T.TempDir to create temporary test directory (#1709)
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-02-11 09:30:54 +01:00
transifex-integration[bot]
f719a6ffca
Translate /po/en.po in tr (#1707)
translation completed for the source file '/po/en.po'
on the 'tr' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-02-10 18:25:39 +01:00
J Guerreiro
7f5a060324
feat(yay): Add support for PACMAN_AUTH (#1706) 2022-02-08 09:39:41 +01:00
transifex-integration[bot]
7f7b69447d
Translate /po/en.po in de (#1705)
translation completed for the source file '/po/en.po'
on the 'de' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-02-07 19:30:05 +00:00
transifex-integration[bot]
ba222c87f6
Translate '/po/en.po' in 'fr_FR' (#1703)
* Translate /po/en.po in fr_FR

translation completed for the source file '/po/en.po'
on the 'fr_FR' language.

* Update po/fr_FR.po

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
Co-authored-by: J Guerreiro <me@jguer.space>
2022-02-07 10:05:58 +01:00
transifex-integration[bot]
ddd8e0e1f2
Translate /po/en.po in it_IT (#1701) 2022-02-06 22:23:07 +00:00
Norbert Pfeiler
9c2d4ec0d1
feat(stats): add statistics about pacman and yay cache sizes (#1679) 2022-02-06 09:53:34 +00:00
jguer
2a3ddafce5
fix(deps): fix conflict line being printed in new line 2022-02-06 10:49:57 +01:00
jguer
0e3affd876
fix(input): fix display in wrong line of number input 2022-02-06 10:44:33 +01:00
jguer
c5bea07f64
chore(version): small patching to version 2022-02-06 10:06:31 +01:00
transifex-integration[bot]
712665e531
Translate /po/en.po in fr_FR (#1690)
at least 95% translated for the source file '/po/en.po'
on the 'fr_FR' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-02-05 13:40:17 +00:00
transifex-integration[bot]
87415a8d20
Translate /po/en.po in de (#1691)
at least 95% translated for the source file '/po/en.po'
on the 'de' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-02-05 13:40:11 +00:00
transifex-integration[bot]
58ac44c748
Translate /po/en.po in id (#1692)
at least 95% translated for the source file '/po/en.po'
on the 'id' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-02-05 13:39:51 +00:00
transifex-integration[bot]
527534af91
Translate /po/en.po in it_IT (#1693)
at least 95% translated for the source file '/po/en.po'
on the 'it_IT' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-02-05 13:39:44 +00:00
transifex-integration[bot]
8ac1da8115
Translate /po/en.po in pt (#1694)
at least 95% translated for the source file '/po/en.po'
on the 'pt' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-02-05 13:39:36 +00:00
transifex-integration[bot]
2de6d35709
Translate /po/en.po in pt_BR (#1695)
at least 95% translated for the source file '/po/en.po'
on the 'pt_BR' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-02-05 13:39:29 +00:00
transifex-integration[bot]
165433d1e3
Translate /po/en.po in es (#1696)
at least 95% translated for the source file '/po/en.po'
on the 'es' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-02-05 13:39:22 +00:00
transifex-integration[bot]
7feac514f7
Translate /po/en.po in tr (#1697)
at least 95% translated for the source file '/po/en.po'
on the 'tr' language.

 Manual sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2022-02-05 13:39:14 +00:00
jguer
4df76fd9fe
chore(locale): update en.po 2022-02-05 14:29:04 +01:00
J Guerreiro
d83c5ca5a1
fix(deps): update deps (#1689) 2022-02-05 14:25:59 +01:00
mh4ckt3mh4ckt1c4s
e9d8894a37
Fix(AUR): Fix end of php use on AUR API (#1685)
* Fixed end of php use on AUR API

* Added a / to the end of rpc to respect the AUR RPC doc

* Removed the / due to the "AUR unavailable at this moment" error
2022-02-05 12:56:10 +00:00
Norbert Pfeiler
19d42ae3cd
fix(yay): Total foreign → Foreign (#1680)
Rename -Ps option
2022-02-03 09:58:55 +01:00
jguer
09695c694f
remove noisy funding sources 2022-01-13 18:04:49 +01:00
jguer
65ecee9cb6 chore(deps): update ci 2022-01-03 13:46:52 +00:00
jguer
1c22cc491c chore(linting): code lint 2022-01-03 13:46:52 +00:00
jguer
d02321bdc9 chore(dep): rename pool creator 2022-01-03 13:46:52 +00:00
jguer
ac13060bfd
chore(locale): update po files 2022-01-02 21:20:11 +01:00
transifex-integration[bot]
0f5df3cbad
Chore: Translate /po/en.po in id (#1662)
translation completed for the source file '/po/en.po'
on the 'id' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2021-12-30 09:28:15 +01:00
transifex-integration[bot]
2552cf1e22
Translate /po/en.po in pt_BR (#1656)
translation completed for the source file '/po/en.po'
on the 'pt_BR' language.

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2021-12-22 17:26:34 +01:00
Дамјан Георгиевски
f7dbebcc2c
fix(exec): add --quiet to systemd-run (#1654)
* add --quiet to systemd-run

this will avoid the `Press ^] three times within 1s to disconnect TTY.` message.

it's mentioned in the systemd-run man page too:
```
--quiet, -q
    Suppresses additional informational output while running. This is particularly useful in combination with --pty when it will suppress the
    initial message explaining how to terminate the TTY connection.
```

* add --quiet to the tests

* add --quiet to TestABSPKGBUILDRepoExistsPerms too
2021-12-20 17:49:25 +01:00
jguer
a9702da300
chore(cmd): reduce install calls 2021-12-18 21:39:01 +01:00
jguer
81eeb8c495
fix(download): use git pull --rebase --autostash instead of --ff-only. fixes #1635 2021-12-12 19:05:48 +01:00
JohnTheCoolingFan
bf288822b9 Update ru_RU.po to match pacman translation
Changed "Optional Deps" and "Provides" to match with pacman translation.
2021-12-12 17:29:27 +00:00
jguer
6c09d9bf33
chore(yay): exempt bugs and triage from stale 2021-12-10 09:06:37 +01:00
Cyrus Yip
c0507e7f8e chore(readme): improve format of FAQ 2021-12-06 18:01:18 +00:00
Thomas Dupond
7e8d61c017 Prefer VISUAL over EDITOR for editmenu 2021-12-06 07:38:01 +00:00
jguer
9ebc98e80f
chore(yay): update deps 2021-12-04 19:48:25 +01:00
transifex-integration[bot]
17c20f5cd9 Translate /po/en.po in tr
translation completed for the source file '/po/en.po'
on the 'tr' language.
2021-11-27 02:15:10 +01:00
ccn
0b2bddf9d0 Add command to install quickly
add in a command which will do all of the installation steps at once.
2021-11-27 02:14:03 +01:00
transifex-integration[bot]
df6af2e1e4 Translate /po/en.po in de
translation completed for the source file '/po/en.po'
on the 'de' language.
2021-11-21 16:27:11 +01:00
transifex-integration[bot]
40561093f1 Translate /po/en.po in fr_FR
translation completed for the source file '/po/en.po'
on the 'fr_FR' language.
2021-11-13 10:23:23 +01:00
transifex-integration[bot]
58bbcb3716 Translate /po/en.po in it_IT
translation completed for the source file '/po/en.po'
on the 'it_IT' language.
2021-11-13 10:22:51 +01:00
jguer
e38d0138a6 feat(yay): simplify sort mode and use it for calculating number menu indices, fixes #1627 2021-11-07 00:18:26 +01:00
Matt Alexander
53e8ec70f8 fix(search): Fixed unit test; make test names unique and more descriptive 2021-11-05 09:26:34 +01:00
Matt Alexander
22c165a11f feat(search): add optional setting that formats each search result on a single line, Part II 2021-11-05 09:26:34 +01:00
Matt Alexander
1c238dd724 fix(docs): Add reference to make lint in section talking about go fmt. 2021-11-05 09:26:34 +01:00
Matt Alexander
673f077e7f feat(search): add optional setting that formats each search result on a single line 2021-11-05 09:26:34 +01:00
jguer
f88bf5c212
fix(search): in case there are no results, don't display number menu 2021-11-03 00:04:00 +01:00
transifex-integration[bot]
02d33f63c0 Translate /po/en.po in de
translation completed for the source file '/po/en.po'
on the 'de' language.
2021-11-02 15:31:47 +01:00
transifex-integration[bot]
38b66fee63 Translate /po/en.po in es
translation completed for the source file '/po/en.po'
on the 'es' language.
2021-11-02 15:31:04 +01:00
jguer
15d91e4661
fix(search): revert repo query revert. Fixes #1623 2021-10-28 17:41:51 +02:00
jguer
57a9630054 chore(alpm): use text.getinput for ialpm 2021-10-27 23:45:23 +02:00
jguer
9eb73899fe chore(query): unify search in number menu selection and normal search 2021-10-27 23:45:23 +02:00
jguer
44cf54795d chore(text): use getInput for number pick deps 2021-10-27 23:45:23 +02:00
jguer
f925b719e8 chore(text): make input overflow its own error 2021-10-27 23:45:23 +02:00
jguer
005c5c24b4 chore(globals): rename config->globals for easier understanding 2021-10-27 23:45:23 +02:00
jguer
e4b1cb6e7d chore(menus): squish clean menu into diff/edit menu 2021-10-27 23:45:23 +02:00
jguer
49577191c6 chore(menus): refactor editDiff menus 2021-10-27 23:45:23 +02:00
jguer
d096d15973 feat(menus): extract menus package 2021-10-27 23:45:23 +02:00
jguer
6364b4efe8 fix(menus): improve edit and diff menu structure 2021-10-27 23:45:23 +02:00
jguer
f3c3e2e4d4 fix(clean_menu): optimize any base installed 2021-10-27 23:45:23 +02:00
jguer
a43fbacc96 fix(clean_menu): anyExistInCache already verifies if cleanMenu is necessary 2021-10-27 23:45:23 +02:00
jguer
1fb9f410a6 chore(install): reduce scope of toSkipSlice 2021-10-27 23:45:23 +02:00
jguer
34e81d5d7d fix(clean_menu): clean menu errors don't exit yay anymore 2021-10-27 23:45:23 +02:00
jguer
3fef4ae1e3 test(build-dir): add regression tests for non-existing build dir 2021-10-15 19:58:59 +02:00
jguer
12a6d4f5c1
fix(cache): create build directory if not systemd-run directory. closes #1612 2021-10-15 19:22:28 +02:00
jguer
52efaeba52
chore(yay): bump hardcoded version 2021-10-10 11:05:52 +02:00
jguer
2218e05981
fix(clean): missing dir caused failure to clean. closes #1610 2021-10-10 11:01:59 +02:00
jguer
3a6654b0c5
chore(yay): bump hardcoded version 2021-10-09 23:21:33 +02:00
jguer
8238bc9f88
chore(deps): update dependencies 2021-10-09 23:16:14 +02:00
morganamilo
1a0cfd85f2 Fix caps in search leading to no results 2021-10-05 09:06:26 +02:00
jguer
b2a728151e
test(news): remove parallel from test with race 2021-09-09 09:03:48 +02:00
jguer
4122716ea1
fix(yay): display network error on yay number menu, closes #1172 2021-09-08 23:02:49 +02:00
jguer
84e872ebe3
test(news): add test case for edge case of news in same day as build 2021-09-08 22:48:55 +02:00
jguer
555d1ead95
chore(version): bump major version 2021-09-08 22:28:08 +02:00
jguer
ba1e06d367
feat(cmd): remove unused absdir option 2021-09-08 22:25:55 +02:00
jguer
adb74b9252 chore(su): prefer short form if 2021-09-07 00:41:36 +02:00
jguer
ffb17fd2e3 feat(su): deelevate if ran as su without tool 2021-09-07 00:41:36 +02:00
jguer
bc1d900fa9 feat(su): deelevate if ran as su using a privilege elevation tool 2021-09-07 00:41:36 +02:00
Tom Boettger
251c456d70 Fix typo in readme
pacakge -> package
2021-09-03 20:51:15 +02:00
jguer
2eafbcc03e
chore(readme): update install instructions. closes #1435 2021-08-31 02:50:51 +02:00
jguer
c8fcdeae5b feat(su): use alternative privilege elevators when sudo is not available
When sudobin/custom wrapper is not available try the following in order:

- sudo
- doas
- pkexec
- su
2021-08-31 02:17:27 +02:00
Eng Zer Jun
e43c712c84 refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated in Go 1.16. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-08-26 15:17:47 +02:00
jguer
1869bbe291
chore(install): prefer short form ifs 2021-08-23 17:37:58 +02:00
jguer
b7f9a5e677
fix(install): fix missing error display in install 2021-08-21 16:17:19 +02:00
jguer
cedbcfbcda
fix(cmd): fix -h on yay show and get. closes #856 2021-08-21 15:32:37 +02:00
jguer
a1941b24bf chore(docker): remove label 2021-08-21 15:16:28 +02:00
jguer
074798aca5 chore(docker): update golangci and squash ops 2021-08-21 15:16:28 +02:00
jguer
e14fe638c2 chore(go): update minimum go version to 1.17 2021-08-21 15:16:28 +02:00
jguer
5be99d9bf0 chore(README): small reorganization of README 2021-08-20 18:33:52 +02:00
jguer
1d903b6c7e test(sources): add PKGBUILD source tests 2021-08-17 14:26:57 +02:00
jguer
aedbcffc80 feat(sources): concurrent makepkg downloading 2021-08-17 14:26:57 +02:00
jguer
5d9e424942 chore(translations): update base po 2021-08-14 08:58:17 +02:00
transifex-integration[bot]
401922a6ed Translate /po/en.po in sv
translation completed for the source file '/po/en.po'
on the 'sv' language.
2021-08-14 08:35:16 +02:00
transifex-integration[bot]
c8c3f812f6 Translate /po/en.po in fr_FR
translation completed for the source file '/po/en.po'
on the 'fr_FR' language.
2021-08-14 08:33:47 +02:00
transifex-integration[bot]
0fccb9baaf Translate /po/en.po in es
translation completed for the source file '/po/en.po'
on the 'es' language.
2021-08-14 08:33:35 +02:00
transifex-integration[bot]
70e390f939 Translate /po/en.po in eu
translation completed for the source file '/po/en.po'
on the 'eu' language.
2021-08-14 08:33:21 +02:00
transifex-integration[bot]
a05ba32acf Translate /po/en.po in ko
translation completed for the source file '/po/en.po'
on the 'ko' language.
2021-08-14 01:00:02 +02:00
transifex-integration[bot]
d007a54e3a Translate /po/en.po in ru_RU
translation completed for the source file '/po/en.po'
on the 'ru_RU' language.
2021-08-14 00:59:46 +02:00
transifex-integration[bot]
0db92c990f Translate /po/en.po in pt_BR
translation completed for the source file '/po/en.po'
on the 'pt_BR' language.
2021-08-14 00:59:13 +02:00
transifex-integration[bot]
87dc57323b Translate /po/en.po in ja
translation completed for the source file '/po/en.po'
on the 'ja' language.
2021-08-14 00:58:45 +02:00
jguer
e231b2b02d chore(yay): modernize exec commands 2021-08-14 00:10:43 +02:00
jguer
3de02dbd73 fix(install): -debug sufix is optional 2021-08-11 22:28:24 +02:00
jguer
49ef780602 chore(makefile): add atomic cover back to go test 2021-08-11 22:19:55 +02:00
jguer
95bc333a92 test(yay): port tests to parallel 2021-08-11 22:19:55 +02:00
jguer
cb4b57f6d8 chore(golangci): add new linters 2021-08-11 22:19:55 +02:00
jguer
08d1305ec5 feat(download): respect aur url settings and update deps 2021-08-11 22:19:55 +02:00
jguer
f42cbde6db refactor(parser): unify atleast modes 2021-08-09 13:32:55 +02:00
jguer
5c11c01d85 refactor(exe): move sudo loop into CmdBuilder 2021-08-08 21:02:35 +02:00
jguer
444151de0d refactor(vcs): implement GitBuilder interface 2021-08-08 17:45:07 +02:00
jguer
fc20bde10d chore(prettier): apply prettier on files 2021-08-08 17:45:07 +02:00
jguer
172ee1f4e8 refactor(exe): port pacman calls to cmd_builder 2021-08-08 17:45:07 +02:00
jguer
1a2e5b9529 refactor(settings): move args to own package to allow pacman cmd builder 2021-08-08 17:45:07 +02:00
jguer
456d83ef51 fix(download): cloned reflects if package was pulled or cloned 2021-08-07 19:17:58 +02:00
jguer
186c7a54fe fix(dep): ensure assume-installed works with depstrings 2021-08-07 19:17:58 +02:00
Jonas Bögle
7dda0fa2f8 fix: skip --assume-installed packages 2021-08-07 19:17:58 +02:00
jguer
1c96fd2d9d refactor(diff): move diff functions to dedicated file 2021-08-07 19:17:58 +02:00
jguer
522247dca2 feat(install): use download package for PKGBUILD repo download 2021-08-07 19:17:58 +02:00
jguer
4a515c4462 test(downloads): remove non reproducible tests 2021-08-05 10:11:54 +02:00
jguer
ab902e9cc6 chore(vcs): port VCS to download package 2021-08-05 10:11:54 +02:00
jguer
b8641256ab chore(download): rename PKGBUILD function to match package 2021-08-05 10:11:54 +02:00
jguer
65b1c4be69 refactor(main): move get cmds to their own file 2021-08-05 10:11:54 +02:00
jguer
2ed099a263 chore(download): unify filtering logic between commands 2021-08-05 10:11:54 +02:00
jguer
98378642bc test(download): add tests for repo downloading 2021-08-05 10:11:54 +02:00
jguer
413ad23abc chore(download): rename public functions 2021-08-05 10:11:54 +02:00
jguer
79b44fd544 feat(download): download PKGBUILD repos interface 2021-08-05 10:11:54 +02:00
jguer
50c0ece9a7 chore(style): run gofumpt on packages 2021-08-05 10:11:54 +02:00
Peter Wu
827adab4b8 Update yay.8 2021-07-31 16:47:16 +02:00
jguer
99c3c98264
fix(docker): fix dockerfile formatter removing breakline 2021-07-29 22:22:32 +02:00
jguer
20d5fd406f fix(download): fix -Gp for repository packages 2021-07-26 09:07:27 +02:00
jguer
d460e7ae5b
chore(ci): update golangci, delete old test_script 2021-07-25 12:19:59 +02:00
jguer
e4a933da52 fix(upgrade): add special devel fix for vscode 2021-07-25 11:53:14 +02:00
Oliver Mangold
4a9319920b fixing URLs for ABS after upstream change from git.archlinux.org to github 2021-07-13 18:39:18 +02:00
jguer
61e38ad2fc chore(pacman): remove pacman 5 support 2021-07-03 18:27:14 +02:00
OneOfOne
c9e63fff0d Makefile: GOFLAGS-> FLAGS since it's a reserved kw 2021-07-03 18:02:56 +02:00
jguer
169d5f1f62 fix(vcs): make command error more explicit 2021-07-03 17:15:36 +02:00
jguer
d6cb4c50e8 fix(locale): add ko to makefile LANGs 2021-06-27 11:54:14 +02:00
Adenosie
2ac2374b47 Add Korean translation 2021-06-13 20:10:34 +02:00
jguer
040c8fe380 fix(aur): fix lint issue 2021-06-09 03:57:37 +02:00
jguer
8fd4f78400 chore(aur): update to latest version 2021-06-09 03:57:37 +02:00
jguer
93bb2867be chore(http): use client for yay -Sl 2021-06-09 03:57:37 +02:00
jguer
a37f4efd73 chore(http): use client for pkg completions 2021-06-09 03:57:37 +02:00
jguer
c7cf7baa48 chore(http): use client for news feed 2021-06-09 03:57:37 +02:00
jguer
e20ab8b6a2 fix(aur): fix wrong string usage 2021-06-09 03:57:37 +02:00
jguer
545ea772eb feat(aur): customize User Agent 2021-06-09 03:57:37 +02:00
jguer
6e70e2a59d
chore(update): bump minor 2021-06-03 22:02:23 +02:00
jguer
c922cb3509
chore(update): tentative fix of docker oom 2021-06-03 21:46:41 +02:00
jguer
059ca9d9b8
chore(update): use ubuntu-latest for builder image 2021-06-01 23:36:50 +02:00
jguer
418b578e9e
chore(upgrade): add pacman to install list
Revert "chore(update): fix line break"

This reverts commit a24fb50e6d6f17b57d99e1c0e2d1c3421f24cb32.

Revert "chore(update): update golangci and force rebuild"

This reverts commit 25efafe25e18e4ddd85be51b866ced7481b5fcb0.
2021-06-01 23:09:17 +02:00
jguer
a24fb50e6d
chore(update): fix line break 2021-06-01 21:19:50 +02:00
jguer
25efafe25e
chore(update): update golangci and force rebuild 2021-06-01 08:34:16 +02:00
x1b6e6
ba3c66949a fix(sync) Don't asks for provider twice 2021-05-26 13:51:17 +02:00
jguer
4993e4dfbd
chore(makefile): tag smaller release 2021-05-10 08:53:12 +02:00
jguer
c153631064
ci(release): tweak release 2021-05-08 00:38:32 +02:00
jguer
b0d87b7a09
chore(makefile): change default patch 2021-05-08 00:36:03 +02:00
jguer
ab0ce0aeb9
chore(deps): update dependencies 2021-05-08 00:31:19 +02:00
jguer
8e6d098ff8
fix(deps): fix regression on CombinedDepList 2021-05-08 00:29:33 +02:00
x1b6e6
662c630a08 main_test: diaable checking TotalDownload conf
`TotalDownload` is removed in pacman 6. We can't leave it enabled for
pacman 5 and disable for pacman 6, so we disable it for both.
2021-05-07 23:30:08 +02:00
x1b6e6
faf03436a7 Sync with go-alpm v2.0.5 2021-05-07 23:30:08 +02:00
x1b6e6
7ade2afd78 add testing with pacman-git 2021-05-07 18:03:57 +02:00
x1b6e6
767c7975f3 fix test using multiple 'Architecture' value
Signed-off-by: x1b6e6 <ftdabcde@gmail.com>
2021-05-04 08:43:56 +02:00
x1b6e6
de113b87f3 Add support for multiple 'Architecture' values
This allows architecture to be multivalued. On x86-64 machines, this
could be something like:
    Architecture = x86-64-v3 x86-64

We use the first specified Architecture value in mirrorlist $arch
variable replacement, as this is backwards-compatible and sane.

More info:
https://git.archlinux.org/pacman.git/commit/?id=3179db108a83104d9de6d1d607f55f8118e92160

Signed-off-by: x1b6e6 <ftdabcde@gmail.com>
2021-05-04 08:43:56 +02:00
morganamilo
29f4c43227 Sort upslice by pacman repo order 2021-04-24 17:28:53 +02:00
morganamilo
f04a469324 Make UpSlice a struct instead of a type alias 2021-04-24 17:28:53 +02:00
Ferdinand Bachmann
64e5b9e93d fix(query): allocate capacity in filterDebugPkgs
(addresses review in PR #1484 by Jguer)
2021-04-20 22:01:46 +02:00
Ferdinand Bachmann
3efb43af95 feat(query): list debug packages missing from AUR separately 2021-04-20 22:01:46 +02:00
Porrumentzio
5184ef6a04 Update eu.po 2021-04-20 22:00:30 +02:00
Porrumentzio
f3dd3467ec Update eu.po 2021-04-20 22:00:30 +02:00
Porrumentzio
93d3c87624 Update eu.po
```
135    #: print.go:281
136    msgid "Check Deps"
```
_Dependencies that make checking_, _Currently checking dependencies_ or _The process of checking dependencies_?

```
299    #: print.go:298
300    msgid "Package Base ID"
301    msgstr "Pakete Base IDa"
302    
303    #: print.go:299
304    msgid "Package Base"
305    msgstr "Pakete Base-a"
```
Is _Package Base_ a proper noun or simpli _The base of the package_?

```
363    #: print.go:300
364    msgid "Snapshot URL"
365    msgstr "Snapshot-aren URLa"
```
What does mean Snapshot here? Is it an "image" of the repo or package, meaning that maintains that version?
2021-04-20 22:00:30 +02:00
jguer
85fe90c95f
ci(yay): tweak release notary 2021-04-12 17:21:29 +02:00
jguer
d3bc19a003 fix(yay): fix proxy settings 2021-04-12 16:54:51 +02:00
jguer
ca7165ecb6 ci(yay): update golangci and remove deprecated 2021-04-12 16:54:51 +02:00
jguer
2da1e154c2
fix(yay): strip release bin 2021-03-20 18:59:46 +01:00
jguer
6d4c2472d8 fix(yay): use upstream flags 2021-03-20 18:41:29 +01:00
jguer
829f944659
fix(output): don't print exit status message 2021-03-18 22:40:37 +01:00
jguer
d1a6ead81c style(deps): reduce scope where possible 2021-03-17 23:18:44 +01:00
jguer
a33f43f502 feat(deps): don't install check deps if --nocheck is passed.
feat(makepkg): automatically pass -d to makepkg if -dd is passed
2021-03-17 23:18:44 +01:00
jguer
d7424b1b28 feat(install): implement support for -dd 2021-03-17 23:18:44 +01:00
jguer
5da8161328 chore(install): reduce cognitive load 2021-03-17 23:18:44 +01:00
jguer
7a280e0199 fix(install): simplify sysupgrade 2021-03-17 23:18:44 +01:00
jguer
ece81fa078
chore(yay): bump for next version and add funding options 2021-03-16 19:26:23 +01:00
J Guerreiro
5f2a14d027
add asciicast 2021-03-15 23:54:30 +01:00
jguer
3d585877ba ci(yay): update golangci 2021-03-13 12:24:01 +01:00
jguer
bfd5ca6024
ci(github): tame stale bot 2021-03-13 12:21:15 +01:00
jguer
4b476a0e78
fix(sudoloop): reduce sudoloop sleep, fixes #1379 2021-03-13 12:08:11 +01:00
jguer
b7f730a59a
fix(sudoloop): stop update sudo from taking extra flags, fixes #1427 2021-03-13 12:06:31 +01:00
Julian Daube
348f2de85c fix(yay): mirror pacman return codes on run error
makepkg expects pacman-alikes to return 127 (missing dependency)
when called with -T as argument. yay does not behave like this since
it overwrite the return value with 1 in every case.

This commit will test for ExitCode errors and return the called
applications error code instead of 1, when possible. This gets yay
closer to be used as pacman alternative for makepkg with

```
PACMAN=yay makepkg -s
```

fixes  Jguer/yay#1455
2021-03-12 20:42:42 +01:00
D1CED
c8a74cb4a4 prevent leaking goroutines 2021-03-12 20:41:55 +01:00
D1CED
260594f42a disable interfacer check 2021-03-12 18:11:30 +01:00
D1CED
eb9ff86aa9 fixed lint issues 2021-03-12 18:11:30 +01:00
Jannis M. Hoffmann
1a8ee2012d removed alpm dependency from download 2021-03-12 18:11:30 +01:00
Jannis M. Hoffmann
df1361aa05 moved Upgrade to db
to reduce dependencies
2021-03-12 18:11:30 +01:00
Jannis M. Hoffmann
5d2c763fdb reroute dep->rpc dependency via query 2021-03-12 18:11:30 +01:00
Jannis M. Hoffmann
34f7dbc7fc Narrow interface in completion 2021-03-12 18:11:30 +01:00
Jannis M. Hoffmann
5993613c53 Added type alias for alpm types in db 2021-03-12 18:11:30 +01:00
jguer
b6feb7c308
chore(deps): update dependencies 2021-03-11 09:36:42 +01:00
jguer
ca60c15911
chore(deps): update pre-commit hooks and fix supply chain issue 2021-03-02 08:23:26 +01:00
xvqxy
05c2fa6087 Add doc for getFilter func. 2021-02-14 22:38:49 +01:00
xvqxy
9fc6d9c128 fix(query): Respect --deps and --explicit.
This fixes #1283.

yay --query --upgrades [--explicit|--deps] will not return same packages pacman
does extended with AUR packages.
yay --show --numberupgrades [--explicit|--deps] will also work.
2021-02-14 22:38:49 +01:00
jguer
fd9e2638f9
fix(yay): fix completions of -Gp 2021-01-31 19:07:08 +01:00
jguer
afc72daba7
test(download): test pkgbuild fetching 2021-01-31 19:07:08 +01:00
jguer
ee3c51f6f2
feat(pkgbuild): extract logic 2021-01-31 19:07:08 +01:00
jguer
28c985b378
fix(pkgbuild): move pkgbuild to Gp 2021-01-31 19:07:08 +01:00
jguer
a288dd754f
fix(pkgbuild): rebase pkgbuild fetching from nycex 2021-01-31 19:07:08 +01:00
nycex
d9b440c929
implement yay -Pp option
fix linting errors

format with make fmt

fix completions

resolve most of the requested changes

move loop over dbSlice back into makeRequest

query aur in chunks of 20

check for status codes

continue instead of return in for loop

format code
2021-01-31 19:07:08 +01:00
Benjamin Robin
5bef39b728 Do not use CmdRunner.Capture() while executing a command with sudo
Fix #1440
2021-01-31 18:01:50 +01:00
jguer
b9d3992f13
chore(yay): update release notary 2021-01-29 22:48:05 +01:00
jguer
c221d5ebbd
fix(yay): give priority to LC_MESSAGES. fixes #1442 2021-01-29 22:45:42 +01:00
jguer
f00630fd0c
chore(yay): update go dependencies 2021-01-29 22:23:36 +01:00
xhqr
24edabe5df Print error if PATH is empty.
This fixes #881.

Before:
```bash
$ PATH= /usr/bin/yay -Qu
$ echo $?
1
```

After:
```bash
$ PATH= ./yay -Qu
exec: "pacman-conf": executable file not found in $PATH
$ echo $?
1
```
2021-01-16 18:27:39 +01:00
Porrumentzio
607d28778e Updated Basque translation 2021-01-13 11:42:12 +01:00
riiga
5f9ad882f6 Add Swedish translation 2021-01-11 22:21:41 +01:00
jguer
7d849a8dec
ci(release): tweak changelog 2020-12-14 19:21:15 +01:00
jguer
f7d6ad59cd
fix(completions): list installed is not available upstream yet 2020-12-11 10:24:32 +01:00
jguer
b864d433df
fix(completions): sync completions with upstream, namely packages 2020-12-11 01:30:58 +01:00
ccat3z
bb50b4079f fix(exe): fix timeout of OSRunner.Capture()
kill all child processes
2020-12-10 09:07:33 +01:00
jguer
182f4c7f6c
test(pgp): temporary fix for random order test 2020-12-10 00:29:56 +01:00
jguer
c85bbf54da
chore(yay): remove deprecated dependency 2020-12-10 00:18:23 +01:00
jguer
999392640e
fix(makefile): add pacman>6 checking to makefile 2020-12-10 00:15:00 +01:00
jguer
35e64deca4
chore(yay): update alpm 2020-12-10 00:06:46 +01:00
morganamilo
952e801ed1 Update email 2020-12-06 15:16:31 +01:00
jguer
f24e21105e
ci(builder): update ci builder 2020-11-17 20:25:40 +01:00
jguer
8d9fed2ad0
fix(query): fix remote package slow filtering 2020-11-16 08:59:35 +01:00
Kazuki Sawada
8c4fe837d3 Fill fields of CmdBuilder with options specified in commandline 2020-11-15 15:13:44 +01:00
Janek
13caa7fb3d Improve feature request issue template 2020-11-15 15:10:58 +01:00
Janek
8393ee4acc Improve bug report issue template 2020-11-15 15:10:58 +01:00
jguer
de7373dd00
docs(stale): add stale checks 2020-11-01 09:49:07 +01:00
jguer
981c336541
docs(github): add CODEOWNERS and other aur helpers section 2020-11-01 09:35:50 +01:00
jguer
6beefb1400
fix(config): fix save config 2020-11-01 09:09:38 +01:00
lwlf
497f94ca9f
parent 55a6767b44a4aa8093dff6ff30058b985939a4e0
author lwlf <wuhaojie_2011@sina.com> 1603706823 +0800
committer jguer <me@jguer.space> 1604217613 +0100
gpgsig -----BEGIN PGP SIGNATURE-----

 iQIzBAABCAAdFiEEP4pAozwhlAIAKURxbWzJvqhVazUFAl+eaw0ACgkQbWzJvqhV
 azU8Dg//XEcgshJ3DqS54kGDOhOXvp3RGWDW6EGYS9UG22ul6af2Yxgt+sNksQY2
 oaTBV2TiQ979AWikJ70waTLQEkkqqkbG1eKz0AWniQQuHPmpTu/9CA6e5hX5f+nh
 AdeUdvz8UcxRd2n80YCVYv7KEs2QkR1ZU4gE+42BG/ohdWSoAxfd1S/skDJ2uYjx
 VUu/ZVYh1qsgLhoIqLpnKzv0jPDVvbpzQ0il+1Zyl2P7qC8QKDTHkfajO6FQV46t
 74anbsk1HrwJSK2G8Z25h/vzi+6Vz36koS7A8mQCLz4jpQZho0Ax7wkhPwLhYSNf
 8CRTK8uoyczTLECOBXnwwrQoDl21N4EgqzZWDBso6DEozBZMteSd74liye3FAXff
 vWmN12pf6nh8uUN5kUGaj/Jq6XWij0cdU4vM0CpRzlzAw3OV4Z0RTwVHqAy6qU6J
 M73cIwVjzVEmPAjWlD2y1ZbTNFUsbWNZ4iqxWXcvc2IOuR4Ywjv+T45NcFXB6RcZ
 PoEivscWy/nEkmihtn9bAIhZXze/UMgIktOV8FyrYFizlVNmZ3HuFPlu6tXRFIZK
 RdGbTeLunPGMLg8iw5C9rKe8/vvsVlUpLUiguyr7w3vUS9QpxLPd8mHlsUETp3p2
 OKxz3zD4/BRaRmuL6Gef7KeroCvJYZGnVpTHPHoOENkSzGxqHCk=
 =D+N6
 -----END PGP SIGNATURE-----

unsaved config when yay's config path does not exist

unsaved config when yay's config path does not exist

unsaved config when yay's config path does not exist

unsaved config when yay's config path does not exist

unsaved config when yay's config path does not exist

fix: unsaved config when yay's config path does not exist

fix: unsaved config when yay's config path does not exist

fix: unsaved config when yay's config path does not exist

fix: unsaved config when yay's config path does not exist

fix: unsaved config when yay's config path does not exist
2020-11-01 09:00:47 +01:00
jguer
55a6767b44 fix(parser): use Fields instead of Split 2020-10-30 11:09:06 +01:00
jguer
81b5feb68a fix(passer): fix slice copying for passer 2020-10-30 11:09:06 +01:00
jguer
7d080df6ac fix(config): fix mflags and gitflags 2020-10-26 09:32:22 +01:00
jguer
c4dc9bec6e fix(ialpm): fix typo 2020-10-26 09:32:22 +01:00
jguer
01e6d80525
fix(release): fix release pipeline 2020-10-18 20:59:37 +02:00
jguer
1c779da3ed
ci(version): version bump 2020-10-18 20:31:46 +02:00
jguer
39717f3974
ci(release): automatic changelog 2020-10-16 13:12:22 +02:00
jguer
f6cb0bc460
fix(provide): fix dep pool populate with unversioned deps 2020-10-06 13:40:19 +02:00
jguer
7979279c3f
fix(provide): fix provides not finding pagure-database=5.1.0 2020-10-06 06:25:18 +02:00
jguer
678d10e04e
fix(upgrade): export upgrades 2020-10-01 14:06:21 +02:00
jguer
e1b632cf3d
build(deps): update dependencies 2020-10-01 13:39:48 +02:00
jguer
3e698f313a
test(alpm): implement alpm interfaces 2020-10-01 13:38:03 +02:00
jguer
a80771c37e
ci(dockerfile): clean pkg cache 2020-09-29 10:32:29 +02:00
jguer
1f3020e7d6
ci(dockerfile): reduce image size and update readme 2020-09-29 09:38:56 +02:00
jguer
d6aa288ab8
fix(alpm): update alpm version 2020-09-20 17:00:45 +02:00
jguer
8a0a0cf2bc
fix(ci): fix CI issues 2020-09-08 00:02:28 +02:00
x-usr
5ae510ad6f fix(display): adapt padding to match pacman's.
This change fixes part of #1332 related to splitting information into
multiple lines.
Change is implemented based on current pacman's code.
2020-09-07 23:39:19 +02:00
jguer
5c05811ae5
fix(config): fix unsaved config 2020-09-03 18:26:57 +02:00
jguer
3b2bb28e81
feat(exe): AddMakepkg builder 2020-08-22 01:24:52 +02:00
jguer
1db50882e9
feat(vcs): refactor and test cover 2020-08-22 00:39:26 +02:00
jguer
842dfb28a4
fix(ci): update dependencies 2020-08-21 02:49:09 +02:00
jguer
72f120b0f3
feat(config): refactor config to allow running without config 2020-08-21 02:39:52 +02:00
jguer
c5af6f8189
feat(vcs): package vcs 2020-08-21 02:37:03 +02:00
jguer
c1171d4146
style(runner): use command runner for commands 2020-08-19 01:48:07 +02:00
jguer
ab3c66ab98
fix(clean): Add clean directory warning on fail 2020-08-19 00:59:18 +02:00
jguer
ce79d53eb2
fix(deps): fix wrong method implementation 2020-08-19 00:42:59 +02:00
jguer
7b70462a7c
fix(noconfirm): move noconfirm to config global 2020-08-19 00:30:41 +02:00
jguer
9ad2862b7d
feat(vcs): test upDevel and extract OS runner 2020-08-19 00:30:41 +02:00
jguer
4a761c287b
test(upgrade): test AUR upgrades 2020-08-19 00:30:34 +02:00
jguer
c305e1c196
fix(color): remove duplicate colors 2020-08-17 00:09:43 +02:00
jguer
1ccfd3f0b7
fix(dbExecutor): rename functions to use dbExecutor 2020-08-17 00:02:14 +02:00
jguer
7a3794ae75
feat(interface): interface dbexecutor 2020-08-16 23:42:00 +02:00
jguer
388aaf6d7f
fix(tests): test handle creation 2020-08-16 23:42:00 +02:00
Jguer
f3925e2481
fix(sync_list): remove alpmHandle
wip
2020-08-16 23:41:56 +02:00
Jguer
6b973c6bc5
fix(pkgbuild_download): remove alpmHandle 2020-08-16 23:41:56 +02:00
Jguer
0e2a02b512
fix(clean): extract alpmHandle 2020-08-16 23:41:56 +02:00
Jguer
7bcf2ecb4c
fix(statistics): use alpm executor 2020-08-16 23:41:55 +02:00
jguer
94f650f4d3
style(main): remove alpmHandle 2020-08-16 23:41:55 +02:00
jguer
005b29373d
fix(install): remove alpmHandle 2020-08-16 23:41:55 +02:00
jguer
9fd6917bc0
fix(alpm): transfer handle initialization to executor 2020-08-16 23:41:55 +02:00
jguer
8165174462
fix(dbExecutor): move dbExecutor to runtime config 2020-08-16 23:41:55 +02:00
jguer
ad9bc9ef8f
feat(db): abstract db ops need for dep 2020-08-16 23:41:55 +02:00
hayao
7f4c277ce7 fix(translate) : Japanese 2020-08-16 12:40:31 +01:00
Adam G. Emerson
5647aab025
Updated Readme to include note about dependencies (#1345)
* Updated Readme to include note about dependencies

Per issue #1142 I've added a note to the readme to let users know they'll need to install `base-devel`.

* Update README.md

* Update README.md

Clarified note regarding base-devel.
2020-08-12 19:53:45 +01:00
Feresey
0adda5da4f Fix issues 2020-08-08 17:00:18 +01:00
jguer
8074179112
style(filter): make filtering names more relevant 2020-07-27 01:24:28 +02:00
jguer
520dd58999
style(cmd): remove useless filtering 2020-07-27 00:57:52 +02:00
jguer
37372c883f
test(news): add tests for news package 2020-07-27 00:46:32 +02:00
jguer
2cc72685ad
docs(contributing): remove outadated info 2020-07-27 00:17:05 +02:00
jguer
5b7cee1422
style(news): clarify variable 2020-07-27 00:11:24 +02:00
jguer
991c5b4146
style(parser): simplify ignore option adding 2020-07-26 23:48:33 +02:00
jguer
de92f24ce5
style(parser): simplify option creation 2020-07-26 23:40:21 +02:00
jguer
c159c06222
fix(parser): fix alpm initialize 2020-07-26 23:08:47 +02:00
jguer
7dd5d7e13e
fix(parser): fix ignores getting... ignored 2020-07-26 23:00:28 +02:00
jguer
cd8fb7143c
test(completion): add basic AUR tests 2020-07-25 00:55:46 +02:00
jguer
fa2af37eab
fix(pre-commit): add commitizen 2020-07-24 23:45:56 +02:00
jguer
45d7da4df6
fix(tests): move runes test to text package 2020-07-24 23:24:53 +02:00
jguer
1177493895
fix(vcs): remove custom testing function 2020-07-23 13:53:59 +02:00
Fifis
b37a1f7ab4 Update ru_RU.po
Added a missing word
2020-07-22 09:34:45 +02:00
Fifis
4ebbe723bd Update ru_RU.po
Re-submitting revised edits after a review.
2020-07-22 09:34:45 +02:00
Fifis
2aee260a9b Update ru_RU.po
Many unclear points and ambiguous translations improved since some of the terms were quite vague, with commentaries justifying the edits.
2020-07-22 09:34:45 +02:00
Jan Hagelauer
22acf2ad8f fix: adjust translations (fix #1329) 2020-07-20 13:46:20 +02:00
jguer
17eb6b6d10
fix(providers): fix provider display 2020-07-20 09:58:14 +02:00
jguer
a8ba2a808b
fix(docker): fix dockerignore 2020-07-20 09:27:25 +02:00
kusakata
f91489a2ee Add Japanese translation 2020-07-15 09:27:10 +02:00
jguer
fd7934d9ee
style(pretty): pretty files 2020-07-11 00:52:02 +02:00
jguer
42f337f2a5
fix(pgp): package key importing 2020-07-11 00:48:30 +02:00
jguer
7ed2cf7b49
fix(download): fixes #1322 2020-07-10 03:02:34 +02:00
jguer
054a9ac613
refactor(dep): package dep 2020-07-10 02:36:45 +02:00
jguer
e47c9584c1
fix(format): gofumt files 2020-07-08 03:40:50 +02:00
jguer
a0cff2b622
fix(cmdArgs): reorder args 2020-07-08 03:31:35 +02:00
jguer
7a32ffdd37
fix(cmdArgs): deglobal cmd args 2020-07-08 03:22:01 +02:00
jguer
93719d488c
fix(deps): update parser method 2020-07-07 01:46:39 +02:00
Jonas Bögle
71929cb225
ignore dependency checks on double --nodeps 2020-07-07 01:43:22 +02:00
J Guerreiro
0c8ce4f033 Update issue templates 2020-07-06 03:53:20 +02:00
jguer
0eb8c25c97
fix(workflow): move contributing 2020-07-06 03:52:09 +02:00
jguer
7b3de13e65
fix(workflow): remove outdated ISSUE_TEMPLATE 2020-07-06 03:51:50 +02:00
J Guerreiro
2b759fcecd Update issue templates 2020-07-06 03:50:29 +02:00
jguer
1cbef97ae4
fix(parser): fix tests on list elements 2020-07-06 02:49:33 +02:00
jguer
b1a6d154c3
fix(parser): add tests and rename method handles 2020-07-06 02:34:28 +02:00
jguer
2f88858ce6
fix(parser): squash globals into options 2020-07-06 02:02:12 +02:00
jguer
d507e024bd
fix(parser): add support for multiple overlapping global options 2020-07-06 01:16:51 +02:00
jguer
56760e1b7c
fix(parser): add support for stackable parameters. Fixes #1155, Fixes #1280 2020-07-06 00:28:04 +02:00
jguer
5cc47503be
fix(tests): use testify for tests 2020-07-05 18:03:22 +02:00
jguer
b5e70ae84b
fix(config): remove commented code 2020-07-05 17:46:17 +02:00
jguer
36730a41e3
fix(config): package alpmHandle into runtimeSettings 2020-07-05 16:58:35 +02:00
jguer
968b61ac57
fix(config): pack pacmanConf into runtime 2020-07-05 15:34:27 +02:00
jguer
488d9537db
fix(download): fixes #1228 and -Gf 2020-07-05 14:06:31 +02:00
jguer
9caecd9aee
fix(depPool): fixes #1177 with smaller query sizes 2020-07-05 13:39:17 +02:00
jguer
2dd9395190
fix(depPool): fixes #1177, add versioned dependency to AUR query 2020-07-05 13:30:28 +02:00
jguer
5a77dd86e1
fix(po): update locale template 2020-07-05 09:36:27 +02:00
jguer
0bae6e2f7d
fix(config): move default settings to config 2020-07-05 09:36:27 +02:00
jguer
9b49f76bbd
fix(config): vcs filepath fix 2020-07-05 09:36:27 +02:00
jguer
2dc01d8a3e
fix(init): refactor init to use runtime 2020-07-05 09:36:27 +02:00
jguer
cd02fa459c
fix(alpm): rename tests 2020-07-05 09:36:27 +02:00
jguer
fb5b6b74fe
fix(parser): package parser 2020-07-05 09:36:27 +02:00
jguer
cb8a988701
fix(news): package news and begin settings 2020-07-05 09:36:27 +02:00
Giftpflanze
fff9d74764 Fix "%s is up to date -- skipping" message formatting 2020-07-05 09:35:52 +02:00
jguer
7efeaaff81
fix(makefile): remove vendor path 2020-07-04 23:06:06 +02:00
jguer
feb2cea9e0
fix(ci): force update 2020-07-04 23:04:48 +02:00
jguer
6bfcfc168f
fix(docs): update badges 2020-07-04 21:31:51 +02:00
jguer
b5b4484c5c
fix(cleanafter): do not remove built packages on cleanafter 2020-07-01 09:14:54 +02:00
Matheus Alcantara
3549aeca26 Fix #1279: Error not git repository on yay -Sc 2020-06-30 09:56:31 +02:00
jguer
acf95aed5b
fix(format): move time format to text 2020-06-26 09:15:36 +02:00
jguer
d0450179f9
fix(usecolor): usecolor belongs to text. remove deprecated 2020-06-26 09:03:45 +02:00
jguer
9d93a1f1bd
fix mostly br terms to pt 2020-06-18 01:25:07 +02:00
Guilherme Ananias
78d336c031 fix(locale): improving translation for PT 2020-06-18 01:20:36 +02:00
J Guerreiro
bfbdd79424
Merge pull request #1306 from agendator/yay-ptBR
Brazilian portuguese translation
2020-06-18 01:06:40 +02:00
J Guerreiro
0548d86dea
Merge branch 'next' into yay-ptBR 2020-06-17 22:48:34 +02:00
r3v1
9c3aeef75b Add Basque translation 2020-06-17 20:13:41 +02:00
r3v1
67a07aa5db Add Basque translation 2020-06-17 20:13:41 +02:00
lucasjome
e83a22c0ee
Merge branch 'next' into yay-ptBR 2020-06-17 10:27:41 -03:00
lucasjome
fc4b2e57fe Updated Makefile - LANGS 2020-06-17 10:13:57 -03:00
agendator
72dfc6065e
pt_BR.po last review
Nothing changed aside from adding credit to translators.
2020-06-17 10:04:43 -03:00
agendator
4621e2b57a
Revision to pt_BR.po
Some fixes between lines 487 and 519
2020-06-17 09:09:32 -03:00
nycex
321834de4c remove percent from popularity 2020-06-17 09:28:45 +02:00
J Guerreiro
f9fb40a27a
Merge pull request #1303 from dvdesolve/rus-tr
Russian translation
2020-06-17 09:23:08 +02:00
J Guerreiro
c780652d6a
Merge branch 'next' into rus-tr 2020-06-17 09:22:08 +02:00
J Guerreiro
744434423f
Merge pull request #1292 from MarioJim/next
Add Spanish translation
2020-06-17 09:21:27 +02:00
J Guerreiro
8e10fb7a1e
Merge branch 'next' into rus-tr 2020-06-17 09:19:50 +02:00
J Guerreiro
07e15020e1
Merge branch 'next' into next 2020-06-17 09:14:06 +02:00
Althorion
bd630a63c0 Add Polish translation 2020-06-17 09:07:23 +02:00
lucasjome
b3fc00cf96 Fixing typos of pt.so 2020-06-17 09:06:50 +02:00
agendator
5d4a20da6d
Merge pull request #1 from lucasjome/patch-1
Added pt_BR to Makefile
2020-06-16 20:48:22 -03:00
lucasjome
9260ea351f
Added pt_BR to Makefile 2020-06-16 20:47:30 -03:00
agendator
79362b749a Brazilian portuguese translation 2020-06-16 20:44:02 -03:00
Viktor Drobot
2f98d689c2
Russian translation 2020-06-16 15:05:18 +03:00
jguer
f0aa4e0b5a
fix(maintenance): build PIE executable and trim path by default 2020-06-15 09:42:46 +02:00
jguer
d4c327c153 fix(callbacks): fix callback extra \n 2020-06-15 09:01:36 +02:00
jguer
1970dfa71b
fix(query): fix package indexing on narrow search 2020-06-15 08:50:06 +02:00
r4v3n6101
35a7d504fa Fix wrong loop indexing 2020-06-15 06:58:22 +03:00
Yufan You
1b8c9cea49 fix(locale): fix errors in the Simplified Chinese locale
Fix wrong translations and warnings in poedit.

"想要": "want"
"被这些包需要: ": "required by these packages"

"安装": "install"
"已安装": "installed"

"不安装": "don't install"
"未安装": "not installed"

"的比" -> "比": seems like a typo

"下载": "download"
"下载了": "downloaded"

"解析": "parse"
"正在解析": "parsing"

"显示差异?": "Show diffs?"
"显示哪些差异?": "Show which diffs?"

"为跟踪" -> "未跟踪": a typo

"编辑 PKGBUILD?": "Edit PKGBUILD?"
"使用什么来编辑 PKGBUILD?": "Use what to edit PKGBUILD?"

"要编辑 PKGBUILDs 吗?": "Do you want to edit PKGBUILD?"
"要编辑哪些 PKGBUILDs?": "Which PKGBUILDs do you want to edit?"

"清理软件包的构建?": "Do you want to cleanBuild?"
"清理哪些软件包的构建?": "Which packages do you want to cleanBuild?"

"十个大的软件包: ": "Ten big packages: "
"十个最大的软件包: ": "Ten biggest packages: "

"" -> "依然": "anyway"
2020-06-14 19:42:59 +02:00
MarioJim
889a394176 Add Spanish translation 2020-06-13 21:36:33 -05:00
jguer
2fa7b6ba3d
fix(ci): use PAT so pipeline gets triggered 2020-06-14 01:16:02 +02:00
jguer
80216bdc69
fix(ci): set prefix for release 2020-06-14 00:56:42 +02:00
jguer
1769ba978a
fix(ci): fix tag retrieval for bash 2020-06-13 23:37:12 +02:00
jguer
d3f9335d2d
fix(ci): refactor CI 2020-06-13 23:24:33 +02:00
jguer
d003e96e07
fix(ci): fix env propagation
fix broken ci artifact download
2020-06-13 19:49:57 +02:00
jguer
5734faf33b
fix(completions): fix path join not making a proper packages url .fixes #1287 2020-06-13 18:47:42 +02:00
Zhong Lufan
1fbf6953a1 Update zh_CN.po 2020-06-11 10:42:42 +02:00
Benjamin Vialle
4af542e233 Add French Translation 2020-06-08 09:11:04 +02:00
Zhong Lufan
0554e46ec4 Add Simplified Chinese Translation 2020-06-05 09:59:22 +02:00
jguer
11db63f1e2
fix(gomod): go mod tidy 2020-05-30 01:18:12 +02:00
jguer
cecba84982
fix(locale): remove DESTDIR from locale path 2020-05-30 01:04:12 +02:00
jguer
63ccabd33c
fix(locale): remove xgotext dep from install 2020-05-30 00:58:24 +02:00
jguer
0c45a390a2
fix(locale): make install with locale 2020-05-30 00:43:18 +02:00
jguer
87d0dd64c3
fix(locale): add base locale 2020-05-08 18:13:51 +02:00
jguer
732f1a5412
feat(localization): wrap all translatable strings 2020-05-05 19:21:42 +02:00
Stuart Reilly
db3993b83b Fix segfault from 9fccdcb
9fccdcb renamed a variable, but didn't update all uses of the variable.
2020-05-04 13:57:41 +02:00
jguer
9fccdcb30f
fix(ci): implement stricter linting settings 2020-05-02 16:17:20 +02:00
jguer
e7b1fe4d53
fix(ci): add stricter linting settings and fix upload issues 2020-05-02 10:27:47 +02:00
Ferdinand Bachmann
023c742490 install.go: check if packages exist before trying to install them
Sometimes *-debug packages generated by makepkg are listed in
`makepkg --packagelist`, but are not built when running `makepkg`.

This is the case when no debug info sections could be found in the package,
which is often the case for `python-*` packages, like `python-bashlex`.
--
2020-05-01 17:59:58 +02:00
Ferdinand Bachmann
4f35c2c4fe install.go: swap if branches for readability 2020-05-01 17:59:58 +02:00
Ferdinand Bachmann
873b2db591 install.go: fix linter failure
(personal note: I don't believe this helps readability in this case,
"fixing" this to allow merge checks to pass)
2020-05-01 17:59:58 +02:00
Ferdinand Bachmann
328c561230 install.go: also install *-debug packages if built by makepkg
fixes #1190
2020-05-01 17:59:58 +02:00
Kirill Motkov
ddd1cc35d2 check len before accessing element 2020-04-13 16:53:37 +02:00
Dan Pasanen
6bd920265c Use golang.org's terminal package to determine isTty()
* Don't trust that the user doesn't have a "test" binary in their
  PATH somewhere, and instead use the official golang library to
  determine whether or not we're running in a terminal
2020-03-26 09:28:02 +01:00
Sergey Shatunov
0e20e3cba0 Treat whole split-package as devel when pkgbase matches too
Signed-off-by: Sergey Shatunov <me@prok.pw>
2020-03-17 17:50:43 +01:00
Zheng Piaodan
942947fac4 Use user-defined GOPROXY if possible 2020-03-16 10:42:40 +01:00
Maxime Houis
fe091f7578 Fix typo in usage 2020-03-09 15:00:19 +01:00
Jguer
352667f550
fix(yay): fix unescaped variable in CI 2020-02-29 19:02:48 +01:00
Jguer
35475c7f4c
fix(yay): lint README.md 2020-02-29 18:53:58 +01:00
Jguer
9795a36692
fix(yay): remove vendor and tweak ci 2020-02-29 18:50:33 +01:00
Jguer
f4503ade39
fix(mod): update vendored modules 2020-02-27 19:26:40 +01:00
Dominik Schrempf
2ffde239c0 Bugfix apostrophe and bracket 2020-02-25 22:53:22 +01:00
Dominik Schrempf
fd7945b42b Move note yay --option /= yay -Syu --option. 2020-02-25 22:53:22 +01:00
Akatsuki
d5718b7406
Fix -U complete
__fish_complete_suffix function is changed.
2020-02-25 22:52:16 +01:00
patatahooligan
558c17f67c
Add missing diff completions for zsh 2020-02-25 22:52:15 +01:00
Dương Đỗ Minh Châu
c6a17d02f4
Fix typos in man page 2020-02-25 22:52:15 +01:00
Jguer
23706a3a71
fix(ci): add previous_tag from git describe 2020-02-25 22:52:15 +01:00
Jguer
3a5a6a77b3 fix(print): fix #1158. initialize stringset in warnings declaration 2020-01-17 21:06:22 +01:00
Jguer
1f007f39ab fix(release): inline changelog definition 2020-01-17 21:06:22 +01:00
Jguer
87fcfbf9f7
fix(release): changelog doesn't need final as it's not available on checkout 2020-01-12 19:44:14 +01:00
Jguer
d63c4b0b2e
fix(release): fix release naming 2020-01-12 19:08:10 +01:00
Jguer
b85428770e
fix(release): fix missing changelog.sh 2020-01-12 18:39:51 +01:00
Jguer
9458e02711
fix(release): fix multiline command 2020-01-12 18:28:32 +01:00
Jguer
e9930b0c42
fix(release): fix missing echo on read 2020-01-12 18:22:55 +01:00
Jguer
4da27c37c8
fix(release): reduce env artifacts 2020-01-12 18:19:57 +01:00
Jguer
a34e080bf6
fix(release): use fixed paths for upload 2020-01-12 18:14:52 +01:00
Jguer
66a09aba8b
fix(release): fix missing echo 2020-01-12 18:11:25 +01:00
Jguer
a0d831180d
fix(release): fix tag value sharing 2020-01-12 18:05:56 +01:00
Jguer
b242d0ac4b
fix(release): auto-tag and build 2020-01-12 17:40:43 +01:00
Jguer
a9b74a0e1e
fix(release): try mathieudutour again 2020-01-12 17:06:21 +01:00
Jguer
fa3191e6f5
fix(release): bump config.go version 2020-01-12 16:55:16 +01:00
Jguer
13e3271dd6
fix: try another provider 2020-01-12 16:42:24 +01:00
Jguer
bc2d1bf143
fix: create_annotated_tags 2020-01-12 16:33:22 +01:00
Jguer
03c5e3fb94
fix: fix auto-tag 2020-01-12 16:28:45 +01:00
Jguer
70aa7b4689
fix: add auto-tag 2020-01-12 16:16:04 +01:00
J Guerreiro
f9ffa72b03
Merge pull request #1147 from msAlcantara/master
Add error handler on saveConfig
2020-01-12 14:42:24 +01:00
Matheus Alcantara
a689ec887f Add error handler on saveConfig 2020-01-09 22:35:02 -03:00
J Guerreiro
9e2713e881
Merge pull request #1136 from Jguer/1135-fixCachedABS
Fix cached abs not getting the latest version
2019-12-26 11:57:36 +00:00
Jguer
990be97d44
fix #1135: pull and fast forward abs instead of just fetching latest head 2019-12-23 20:59:37 +00:00
Jguer
6cb5587351
update module dependencies 2019-12-23 20:38:26 +00:00
J Guerreiro
b08e505b34
Merge pull request #1115 from Morganamilo/ignoreignore
Hide warnings for ignored packages
2019-11-11 20:20:23 +00:00
J Guerreiro
45da573821
Merge pull request #1102 from Jguer/fix-completions
Update completions for zsh and bash to pacman 5.2
2019-11-11 20:16:21 +00:00
morganamilo
ab956ea3d2
Hide warnings for ignored packages 2019-11-11 07:15:27 +00:00
Anna
0bd21ea29f
Merge pull request #1111 from Morganamilo/notar
Remove tar support
2019-11-11 03:16:30 +00:00
morganamilo
f2959922a7
Remove tar support
tar is slower and harder to diff. I doubt any one still uses it intentially.

There's a chance some people have not cleared their cache in two years
and still have tar based packages around. But forcing them to clear
their cache is not a big deal at all.
2019-11-11 02:57:14 +00:00
Jguer
410c7e758f
Updated zsh and bash completions to pacman 5.2 and yay 9.4.*
Removes tar completions
Removes --owns from bash/zsh
Bash now prints repo pkgs if no letter is entered and AUR and repo if
there's a letter
2019-11-04 17:32:52 +00:00
J Guerreiro
bbc7cbba73
Merge pull request #1107 from Morganamilo/igorediffret
Ignore errors while diffing
2019-11-03 18:01:59 +00:00
morganamilo
3c996e5235
Ignore errors while diffing
std{out,err} all passed to the call so errors should print just as
before, the only difference is now yay will not abort after an error
occurs. We always provide a confirmation dialog after viewing diffs so
this should be safe.
2019-11-03 07:01:51 +00:00
Anna
3fef09e650
Merge pull request #1106 from Morganamilo/fixfish
Remove -F in fish completion
2019-10-30 02:25:43 +00:00
morganamilo
12312c8aa0
Remove -F in fish completion
This flag is only in fish-git, making it broken for most people.
2019-10-30 02:21:12 +00:00
Anna
662ce9994e
Merge pull request #1100 from akiirui/fish-patch-2
completions/fish: refine from pacman 5.2.0 and yay 9.4.2
2019-10-29 01:28:16 +00:00
Anna
9420a9724f
Merge pull request #1101 from Morganamilo/#942
Add SudoBin and SudoFlags
2019-10-28 19:06:43 +00:00
Pierre-Alain TORET
6dd65a2df2
Add SudoBin and SudoFlags 2019-10-28 18:35:36 +00:00
Akatsuki
e36fda0f5a
completions/fish: refine from pacman 5.2.0 and yay 9.4.2 2019-10-26 04:08:06 +08:00
Jguer
f8e496457c
fixed some completions for bash and zsh. Closer to pacman 5.2 2019-10-25 12:01:33 +01:00
J Guerreiro
8d37981218
Merge pull request #1088 from akiirui/fish-completions-patch
completions/fish: update for pacman 5.2
2019-10-24 13:49:59 +02:00
Akatsuki
58a9c78033
completions/fish: update for pacman 5.2
`-F`:
    Remove `-s --search`
    Remove `-o --owns`
    Add    `-x --regex`
`-S -U`:
    Remove `--force`
    Add    `--overwrite`
and another fix:
    `-Qo` remove `-f` in complete
    `-U`  add `.zst` zstd completion
2019-10-24 08:20:06 +08:00
Jguer
290d3d2c43
Patches -G to copy directory instead of linking. --absdir is recognized as a flag 2019-10-23 12:31:29 +01:00
Jguer
203b49321e
Bump version to 9.4.2 for -G patching 2019-10-23 12:11:44 +01:00
J Guerreiro
82549d0d95
Merge pull request #1082 from naclander/patch-1
Clarfiy Out Of Date Message
2019-10-23 12:55:04 +02:00
Jguer
446db893f0
Fixes #1086 2019-10-23 11:43:28 +01:00
Nathan Aclander
6136e15717
Clarfiy Out Of Date Message
The existing message was a bit confusing and made me think that the AUR package 
had an update pending which Yay refused to do. I realized instead that the package is
actually *flagged* out of date on the AUR.

I then realized there is a section in the README specifically about this confusion.

So, by prefixing the word "Flagged" I think the slight confusion can be eliminated, and the 
README section possibly removed.
2019-10-22 23:52:47 -07:00
Jguer
1257a6df08
Bump version to 9.4.1 for arm bin release once pacman 5.2 hits arm core 2019-10-22 21:15:11 +01:00
Jguer
85fc7c59c7
Remove testing CI used for 9.4.0 release. Return to using only core for 9.4.1 2019-10-22 21:12:28 +01:00
Jguer
c0e78c84f2
Merge branch 'ci-testing'
Enables using [testing] on CI, can be removed in future
2019-10-22 10:50:50 +01:00
Jguer
d50ca0430b
Enable testing in ci builds 2019-10-22 10:41:53 +01:00
J Guerreiro
e1403861c0
Merge pull request #1077 from Jguer/pacman-next
Update go-alpm for pacman-next
2019-10-22 09:40:57 +02:00
J Guerreiro
3416f6b266
Merge pull request #1078 from Jguer/bump-version
Bump version for release
2019-10-22 09:29:35 +02:00
Jguer
211b96867c
Bump version for release. 9.4.0 2019-10-21 16:50:17 +01:00
J Guerreiro
a3849deb4e
Merge pull request #1079 from Morganamilo/doc4
Update documentation
2019-10-21 16:44:00 +02:00
morganamilo
3baf2e1ff1
Update documentation 2019-10-21 15:30:04 +01:00
morganamilo
1d2855ab76
Update go-alpm for pacman-next 2019-10-21 12:50:09 +01:00
Anna
169d0a07fc
Merge pull request #1068 from Morganamilo/abs
Move abs cloning to it's own directory
2019-10-21 12:34:35 +01:00
Anna
155c363001
Merge pull request #1067 from Morganamilo/aurdest
Support AURDEST
2019-10-21 12:34:18 +01:00
Anna
568dc4a15e
Merge pull request #1071 from nicoduesing/patch-2
more selfexplaining upgrade process
2019-10-19 23:48:07 +01:00
nicoduesing
6bca3246c8
more selfexplaining upgrade process
At least for me it was not very intuitive what I have to do here. Maybe because I overread "not" and also because I liked to upgrade all packages. That was not explained ether, so I didn't consider to just press enter. This hopefully makes it a little bit more understandable.
2019-10-20 00:40:48 +02:00
morganamilo
bbeef9d237
Move abs cloning to it's down directory
As mentioned it is possible for stuff to clash in cache if you were to
-G a package from the repos, then -S an AUR package by the same name. To
avoid that give abs cloning its own directory.

It is still possible for a clash to occur if there was a package named
abs. However currently there is not.

Idealy the aur cloning would also get it's own subdir, but that will
invalidate everyone's cache so leaving it for a time with more breaking
changes.

This is also under its own config option so that AURDEST does not
interfere with it.
2019-10-18 08:48:58 +01:00
morganamilo
35b2297f1e
Support AURDEST
the AURDEST environment variable can now be used to configure the build
dir.
2019-10-17 23:54:20 +01:00
Jguer
a3f30beea4
go mod tidy 2019-10-17 00:29:06 +01:00
J Guerreiro
9e773149e9
Merge pull request #1064 from Morganamilo/refactor-files
Refactor files
2019-10-17 00:27:44 +01:00
morganamilo
471b07152e
Add .go to gitignore 2019-10-16 23:18:04 +01:00
morganamilo
b60a888981
Simplify stringset function names
Now that stringset has its own module we can use more basic function
names while keeping it obvious what it does.
2019-10-16 23:18:04 +01:00
morganamilo
dacd77012c
Move multierror to its own module
types is pretty generic as a module name, this should be split into
seperate modules.
2019-10-16 23:18:04 +01:00
morganamilo
cff358d5d6
Move intrange to its own module
types is pretty generic as a module name, this should be split into
seperate modules.
2019-10-16 23:18:04 +01:00
morganamilo
f2579f26a3
Move stringset to its own module
types is pretty generic as a module name, this should be split into
seperate modules.
2019-10-16 23:18:04 +01:00
morganamilo
0856edcf04
Move LessRunes into main
This comparitor function could hardly be considored a type. It's also
very small and probably not too useful overall so keep it in utils.
2019-10-16 22:02:50 +01:00
Anna
543d3afaa7
Merge pull request #1053 from Morganamilo/group-transactions-fix
Re-add --batchinstall and fix dep issues
2019-10-16 21:48:20 +01:00
morganamilo
4d91acc749
Re-add --batchinstall and fix dep issues 2019-10-16 20:59:52 +01:00
Jguer
8151e47211
Fix linting test not exiting in case of error 2019-10-16 17:24:59 +01:00
Jguer
91232f2b74
Enable workflows only on tag push and on specific directories 2019-10-16 03:04:01 +01:00
Jguer
d647d29435
Added multiarch build and release workflow 2019-10-16 02:51:14 +01:00
Jguer
077b1092fd
pkg/completion interfaces more strict 2019-10-16 00:03:58 +01:00
J Guerreiro
73d87b01b0
Merge pull request #1062 from reyreaud-l/add-diff-review-ref
Change ref name used in git to compute diff to "AUR_SEEN".
2019-10-15 23:55:36 +01:00
Loic Reyreaud
21d0f33dae
Change ref name used for marking reviewed diff to AUR_SEEN 2019-10-15 10:02:10 +02:00
Loic Reyreaud
de48604633
change ref used in git to compute diff to AURUTILS_SEEN
Introduce a global constant in download.go to avoid re-typing the string
everytime.
Change the string form YAY_DIFF_SEEN to AURUTILS_SEEN.
2019-10-14 11:07:21 +02:00
J Guerreiro
7b710b796b
Merge pull request #1056 from Morganamilo/searchby
Add --searchby
2019-10-13 23:38:28 +01:00
J Guerreiro
96dd1d3ce2
Merge pull request #1061 from Jguer/enforce-lint
Enforce lint in CI
2019-10-13 23:37:35 +01:00
Jguer
c180fa8d19
PkgbuildDiffs use MultiError now to accumulate errors instead of breaking execution at any error 2019-10-13 23:23:55 +01:00
Jguer
29b051134a
Add comments to Base type 2019-10-13 20:59:25 +01:00
Jguer
c44f738ba8
Convert linting to Makefile action. Patch Dockerfile and CI script 2019-10-13 20:59:20 +01:00
Jguer
a591b33262
Add errguards throughout the code to enable golangci-lint 2019-10-13 20:56:27 +01:00
Jguer
422a5931af
Check fields length to avoid panic in editor prompt. Fixes #834 2019-10-13 00:48:12 +01:00
J Guerreiro
f1a6c4afdc
Merge pull request #1049 from reyreaud-l/add-diff-review-ref
FR #994: Implement proper diff display
2019-10-13 00:07:56 +01:00
J Guerreiro
923ec9aafd
Merge pull request #1054 from Morganamilo/default
Have "make build" build be the default again
2019-10-11 00:25:05 +01:00
morganamilo
ab2101ab49
Add --searchby
Allow using the RPC's &by= field during -Ss
2019-10-10 17:43:22 +01:00
morganamilo
b773ec2aa4
Have "make build" build be the default again 2019-10-10 16:37:37 +01:00
Anna
3579d3521a
Merge pull request #1052 from tomswartz07/master
Fix Typos
2019-10-10 09:30:58 +01:00
Tom Swartz
5d7ea17b15
Fix typo in comment text 2019-10-09 10:15:36 -04:00
Tom Swartz
81dcc339e0
Fix typo in completion text 2019-10-09 10:15:20 -04:00
Loic Reyreaud
7ee206f36e
Implement proper diff display
As raised in #994, diff display was not proper when interrupting during
download or diff review.

This commit introduce:
- Add a ref in the git tree named "YAY_DIFF_REVIEW" which is set to the last
diff reviewed by the user.
- Change the function displaying diff to user to make proper use of this
new ref. If the ref does not exist in the git tree, it will display the
diff from origin to HEAD@{upstream}.
- Add a function updating the YAY_DIFF_REVIEW after it has been reviewed
by user. It uses the `toDiff` list in the `install` function.
- Add utils function related to handling this change in download.go.

This change only consider diff reviewed to update the YAY_DIFF_REVIEW ref.
If a user does not enable review, the ref will not be updated and the
user will be prompted for review when he enables diff review.

Signed-off-by: Loic Reyreaud <reyreaud.loic@gmail.com>
2019-10-07 13:59:17 +02:00
J Guerreiro
6e2a4def99
Merge pull request #1048 from Jguer/module-types
Module types
2019-10-07 12:10:40 +01:00
cominixo01
a7619cce2b Only remove VCS if the package was removed successfully (#1041)
* Only remove VCS if the package was removed successfully

* Use := instead of var

* Fix formatting
2019-10-05 20:20:20 +01:00
Jguer
ed274ec665
Improve testing of Intranges 2019-10-05 19:42:47 +01:00
Jguer
bf89b3383c
Move IntRange definition to types package 2019-10-05 19:23:13 +01:00
Jguer
b01790f752
Moved StringSet definition to types package 2019-10-05 18:39:31 +01:00
Jguer
3d31b52799
Moved LessRunes to types package 2019-10-05 18:11:49 +01:00
Jguer
9e205eef4b
Move MultiError to types package 2019-10-05 17:35:46 +01:00
Jguer
fdcfeba902
Bump version to 9.3.3. Fix issues with make build calling make vendor 2019-10-05 11:16:58 +01:00
J Guerreiro
769aee728a
Merge pull request #1046 from Jguer/module-completion
Move completion to submodule
2019-10-05 02:20:20 +01:00
Jguer
5fa3557817
Store completions in yay's cache folder instead of build directory 2019-10-05 02:10:15 +01:00
Jguer
c5c2e906d3
Move completion to submodule 2019-10-05 02:02:30 +01:00
Jguer
5084391e79
Makefile: Fix docker-build 2019-10-05 01:04:01 +01:00
Jguer
6589631c6a
Removed GOPATH symlink needed before go modules 2019-10-04 23:32:55 +01:00
J Guerreiro
569d314cea
Merge pull request #1045 from Jguer/yay-git-actions
Upload yay releases using github-actions
2019-10-04 22:45:03 +01:00
J Guerreiro
a04ece5feb
Merge pull request #1044 from Jguer/fix-make
Fix order of variables in makefile
2019-10-04 20:44:32 +01:00
Jguer
963af374b5
Fix order of variables 2019-10-04 20:43:42 +01:00
J Guerreiro
e698336873
Merge pull request #1043 from Jguer/fix-1042
Revert "Merge pull request #778 from Morganamilo/group-transactions"
2019-10-04 20:02:55 +01:00
Jguer
2214bc0cb2
Revert "Merge pull request #778 from Morganamilo/group-transactions"
This reverts commit 6cd47dd83c49689f0bd84c650feea9c71ed1aaf2, reversing
changes made to 16fddae8b6e5b0adb0265f4f8f44bff607394dcc.

Signed-off-by: Jguer <me@jguer.space>
2019-10-04 19:42:17 +01:00
J Guerreiro
99d1df6f1d
Merge pull request #1035 from Maryse47/master
Use BuildDir instead of cacheHome to store PKGBUILDS with -G
2019-09-30 16:22:05 +01:00
Maryse47
f8339fc568
Use BuildDir instead of cacheHome to store PKGBUILDS with -G
BuildDir resolves to same place as cacheHome by default but it's configurable which helps in case user want to chose different directory to store PKGBUILDS.
2019-09-29 15:42:34 +00:00
Jguer
dfef396d3c Upload yay release artifact 2019-09-29 12:22:55 +01:00
Jguer
5b3ae061cf makefile: remove unreferenced target 2019-09-29 10:30:33 +01:00
Jguer
d0705a6d6b Make makefile more targeted by refactoring. Add new multistage dockerfile
Remove separate targets for release.
Replace travis-ci with github-actions

Signed-off-by: Jguer <me@jguer.space>
2019-09-29 10:24:09 +01:00
Jguer
de95a0e253 Change depsolver to not use a preallocated slice to get make only deps.
Makes it "slower" but fixes issues where cap would return less than 0.

Fixes #857
2019-09-23 01:01:30 +01:00
Jguer
fd9a62ddb8 Bump version 2019-09-20 18:37:42 +01:00
Jguer
d34a84204a Changes -G in ABS to use git and symlink result.
Fixes #1027
2019-09-20 18:34:05 +01:00
Andrew Shark
1901138e4c removed clutter from completion array 2019-09-12 09:44:39 +01:00
Andrew Shark
0ff6ced19f fix typos in man 2019-09-12 09:44:39 +01:00
J Guerreiro
392865f7a0
Fix travis from tripping on go vet. (#1009)
* Fix travis from tripping on go vet.

* Fix strings from gofmt
2019-08-24 23:31:13 +01:00
J Guerreiro
c9f7105481
Merge pull request #1000 from kiendang/print-size
Correct package range in error message
2019-07-31 10:43:53 +01:00
Kien Dang
995d788e7c Correct package range in error message 2019-07-31 17:22:31 +08:00
J Guerreiro
64eadcdaa2
Merge pull request #989 from muesli/conversion-fixes
Avoid unnecessary conversion
2019-07-19 19:41:16 +01:00
Christian Muehlhaeuser
3700c1daa6
Avoid unnecessary conversion
stderr is already a string.
2019-07-19 11:51:42 +02:00
J Guerreiro
f406866a45
Merge pull request #969 from simon04/out-of-date-format
print: out-of-date format
2019-06-19 13:07:14 +01:00
Simon Legner
d25f2939eb print: out-of-date format
Consistently use the same date format for all dates.
2019-06-19 12:42:08 +02:00
Anna
591f38488a
Merge pull request #965 from Morganamilo/fix-provides
Hide provider menu with --noprovides
2019-06-17 21:28:39 +01:00
morganamilo
125e716547
Hide provider menu with --noprovides
This feature was already implemented in
e71fb8617a5b014d2f875554e270b5b47d9182d1 but was accidently reverted.
2019-06-17 21:25:11 +01:00
Anna
6cd47dd83c
Merge pull request #778 from Morganamilo/group-transactions
Allow many aur packages to be installed at once.
2019-06-17 15:42:40 +01:00
morganamilo
80e66ce479
Allow many aur packages to be installed at once.
After building an AUR package don't install it right away. Instead queue
it for install.

Then when a package comes along that does not have all of its
dependencies satisfied, install the queued packages before builting.

This allows a standard AUR update to be done with one transaction, while
building AUR packages with long dependency chains will work as normal.

This feature is behind the `--batchinstall` flag.
2019-06-17 14:25:59 +01:00
Jguer
16fddae8b6 Fix linting error breaking docker release 2019-06-17 13:22:30 +01:00
morganamilo
e01af5dfd6
Fixup asdeps logic 2019-06-17 13:15:54 +01:00
morganamilo
c717b61e69
Extract dep and exp setting to their own functions 2019-06-17 13:08:23 +01:00
morganamilo
5ac36ad97e
Ensure global pacman arguments are always used 2019-06-17 13:03:57 +01:00
J Guerreiro
e0a5e24a12
Merge pull request #964 from benjamb/fix-typo
Fix typo
2019-06-17 12:21:54 +01:00
Ben Brown
e43e68f6bf Fix errant capitalisation 2019-06-17 12:04:07 +01:00
Ben Brown
13d8c82d42 Fix "ealily" typo 2019-06-17 12:02:49 +01:00
J Guerreiro
bcaf8a0eb7
Merge pull request #961 from FryDay/remove-make-deps
Defer cleanAfter and removeMake
2019-06-16 16:32:12 +01:00
Jordan Day
37f3309917 Defer clean and remove make 2019-06-11 08:54:24 -05:00
Jguer
86b73689a3
Should fix #960. Bumps patchversion 2019-06-03 23:39:30 +01:00
Jguer
06da88778e
Fix #954 2019-05-27 12:46:08 +01:00
J Guerreiro
b32a8ad582
Merge pull request #952 from H4rryA/943
Updated sudo check for -Rp #943
2019-05-18 13:56:41 +01:00
Harry Arakkal
48e1d65539 Updated sudo check for -Rp 2019-05-17 21:26:22 -07:00
Anna
d406966174
Merge pull request #939 from Morganamilo/fixups
Fixups
2019-04-23 17:16:11 +01:00
morganamilo
6415c23be2
Random fixups 2019-04-23 17:03:09 +01:00
morganamilo
112046853b
Use correct case on go-alpm import 2019-04-23 16:53:20 +01:00
J Guerreiro
e1f3437c64
Merge pull request #930 from Jguer/docker-build-armv7
Added arm v7 build
2019-04-10 15:06:16 +01:00
Jguer
4e34e3a5fe Added arm v7 build 2019-04-09 19:39:38 +01:00
Jguer
eb468fc878
Update minor version 2019-04-06 13:10:12 +01:00
J Guerreiro
308cf5c3de
Fix custom operations display 2019-04-06 12:13:33 +01:00
J Guerreiro
af9f9751ee
Updated images to better reflect current state 2019-04-05 18:00:48 +01:00
J Guerreiro
5932b6987d
Merge pull request #928 from Jguer/fix#919
Fix #919, require explicit sort mode defined
2019-04-04 22:23:39 +01:00
Jguer
cf12fc6ff2
Fix #919, require explicit sort mode defined 2019-04-04 21:47:44 +01:00
Jguer
56da655195 Add docker-build for development outside of arch environment 2019-04-04 12:14:34 +01:00
Jguer
f21a5a7f1a
Merge previous README changes 2019-04-03 23:07:57 +01:00
Jguer
5db33b6bcb
Documented and fixed docker release process 2019-04-03 23:06:22 +01:00
J Guerreiro
dc2186c5f3
Fix up Readme typo 2019-04-03 21:28:35 +01:00
Jguer
9d708d5186 Add multiarch images for cross-compiling 2019-04-03 21:08:58 +01:00
J Guerreiro
a75506cc34
Merge pull request #927 from Morganamilo/fix#926
Update go-srcinfo
2019-04-01 17:33:37 +01:00
morganamilo
711e12d7bb
Update go-srcinfo 2019-04-01 17:27:27 +01:00
J Guerreiro
01e9cd2d47
Remove mentions of dep 2019-03-30 09:22:53 +00:00
J Guerreiro
6809d7c6d2
Merge pull request #370 from Jguer/travis-exp
Test arch-travis on yay. Just test if it's building right now and then we can get serious
2019-03-29 22:30:50 +00:00
J Guerreiro
8880213fb0
Merge pull request #923 from Jguer/revert-916-sudobin
Revert "Add SudoBin"
2019-03-29 22:09:39 +00:00
J Guerreiro
888a289a1b
Revert "Add SudoBin" 2019-03-29 22:09:27 +00:00
J Guerreiro
aa82518720
Merge pull request #916 from daftaupe/sudobin
Add SudoBin
2019-03-29 22:08:20 +00:00
J Guerreiro
062c6ea6d8
Merge pull request #922 from Jguer/fix918
Fix #918. Get back in the groove
2019-03-29 22:05:43 +00:00
Jguer
e1bc834f5b
Fix #918. Get back in the groove 2019-03-29 22:05:04 +00:00
Pierre-Alain TORET
877c794bc2 Add SudoBin and SudoFlags 2019-03-27 15:16:39 +01:00
J Guerreiro
ec5746f09f
Merge pull request #909 from sosiska/patch-1
Some more code improvements
2019-03-15 20:50:34 +00:00
Anna
1447fb9ff0
Merge pull request #908 from CodeLingoBot/rewrite
Fix function comments based on best practices from Effective Go
2019-03-13 09:14:16 +00:00
Motkov Kirill
14ac756298 Code improvements
- Removed yoda condition.
- Renamed/removed variables which shadows built-in names.
- Rewrited if-else-if-else chains to switch statements.
2019-03-10 16:36:01 +03:00
CodeLingo Bot
1771c8f0b3 Fix function comments based on best practices from Effective Go
Signed-off-by: CodeLingo Bot <bot@codelingo.io>
2019-03-07 02:36:53 +00:00
Arseni
417cc653ab Improve the man page's writing and fix typos. (#904)
* Fix typos in man page

* Use more concise forms of verbs in man page

* Fix confusing list in man page
2019-03-06 16:36:18 +00:00
Anna
e18cd9b1e8
Merge pull request #903 from sosiska/patch-1
code improvements
2019-03-05 20:26:14 +00:00
Motkov Kirill
0878b485ae remove suspicious err reassigns 2019-03-05 23:10:04 +03:00
Anna
c3caa2da94
Merge pull request #899 from Morganamilo/fixalpm
Update go-alpm
2019-03-05 19:00:57 +00:00
Motkov.Kirill
a33801615c miss assignment to err 2019-03-05 11:10:56 +03:00
Motkov.Kirill
50a99c1e54 remove yoda condition 2019-03-05 11:08:37 +03:00
J Guerreiro
808f6332c2
Merge pull request #901 from sosiska/patch-1
rewrite if-else to switch statement
2019-03-04 19:19:38 +00:00
Motkov.Kirill
7b8e45d4e2 rewrite if-else to switch statement 2019-03-04 19:07:04 +03:00
morganamilo
5e04e693c4
Update go-alpm 2019-03-02 21:15:33 +00:00
Anna
b2ab67c410
Merge pull request #895 from sosiska/patch-1
remove unwanted space
2019-03-01 09:55:51 +00:00
Motkov.Kirill
504e4e21af remove unwanted space 2019-02-26 14:41:35 +03:00
J Guerreiro
aa1e88459f
Merge pull request #888 from willipink/master
fix typo
2019-02-20 08:24:31 +00:00
koksnuss
737ed78eb1 fix typo 2019-02-18 23:39:23 +01:00
Anna
8ebc41d4f6
Merge pull request #886 from Morganamilo/fix#883
Update go-alpm
2019-02-14 20:46:33 +00:00
morganamilo
895788e01b
Update go-alpm 2019-02-14 20:45:18 +00:00
Anna
a645353c17
Merge pull request #879 from Morganamilo/update-go-alpm
Why you shouldn't just rely on: git commit -a
2019-02-04 17:20:29 +00:00
morganamilo
4b2279edbc
Why you shouldn't just rely on: git commit -a 2019-02-04 17:16:48 +00:00
Anna
229f2c606b
Merge pull request #878 from Morganamilo/update-go-alpm
Update go-alpm
2019-02-04 16:58:42 +00:00
morganamilo
5ce4a49687
Update go-alpm 2019-02-04 16:56:02 +00:00
J Guerreiro
dcc323cc06
Merge pull request #876 from opes/typo_fixes
Fix typos in help menu
2019-02-03 12:10:36 +00:00
Dan Minkevitch
eab94628ec Fix typos in help menu 2019-02-02 17:36:46 -08:00
Anna
18e5b47e4a
Merge pull request #873 from Morganamilo/support-Sl
Support -Sl
2019-01-26 23:51:05 +00:00
morganamilo
4f01418769
Support -Sl
Adds (mostly) complete -Sl support. While pacman will also print the
version number for the package, packages.gz does not give version
numbers. Using -Si to fetch all that data would also be unthinkable.

Instead of just missing out the version number yay will print
"unknown-version". This is so that tools that expect a version number do
not break.
2019-01-26 23:31:46 +00:00
Jguer
0f57ed0ba8
Update to version 9.1.0 2019-01-20 15:52:21 +00:00
Jguer
50a52dba94
Fixes #865 2019-01-17 17:29:20 +00:00
J Guerreiro
6354a4424e
Merge pull request #866 from Morganamilo/revert-depsolver
Revert "Merge pull request #767 from Morganamilo/merge-dep-pool-order"
2019-01-17 17:24:39 +00:00
morganamilo
4ab7814af1
Revert "Merge pull request #767 from Morganamilo/merge-dep-pool-order"
This reverts commit c2aeb4bc4eea0a7870ac1e3712dad4d1459b70f1, reversing
changes made to 1f1cee70239a3dffa1ac3a243812a01aa1699c53.
2019-01-15 18:43:46 +00:00
J Guerreiro
478e1ee869
Transition to jsdelivr
Raw git is getting discontinued in October, fix it now instead of repair it later.
2019-01-12 13:16:27 +00:00
J Guerreiro
b715c11306
Merge pull request #854 from 1ace/completion-bash-getpkgbuild
add bash completion for -G,--getpkgbuild
2019-01-07 23:01:41 +00:00
Eric Engestrom
ebf48ffa1a add bash completion for -G,--getpkgbuild 2019-01-07 21:30:00 +00:00
Jguer
5acee2706f
Fix typo in cache dir. References #840 2018-12-19 21:13:46 +00:00
Anna
3e1f29277b
Merge pull request #832 from parkerlreed/master
Match the query date/time to pacman. Fixes #831
2018-12-12 19:47:23 +00:00
Parker Reed
6db8864572 Match the query date/time to pacman. Fixes #831 2018-12-12 14:37:56 -05:00
Jguer
d3a9082f2a
Update patch version of yay to reflect makefile changes 2018-12-07 14:00:17 +00:00
J Guerreiro
14cb1c587f
Merge pull request #826 from Jguer/gcc-go
Readd gopath tweaks to function in makepkg. Only for gcc-go
2018-12-07 13:51:54 +00:00
Jguer
555b166fd3
Readd gopath tweaks to function in makepkg. Only for gcc-go 2018-12-07 13:50:57 +00:00
J Guerreiro
13e3acaedf
Merge pull request #825 from Jguer/gcc-go
Detect gccgo and give them their own flags. #824
2018-12-07 13:44:47 +00:00
Jguer
cc0036c43b
Detect gccgo and give them their own flags. #824 2018-12-07 13:37:44 +00:00
J Guerreiro
1bb73667c9
Add information about development packages 2018-12-06 22:36:53 +00:00
J Guerreiro
fa8d4b0184
Merge pull request #822 from sseering/master
fix copy-paste error
2018-12-06 20:58:53 +00:00
Stefan Seering
cc98fa0670 fix copy-paste error 2018-12-06 20:01:09 +01:00
Jguer
47373c5631
update version 2018-12-06 08:09:05 +00:00
Jguer
a05886d9eb
Update major version 2018-12-03 14:51:17 +00:00
Jguer
6b31a1a626
Finish transition to go modules even in gopath 2018-12-03 14:49:39 +00:00
Jguer
84022c9425
Merge branch 'modules' of github.com:Morganamilo/yay into Morganamilo-modules 2018-12-03 14:41:10 +00:00
J Guerreiro
7644a92c1c
Merge pull request #819 from Jguer/8.2
Fix tests broken in master
2018-12-03 14:06:10 +00:00
Anna
258f90edec
Merge pull request #817 from cezarmathe/master
Fixed a comment in download.go, line 18
2018-12-02 22:44:09 +00:00
Jguer
5bcadc58ac
Fix tests and prepare for release 2018-12-01 15:03:46 +00:00
cezarmathe
6a95783790
Fixed a comment in download.go, line 18 2018-11-30 11:41:30 +02:00
Anna
91cf1e27a1
Merge pull request #815 from Morganamilo/fix#812
Fix each iota not starting at 0
2018-11-29 20:45:10 +00:00
morganamilo
556a76c38d
Fix each iota not starting at 0 2018-11-29 20:42:06 +00:00
Anna
e18c236937
Merge pull request #799 from frebib/master
Print errors on stderr
2018-11-21 19:47:06 +00:00
Joe Groocock
52bf777e67
Print errors on stderr
This makes a start on fixing https://github.com/Jguer/yay/issues/715
It is by no means a complete solution, but instead a start
2018-11-20 22:27:30 +00:00
Anna
96a4d9637c
Merge pull request #791 from ZenixTheHusky/Fix#767
Modified readme to show extra dependency
2018-10-30 22:44:25 +00:00
Peter Dyer
57ba60f283 Modified readme to show extra dependency 2018-10-30 22:41:47 +00:00
Anna
431118b6ac
Merge pull request #783 from Morganamilo/unexport
Unexport consts. Make default a literal
2018-10-22 21:17:30 +01:00
Jguer
2ed7df4f5a
Unexport consts. Make default a literal
Signed-off-by: Jguer <me@jguer.space>
2018-10-22 21:00:16 +01:00
Anna
b40b1ef910
Merge pull request #779 from ZenixTheHusky/Fix#767
--noprovides now hides Yay's provider menu
2018-10-18 23:42:53 +01:00
Peter Dyer
c7123e03df Update man page for new --noprovides functionality 2018-10-18 23:27:49 +01:00
Peter Dyer
e71fb8617a --noprovides now hides Yay's provider menu
--noprovides flag now takes the default option in the provider menu
without showing the menu.
2018-10-18 23:12:51 +01:00
Anna
c2aeb4bc4e
Merge pull request #767 from Morganamilo/merge-dep-pool-order
Merge dep pool order and rework inner conflicts
2018-10-18 10:15:40 +01:00
Jguer
1f1cee7023
Update manual config version 2018-10-18 09:19:45 +01:00
Anna
79f7322722
Merge pull request #775 from dvejmz/fix#753
Handle libalpm callbacks when checking DB satisfiers for a package
2018-10-17 00:18:55 +01:00
dvejmz
d42f737849 Handle libalpm callbacks when checking DB satisfiers for a package
Hide provider menu when checking for the existence of a package in
the repos
2018-10-16 23:55:35 +01:00
Anna
a565544712
Merge pull request #770 from ZenixTheHusky/Fix#769
Added a more verbose message when db.lck exists
2018-10-13 18:57:40 +01:00
Peter Dyer
145a1393b5 Added a more verbose message when db.lck exists 2018-10-13 18:55:09 +01:00
morganamilo
7702a88ebb
Print conflicts in order of install
This is usefull for inner conflicts, you can follow when packages will
be swapped out with others.
2018-10-13 18:24:22 +01:00
morganamilo
0bfba1f24b
Use slices for AUR dep resolving
This ensures AUR packages are always installed in the order specified by
the user. In the case there are any inner conflicts packages will be
removed in a predictable way.
2018-10-13 18:24:00 +01:00
morganamilo
f648697994
Rework inner conflicts
Inner conflicts now check against the previously installed aur packages
For example when installing yay, yay-bin and yay-git

yay will be checked the previously insalled packages (nothing)

yay-bin will be checked the previously insalled packages and see that it
conflicts with yay and warn you that yay will be removed

yay-git will be checked the previously insalled packages and see that it
conflicts with yay but see that it has already been removed by yay-bin
so does nothing. Then it will see that it conflicts with yay-bin and
warn you that yay-bin will be removed

This example is unlikley to happen unless the user enters
`yay -S yay yay-bin yay-git`. But where this does happen is packages
which have some sort of bootsrapping process such as ffmpeg-libfdk_aac.

If two repo packages conflict then we abort. This is because they will
be installed at the same time and we never swap repo packages mid AUR
install.
2018-10-13 17:04:22 +01:00
morganamilo
5080e400e1
Remove printing conflict name in conflicts
Currently when printing conflicts the package name is printed and then
name of the conflict if it differs from the package name.

For example if yay-git is installed and you are installing yay-bin:
	yay-bin conflicts with yay
	yay-git provides yay

	so the conflict is printed as "yay-bin (yay)"

This is not too bad but some packages have many provides and conflicts
that ends up cluttering the output.

For example if gvim is installed and you are installing vim:
	"gvim, gvim (vim-minimal), gvim (vim)" is printed

Just printing the package name should be enough information. If not the
user can always -Si either package.
2018-10-13 17:04:22 +01:00
morganamilo
ff4f076d57
Move depSolver checks back to depCheck.go 2018-10-13 17:04:22 +01:00
morganamilo
a83f8fb9e8
Remove depPool and depOrder code 2018-10-13 17:04:21 +01:00
morganamilo
4ff36fbd4b
Use depSolver in install 2018-10-13 17:04:21 +01:00
morganamilo
704e8406d1
Merge depOrder with depSolver
merge both dependency resolving parts into depSolver. The name was
choosen simply to not colide with the current code.

depSolver works but it not implemented in the install process and is
missing conflict checking.
2018-10-13 17:04:21 +01:00
Anna
827dbd21cb
Merge pull request #768 from Morganamilo/askflag
Add ask to accepted flags
2018-10-13 01:33:05 +01:00
morganamilo
8c44da374c
Add ask to accepted flags
Again, the list was generated via the manpage and as this is
undocumented it was forgotten.
2018-10-13 01:31:16 +01:00
morganamilo
0efc31a881
Add helper functions for []Base 2018-10-11 00:14:33 +01:00
morganamilo
75d01f32b4
Move Base code to dep.go 2018-10-10 22:28:01 +01:00
morganamilo
5109fc6250
Move target code to dep.go 2018-10-10 22:13:00 +01:00
Anna
2034575a76
Merge pull request #766 from Morganamilo/innerconflicts
Don't abort on inner conflicts
2018-10-10 19:31:48 +01:00
morganamilo
3861aef502
Don't abort on inner conflicts
Currently there may be times where there are inner conflicts but the
install would go okay as packages will be swapped out as they go. Warn
the user but leave it up to them if they want to continue.
2018-10-10 16:31:55 +01:00
Anna
69fd7a9b9e
Merge pull request #764 from Morganamilo/fix#762
Allow --print again
2018-10-09 16:16:25 +01:00
morganamilo
0f4768b4fe
Allow --print again
Comit 2d6fe95903ac118811d8f24a5fb3361de09e0114 renamed the Yay specific
flag -P/--print to -P/--show. The rename caused --print to stop being
accepted as it was no longer in the list of accepted args.
2018-10-09 16:15:46 +01:00
Anna
d6d76ee430
Merge pull request #763 from Morganamilo/fix#762
Fix missing '-' in flags
2018-10-09 16:06:58 +01:00
morganamilo
73deae94cf
Fix missing '-' in flags
isArg() was generated from pacman's manpage using a script. All dashes
were stripped out. Some flags used '-' as a seperator and were stripped
out by mistake.
2018-10-09 16:06:14 +01:00
Anna
5fe9160b1b
Merge pull request #760 from Morganamilo/fixprotocols
Use correct source protocol for VCS checks
2018-10-09 01:24:57 +01:00
morganamilo
f26f36d459
Update tests 2018-10-09 01:21:31 +01:00
morganamilo
cbc2a87c73
Use correct source protocol for VCS checks
Previously it was assumed that "git+https" means: use git and if that
fails fall back to https. What this actually means is just: use git over
https. Similary "git" just means use git and "git+http" means use git
over http.

Thus there is only ever one protocol to use. The current protocols array
has been kept for backwards compatibility with the vcs.json file. The
difference being now it will only ever place one protocol into the
array. Also when reading the array, the last protocol is always used.
This is so that entries that have not been regenerated will use the
correct protocol.
2018-10-09 01:18:23 +01:00
Jguer
621b8aac43
Update constant version. Add transitional support for patch version 2018-10-08 18:46:51 +01:00
J Guerreiro
e316c979cc
Merge pull request #757 from Jguer/revert-756-fix-#752
Revert "Don't show missing packages if they are ignored.  Closes #752"
2018-10-08 11:53:02 +01:00
J Guerreiro
f74a4f33b5
Revert "Don't show missing packages if they are ignored. Closes #752" 2018-10-08 11:51:19 +01:00
J Guerreiro
a19151504d
Merge pull request #756 from Jguer/fix-#752
Don't show missing packages if they are ignored.  Closes #752
2018-10-08 00:27:55 +01:00
Jguer
9ad7c34949
Don't show missing packages if they are ignored 2018-10-08 00:20:43 +01:00
Anna
6ee14d44b8
Merge pull request #738 from Morganamilo/fix#736
Rework cleanafter
2018-10-04 09:18:57 +01:00
Anna
c574cdcf98
Merge pull request #744 from tomswartz07/typos
Fix Typos
2018-10-03 09:07:10 +01:00
Tom Swartz
ae7400890d Fix Typos 2018-10-02 16:30:18 -04:00
Anna
7ee2e5d1eb
Merge pull request #739 from Morganamilo/ttycolour
Support color = auto
2018-09-27 18:45:29 +01:00
morganamilo
e78070ebbe
Support color = auto
This is done using the test command as the stdlib lacks any way to
do this without using syscalls directly
2018-09-27 16:52:22 +01:00
morganamilo
4cc57dd970
Rename afterclean to cleanafter
This makes more sense and falls in line with the structs value which has
always been cleanafter. afterclean is still useable for compatibility
but is undocumented.
2018-09-27 16:12:43 +01:00
morganamilo
42cba53165
Update doc for --afterclean and fix typo 2018-09-27 16:08:00 +01:00
morganamilo
98e6caefef
Fix dangling src/ directory
Yay first calls 'makepkg --nobuild -fC' to update the pkver. Later on we
call 'makepkg -cf --noectract --noprepare --holdver' to actually build
the package.

Inbetween these two calls we keep the already extracted
sources to save time on the reextract and duplicated call to prepare
(pkgbuilds should not require user input but things such as linux-ck do
and calling prepare twice will actually cause them to promt twice)

We also have two checks. First we see if the package is already
installed and up to date (--needed) and secondly we check if the
package is already built.

If any of these conditions are met we skip building the package. This
leaves a dangling src/ directory as 'makepkg -c' was never ran.

Now if these conditions are met tell makepkg to cleanup and exit.
2018-09-27 15:55:43 +01:00
morganamilo
bf0ab3216a
Leave VCS files when using clean after 2018-09-27 15:55:43 +01:00
J Guerreiro
ade9eb83eb
Merge pull request #729 from Morganamilo/template
Update issue template
2018-09-25 19:04:16 +01:00
Anna
2b8fa74c22
Merge pull request #732 from Morganamilo/fix#730
Fix provider menu showing when it shouldn't
2018-09-25 14:38:09 +01:00
morganamilo
4fc6a1a711
Fix provider menu showing when it shouldn't
If the package is already installed, we need to check if it is in the
repos to see if it aplies to rebuild tree. Normally alpm will not prompt
us to select a provider if we already have one installed. An exception
comes up when we have a provider installed that is from the AUR. In this
case FindSatisfier() still asks us to select a provider.

Now make sure to never to never show the menu if the package exists in
the local repo.
2018-09-25 14:33:25 +01:00
morganamilo
9dfc445421
Update issue template 2018-09-25 11:25:29 +01:00
Jguer
9ac4ab6c25
Update to 1138 2018-09-24 17:35:13 +01:00
J Guerreiro
dededfde6a
Merge pull request #727 from Jguer/fix#726
Fix -Qu to respect -q. Fixes #726
2018-09-24 10:54:36 +01:00
Jguer
293339263c
Fix -Qu to respect -q. Fixes #726 2018-09-24 10:52:29 +01:00
J Guerreiro
2826e7d79e
Merge pull request #725 from Jguer/fish
Fix fish completions
2018-09-24 00:18:04 +01:00
Jguer
13f81c7624
Remove non existant show options and add missing -Pg 2018-09-24 00:17:15 +01:00
Anna
f79b3b90a4
Merge pull request #724 from Morganamilo/#722
Accept --assume-installed
2018-09-23 22:11:46 +01:00
morganamilo
60cf21f445
Accept --assume-installed 2018-09-23 22:10:22 +01:00
Anna
1f5ff02398
Merge pull request #723 from Morganamilo/makefile
Fixup Makefile
2018-09-23 22:02:54 +01:00
morganamilo
8b325ce704
Fixup Makefile
Remove ifndef: ?= can be used instead
Add package to .phony
2018-09-23 21:54:22 +01:00
Anna
f495b1a33e
Merge pull request #714 from Morganamilo/fix#700
Fix misleading word in man page and missing \n
2018-09-20 00:49:23 +01:00
morganamilo
b0aaba7848
Fix misleading word in man page and missing \n 2018-09-20 00:46:10 +01:00
Anna
fa1c76c4e9
Merge pull request #712 from ZenixTheHusky/Fix#711
Set SigLevel to 0
2018-09-19 21:11:48 +01:00
Peter Dyer
e6238d32fa Set SigLevel to 0
Previous default SigLevels caused 3rd party databases to take a very long time to
load and also to not load properly. Probably due to missing keys(?).
Pacman takes a long time to check the databases. For now, always set to
SigLevel 0 like how go-alpm did in its config parsing. Needs more
looking into for a proper fix.
2018-09-19 19:52:58 +01:00
Anna
380cc142dc
Merge pull request #709 from Morganamilo/fixtest
Fix hard coded path
2018-09-15 21:28:29 +01:00
morganamilo
23d45b1e77
Fix hard coded path 2018-09-15 21:27:31 +01:00
Jguer
4131262f36
Add some vetting to travis
Signed-off-by: Jguer <me@jguer.space>
2018-09-15 19:57:06 +01:00
Jguer
586dfc8ce7
Merge branch 'master' into travis-exp 2018-09-15 19:49:34 +01:00
Anna
07b7be3788
Merge pull request #706 from Morganamilo/temp-modules
Fix build when go module is enabled
2018-09-15 18:55:26 +01:00
morganamilo
f556389fa8
Update Readme for building with modules enabled 2018-09-15 18:51:45 +01:00
morganamilo
7f064db676
Fix build when go module is enabled 2018-09-15 18:47:46 +01:00
morganamilo
90d8b15c59
Convert to go modules 2018-09-15 17:42:34 +01:00
Jguer
b10b88faf6
Update vendored dependencies
Signed-off-by: Jguer <me@jguer.space>
2018-09-14 01:29:33 +01:00
Anna
47702f4cec
Merge pull request #682 from Morganamilo/pacmanconfig
Use go-pacmanconf for config parsing
2018-09-10 23:20:37 +01:00
morganamilo
7251ffac8a
Add test for reading pacman config 2018-09-10 23:07:34 +01:00
morganamilo
b2f636d93b
Use go-pacmanconf for config parsing
This moves the config parsing from out of alpm and into the
go-pacmanconf libary plus some boilerplate code to get it into our alpm
config.

This makes sense as many config options such as UseColor and CleanMethod
have nothing to do with alpm and only relate to pacman.

pacman-conf is used instead of direct config parsing. This tool resolves
defaults and includes for us, so we don't need to handle it.

It is now safe to drop all the config parsing from go-alpm.
2018-09-10 23:07:34 +01:00
morganamilo
83d3411549
Add go-pacmanconf 2018-09-10 23:07:34 +01:00
Anna
8248c803a0
Merge pull request #693 from Morganamilo/fix#629
Don't assume the go root
2018-09-07 19:14:10 +01:00
morganamilo
81bccfd34e
Don't assume the go root
The go root might be in different places if the user is using
a different go binary that is not managed by the system (eg
/usr/local/bin/go). In this case the go binary should be smart enough to
default to it's own go root. Or if there are still problems, it is on
the user to configure it themselves.
2018-09-07 18:56:50 +01:00
Jguer
6e0797a8c7
Set version manually for gcc-go
Signed-off-by: Jguer <me@jguer.space>
2018-09-05 09:21:11 +01:00
Anna
7133a1252e
Merge pull request #688 from Morganamilo/expandenv
Fix builddir defaulting to config instead of cache
2018-09-04 23:24:24 +01:00
morganamilo
c004364864
Fix builddir defaulting to config instead of cache 2018-09-04 23:19:31 +01:00
Anna
d3a2a060b2
Merge pull request #687 from Morganamilo/expandenv
Expand env before making builddir
2018-09-04 23:07:59 +01:00
morganamilo
0e695468b8
Expand env before making builddir 2018-09-04 23:07:26 +01:00
Jguer
a109ea480c
Set version manually for gcc-go
Signed-off-by: Jguer <me@jguer.space>
2018-09-04 20:18:33 +01:00
Anna
98d27360f7
Merge pull request #684 from Morganamilo/limitpkgbuilddownload
Fixup some download bugs
2018-09-04 20:05:30 +01:00
morganamilo
5c7d6fa3be
Fix --rebuild logic 2018-09-04 20:03:27 +01:00
morganamilo
1beeaaf299
Limit download concurrency to 25 threads 2018-09-04 20:03:23 +01:00
morganamilo
2b6a73041f
Fix redownload logic
--redownload was reversed and redownloaded the deps instead of the
targets.
2018-09-04 19:39:15 +01:00
Anna
bbeaf5bc6e
Merge pull request #683 from Morganamilo/fix#681
Fix depends sometimes being ordered incorrectly
2018-09-04 19:30:41 +01:00
morganamilo
00b880baf9
Fix depends sometimes being ordered incorrectly 2018-09-04 17:48:59 +01:00
Anna
e945f1200a
Merge pull request #678 from Morganamilo/fix#639
Expand environment variables in config
2018-09-01 11:54:59 +01:00
morganamilo
8c1658df0b
Expand environment variables in config 2018-08-31 21:20:40 +01:00
Jguer
b757d0abd3
Set correct version for manual builds
Signed-off-by: Jguer <me@jguer.space>
2018-08-31 13:33:01 +01:00
J Guerreiro
ead1ad5797
Merge pull request #676 from Morganamilo/fix#654
Dont rm directories with -G unless using -f
2018-08-30 20:40:21 +01:00
Anna
103edc2931
Merge pull request #675 from cirelli94/patch-1
Fix typo in  README.md
2018-08-30 16:12:42 +01:00
morganamilo
0657f7e23f
Complete -f for -G and --print -> --show 2018-08-30 16:09:08 +01:00
morganamilo
29642d181f
Document -f for -G and --print -> --show 2018-08-30 16:09:00 +01:00
Cirelli
ae06ca2380
Fix typo 2018-08-30 17:02:20 +02:00
morganamilo
004595a396
Dont rm directories with -G unless using -f 2018-08-30 15:30:52 +01:00
Anna
070f103fb9
Merge pull request #674 from Morganamilo/shell
Update shell completion for --aururl
2018-08-30 11:35:19 +01:00
morganamilo
5996e28e32
Use tabs and use pacman-conf over config parsing
This makes our zsh completion more similar to pacmans. Making it easier
to view diffs between the two.
2018-08-30 11:32:14 +01:00
morganamilo
127c5e7cb9
Update shell completion for --aururl 2018-08-30 11:06:03 +01:00
digimokan
0a120132ec README grammar, spelling, rewording, organizing (#661)
* README grammar, spelling, rewording, organizing

- Add "Objectives" section to group objectives.
- Transform Objective/Feature section bullets into action phrases.
- Fix yay/yaourt/etc capitalization. Italicize and follow ArchWiki style.
- Clearly identify the two Install section options with similar wording.
- Reorganize and reword Contributing section.
- Fix wording in last Code Style section sentence.
- Fix misc FAQ wording.
- Use same style for all FAQ issue links.
- Change link in "skipping packages" FAQ item to ArchWiki partial upgrade.
- Fix FAQ aur-only/repo-only cmd example line-spacing.
- Remove yay -Pu example since it is a deprecated (and wrapped) option.

* Fixup remove trailing newline in README file

* Add warning about editing files in vendor/

* Fixup revert italicized project/program names

* Change obj to Yaourt-style interactive srch/inst

* Change obj to Minimal dependencies

* Remove the limit-to-pacman deps feature

* Revert init-install sentence, but add "alternatively"

* Add provide-handling bullet to features

* Revert aur/repo-only FAQ item to one line

* Format cmd line examples similar to man page format

* Revert interface-for-pacman objective

* Mention dep instead of just saying don't touch

* Merge gopath into the build stage

Setting the gopath is more of a note than a step. It is not required and
I would expect most people can simply ignore it.

* Reword dependencies section.

The contributing section should be information and say what dependencies
are needed. There's no need to tell the user how to install them, they
can figure that out themselves.

Also mention git as a dependency.

* Tweak headings and drop numbers

Similar to the last commit. The headings should be
informative "Code Style", not commanding "Check code".

* yay -> Yay

Be more consistent when writing Yay as a name.

* Use ### instead of #### in Contributing

These are real subheadings, #### looks too small.

* Add support section
2018-08-30 10:54:16 +01:00
Anna
5e23a2fc6b
Merge pull request #669 from Morganamilo/tests-aururl
Fix tests and document --aururl
2018-08-29 23:19:10 +01:00
morganamilo
92ff640a65
Document --aururl 2018-08-29 21:18:37 +01:00
morganamilo
c93b3fca9e
Fix tests 2018-08-29 21:15:01 +01:00
J Guerreiro
73a171f48c
Merge pull request #668 from Jguer/fix-650
Make hash an unsigned integer
2018-08-29 18:31:05 +01:00
Jguer
d0cb79de6b
Make hash an unsigned integer 2018-08-29 18:30:16 +01:00
J Guerreiro
acced8c440
Merge pull request #665 from Morganamilo/fix#664
Expand documentation for --devel
2018-08-28 20:22:40 +01:00
Anna
4c351bdad8
Merge pull request #666 from Morganamilo/rm-timeout
Remove the timeout warning for vcs checks
2018-08-28 04:39:43 +01:00
morganamilo
6894ddfd5c
Remove the timeout warning for vcs checks
This message is proving to be more misleading than helpful. For
git+https sources, many hosts seem to always timeout when trying
ls-remote over git:// but then succeed on https://. This leads to
a time out message being displayed even though the URL was queried
successfully on the second try.
2018-08-28 04:38:58 +01:00
morganamilo
d34ce70455
Expand documentation for --devel
Correclty say Git instead of GitHub
Brielfly explain how --devel checks for updates
Give an example of pacaur-like devel
2018-08-28 04:33:51 +01:00
J Guerreiro
31aca68980
Merge pull request #625 from Morganamilo/updatebashcompletion
Update bash completion
2018-08-23 13:55:58 +01:00
Anna
0a136a3932
Merge pull request #648 from kkjdroid/master
Fixed spelling errors
2018-08-20 17:13:46 +01:00
Kenny Jackson
b39f7494df Fixed spelling errors 2018-08-20 12:05:56 -04:00
Anna
261070bf9d
Merge pull request #646 from Morganamilo/fix#623
Correctly set config.AURURL after parsing flags
2018-08-19 05:56:54 +01:00
morganamilo
2f545c7fdc
Correctly set config.AURURL after parsing flags
And also honour aururl during -Pc
2018-08-19 05:53:32 +01:00
Anna
3ab8a92421
Merge pull request #645 from Morganamilo/fix#623
Add --aururl
2018-08-19 05:19:48 +01:00
morganamilo
0454e8918b
Add --aururl 2018-08-19 05:10:24 +01:00
Anna
23ff1e79df
Merge pull request #642 from Morganamilo/needed
skip build when package is up to date and --needed
2018-08-18 21:02:40 +01:00
Anna
024fefe702
Merge pull request #644 from Morganamilo/vendorupdate
Update vendored dependencies
2018-08-18 21:00:39 +01:00
morganamilo
c0f73c4f31
Update vendored dependencies 2018-08-18 20:57:39 +01:00
Anna
ebc4ef1c33
Merge pull request #643 from Morganamilo/cleanmenu
Only print the clean number menu when needed
2018-08-18 20:53:00 +01:00
morganamilo
0f324b37a6
Only print the clean number menu when needed
The input is only asked when needed, but the numbered package list was
still printed either way. This fixes it so the list is not shown unless
needed.
2018-08-18 20:50:20 +01:00
morganamilo
aca65e743a
parsePackageList: include pkgrel in version 2018-08-18 17:54:20 +01:00
morganamilo
907bf3a30e
skip build when package is up to date and --needed
Before --needed was left purerly to pacman. The problem with this is
that if a package is not in the cache, it will end up being build just
for pacman to skip over the install.

Now Yay will handle this and skip the build and install if --needed is
used. The inital clone and pkgver bumb is still donw.
2018-08-18 17:54:17 +01:00
Anna
19bf8e773c
Merge pull request #641 from Morganamilo/parallel-G
Use goroutines for fetching packages via -G
2018-08-18 17:18:01 +01:00
morganamilo
03fee7b7d5
Expand -G documentation 2018-08-18 17:14:07 +01:00
morganamilo
e547173d42
Use goroutines for fetching abs packages 2018-08-18 17:14:07 +01:00
morganamilo
8711562923
capture: strip whitespace on outputs 2018-08-18 17:14:03 +01:00
morganamilo
a8e4f18e6b
MultiError: add new lines between errors 2018-08-18 17:12:42 +01:00
morganamilo
a1edd09a52
Fixup getPkgbuildsFromABS
Make it output more similary to downloadPkgbuilds. Refactor to remove
all the indention.
2018-08-18 17:12:42 +01:00
morganamilo
cba56c3f9e
Use downloadPkgbuilds for -G 2018-08-18 17:12:42 +01:00
Anna
a37bbd851e
Merge pull request #637 from Morganamilo/refactorinstall2
Refactor install
2018-08-18 17:08:34 +01:00
morganamilo
b1ee03a7d8
getBases now wants a slice instead of a map
The one place this function is used, the caller converts its data to
a map just to getBases will accept it. Instead just allow it to take the
slice to begin with.
2018-08-18 17:05:12 +01:00
morganamilo
40776fa184
implement formatPkgbase as Base.String
Now that Base is its own type, it is much neater to have this as its
stringer function.
2018-08-18 17:05:12 +01:00
morganamilo
afee400662
Use formatPkgbase with getIncompatible
There was a possibly that getIncompatible could be broken when working
with split packages. After looking into it, this does not seem to be the
case, as long as we only work with pkgbases.

arch may be overriden inside of a package function. The global arch
array may be 'any' but package_foo could say arch=('x86_64'). If you
were running arm then should yay warn about this?

I have decided the answer is no. This is because makepkg doesn't care.
It would seem makepkg only checks the global arch array. This leads me
to believe that the global array should contain a the required arch.

Therefore the correct way to do the former example would be to declare
the global arch as 'x86_64' and then override package_bar with 'any'.

So all that we should do is properly use formatPkgbase to list all the
packages under the base.
2018-08-18 17:05:12 +01:00
morganamilo
cd21298355
Return srcinfos instead of using it as a parameter
Also, we do not do a pre and post pkgverbump pass anymore, so theres no
need to name it stale.
2018-08-18 17:05:12 +01:00
morganamilo
29fdf23f50
Remove unneeded code, consistent function names 2018-08-18 17:05:12 +01:00
morganamilo
43feb12c85
Merge handles.Aur and depOrder.Bases
depOrder.Aur contains the order in which AUR packages are to be
installed. While depOrder.bases contains the actual package data
organized by pkgbase.

deoOrder.AUR is kind of counterintuitive, as it only contains one
package from each package base.

For example if you were to install libc++{,abi,experimental},
depOrder.Aur would only contain one of those packages, which one
actually being quite random. depOrder.Bases[pkg.Pkgbase] will then be
looked up and everything under that slice would be installed.

This means that the only real use depOrder.Aur has, is to give the
pkgbase. So to cut out the middleman, lets merge .Aur and .Bases into
a single field.

Doing this has also heped to spot som subtle bugs:

Fix subtle split package errors.

The number menus now correctly list and respect (installed) for bases
that have atleast one of their packages installed.

Entering package names in number menus now always expects the pkgbase
name instead of the random package which happened to make it into .Aur.

--rebuild and --redownload correctly handles split packages.

formatPkgbase is also used more.
2018-08-18 17:05:12 +01:00
morganamilo
3dc350d3ac
Simplify formatPkgBase
Only pass the packages belonging to the desired pkgbase. Before our
entire list of every pkgbase had to be passed, as well as an example
package from the base we are looking for.

This lets use use formatPkgBase easier in other places outside of
install.

Many of the functions in install could also be simplified in a similar
way, although that has not been done in this commit.
2018-08-15 20:11:19 +01:00
Anna
0e40d9a3f6
Merge pull request #614 from Morganamilo/refactormain
Refactor main
2018-08-15 20:11:00 +01:00
morganamilo
339a014614
Go back to using os.Getenv
Most programs seem to take an empty string as being the same as unset.
Even if they are technically different. This makes it easier to unset
variables via `VARIABLE= yay --foo`.
2018-08-12 05:09:56 +01:00
morganamilo
febccaef3a
Reorder main
Split functions out into smaller, more simple chunks. Ensure the correct
order of things.

Before, initConfig() would also create config.BuildDirbefore
the command line flags have been applied, so yay would
try to mkdir what was in the config, ignoring the flag.
2018-08-12 05:09:53 +01:00
morganamilo
2fac9c036f
Refactor main.go to use one liner if err checks 2018-08-12 03:53:42 +01:00
morganamilo
1739a88be2
Refactor main function
Move cleanup and error checking to their own functions.
2018-08-12 03:53:42 +01:00
Anna
3f49316211
Merge pull request #633 from architekton/makefile-1
Remove redundant variable from makefile
2018-08-12 01:02:44 +01:00
Architekton
00f2cffc45
Remove redundant variable 2018-08-12 09:13:40 +10:00
Anna
25242398ac
Merge pull request #613 from Morganamilo/parallel
Parallelize pkgbuild download and use MultiError
2018-08-09 22:54:11 +01:00
morganamilo
8cb800c6d1
Dont change std{out,err,in} in passToGit
This should be done in show instead
2018-08-09 19:44:56 +01:00
morganamilo
86ef1ec077
Include info in the lock 2018-08-09 17:01:29 +01:00
morganamilo
602f386b03
Loop over srcinfos instead of pkglist in gendb 2018-08-09 16:25:14 +01:00
morganamilo
2de67d1b24
Show message for timed out vcs checks 2018-08-09 16:25:14 +01:00
morganamilo
284c87afb6
Parallelize gendb 2018-08-09 16:25:14 +01:00
morganamilo
297bf31cdf
Set GIT_TERMINAL_PROMPT=0 for clone and fetch 2018-08-09 16:25:14 +01:00
morganamilo
161bc1a17a
Only check pkgbuild source protocols for vcs fetch
The current check involves checking the entire source url for the word
git. This can lead to yay asumming sources are git repos when they are
not.

For example: https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v2.0.0/LICENSE/

Makepkg seems to also only respect the protocols. For example:
	https://github.com/jguer/yay
will be fetched as a web page. git:// or git+https:// would be needed.
Although this does not seem to work the way yay assumes. You can not simply
+ togther a bunch of protocols. For exaplle: git+http+https:// will not
work, even though individually they do. git must also come first:
https+git:// will not work either.

Yay's method of spliting on each + is fine though, it works and I'm not
going to worry about broken packages that do https+git:// or similar.
2018-08-09 16:25:14 +01:00
morganamilo
b3e647aee4
Use MultiError in other goroutines 2018-08-09 16:25:14 +01:00
morganamilo
ff5ed12181
Parallelize pkgbuild download 2018-08-09 16:25:14 +01:00
morganamilo
8c2adaddb3
Hide git output 2018-08-09 16:25:14 +01:00
morganamilo
58240bdc3d
Steal multierror from aurlib 2018-08-09 16:25:05 +01:00
Anna
6b25e60f8b
Merge pull request #628 from Morganamilo/long=
Support = on long opts, not short opts
2018-08-08 16:23:11 +01:00
morganamilo
16d4a2ca88
Support = on long opts, not short opts 2018-08-08 16:21:33 +01:00
morganamilo
6b35f9ee2f
Revert "Support -r=foo syntax"
This reverts commit 97006ade19a215e61f4f07b7bf820a6d59d9d2ae. But keepts
the usr of k+1 and len(arg)-1
2018-08-08 16:20:38 +01:00
morganamilo
1aff6cada0
Don't complete packages for empty string 2018-08-05 23:10:54 +01:00
morganamilo
746a541f7b
Update bash completion
Update bash completion, based of the current pacman bash completion.
Organized to try and keep the yay additions seperate from the main
pacman stuff and unused functions removed.
2018-08-05 23:01:09 +01:00
Anna
a5ae757803
Merge pull request #615 from Morganamilo/fixargs
Add yay specific args, drop conflicting args
2018-08-05 21:52:16 +01:00
Anna
e4df6a7dac
Merge pull request #624 from Morganamilo/suaexample
Give an example of how to update only AUR packages
2018-08-05 15:37:29 +01:00
morganamilo
8f3f4b7b98
Give an example of how to update only AUR packages
I've seen `yay -Syua` given as an example all over the place. I'm not
sure if this is left over as a habbit from yaourt. In yay, -a restricts
the upgrade to AUR packages ONLY while I believe in yaourt it means to
also include the AUR.

The problem with `yay -Syua` is that you are doing a database refresh
and then only upgrading the AUR packages. Essencially:

pacman -Sy && update-aur

This is a recipy for partial upgrades.

Either upgrade everything `yay -Syu` or just the AUR `yay -Sua`.
2018-08-05 15:28:06 +01:00
morganamilo
5ef38c12bd
Update usage and man page 2018-08-05 15:24:39 +01:00
morganamilo
2d6fe95903
Add yay specific args, drop conflicting args
Replace -P/--print with -P/--show
Replace --config with --currentconfig
2018-08-05 15:22:04 +01:00
Anna
f62bd9245b
Merge pull request #622 from ZenixTheHusky/Fix-621
Fix panic on invalid version strings
2018-08-05 15:15:42 +01:00
Peter Dyer
8d7ff22fed Fix panic on invalid version strings 2018-08-05 00:25:27 +01:00
Anna
6515a9bf04
Merge pull request #620 from Morganamilo/fixtimeupdate
Fix padding on time update
2018-08-04 14:25:10 +01:00
morganamilo
de59b3911d
Fix padding on time update 2018-08-04 14:24:42 +01:00
Anna
55ca78e74d
Merge pull request #618 from Morganamilo/fix#546
Ensure AUR upgrades actually use the AUR
2018-08-03 23:27:03 +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
Anna
6c5c6ab8f6
Merge pull request #612 from Morganamilo/accept---
Accept - and -- options
2018-08-02 16:52:58 +01:00
morganamilo
db9ff186d6
Accept - and -- options 2018-08-02 16:51:33 +01:00
Anna
a658851bbb
Merge pull request #611 from Morganamilo/fix#609
Don't show .SRCINFO in diffs
2018-08-02 15:22:46 +01:00
morganamilo
4a254303c5
Don't show .SRCINFO in diffs 2018-08-02 15:21:01 +01:00
Anna
1839b473c2
Merge pull request #610 from Morganamilo/checkargs
Error on unkown args
2018-08-02 15:11:32 +01:00
morganamilo
97006ade19
Support -r=foo syntax 2018-08-02 14:50:56 +01:00
morganamilo
4e67c1e886
Simlify huge case statments
Instead of having true in every case, rely on the lack of fallthrough
causing the default not to trigger.

Moved handleConfig to parser.go
2018-08-02 14:50:56 +01:00
morganamilo
d9823e4230
Error on unkown args
This is simply implemented by looking up against all the args. No
conflicts are checked such as using -Ss and -Si at the same time or using
-u with -D.
2018-08-02 14:50:51 +01:00
Anna
0746d2828b
Merge pull request #601 from xyproto/minor
Only minor changes
2018-08-02 14:10:50 +01:00
Anna
b848514b4b
Merge pull request #585 from Morganamilo/usage
Support Usage in pacman.conf
2018-08-02 13:51:13 +01:00
morganamilo
06a45bad59
Don't return length with queryRepo 2018-07-31 22:01:14 +01:00
morganamilo
dfe7738d6e
Use pacman like text for ignorepkg and newerpkg
Now that we are using alpm to fetch packages it generates these mesages
and we can not control the format. So change out format to match.
2018-07-31 22:01:14 +01:00
morganamilo
42a74c41c5
Show alpm warnings 2018-07-31 22:00:41 +01:00
Anna
714556fd4a
Merge pull request #605 from Morganamilo/fix#604
Ensure devel packages exist when updating
2018-07-31 17:16:01 +01:00
morganamilo
95bcea8f40
Ensure devel packages exist when updating 2018-07-31 16:58:49 +01:00
Alexander F. Rødseth
e9d0b8bee6 Refactor a named return
Ref: 29f3e011ec (diff-0cf3d18277fde705f1a4eb69fddfefc1L407)
2018-07-31 13:11:26 +02:00
Alexander F. Rødseth
345fd552f0 Use main.go from the master branch 2018-07-31 13:08:54 +02:00
Alexander F. Rødseth
29f3e011ec Only minor changes 2018-07-31 11:15:17 +02:00
Anna
892d9cc752
Merge pull request #600 from Morganamilo/completion2
Update completion
2018-07-30 14:30:44 +01:00
Anna
5f107ad7ad
Merge pull request #599 from Morganamilo/unused
Remove unneeded variables
2018-07-30 14:29:54 +01:00
morganamilo
05587c3a1c
Update zsh completion 2018-07-30 14:28:14 +01:00
morganamilo
f9d8d61524
Upbade bash completions 2018-07-30 14:21:49 +01:00
morganamilo
2a60dd7052
Remove unneeded variables 2018-07-30 14:14:16 +01:00
Anna
158e44cb1e
Merge pull request #598 from Morganamilo/newline
Split stdin on new line
2018-07-30 05:03:24 +01:00
Anna
2f755abfed
Merge pull request #594 from Morganamilo/man
Update man page and usage
2018-07-30 05:02:16 +01:00
morganamilo
0503753185
Remove --[no]showdiffs and merge the text 2018-07-30 05:01:03 +01:00
morganamilo
6fe17ad0c1
Update usage 2018-07-30 05:01:03 +01:00
morganamilo
4841642c21
Rework manpage
Give the manpage a cleaner and easier to read and maintain structure.
This refacotrs the raw groff, the formatted output should apear very
similar.
2018-07-30 05:01:03 +01:00
morganamilo
8e1e935d7e
Update man page 2018-07-30 05:01:03 +01:00
morganamilo
b4c102a17a
Split stdin on new line
Pacman 5.1 changed the stdin seperation from whitespace to newline. To
maintain corectness we should also do this.
2018-07-30 01:16:36 +01:00
Anna
bd3e1cd3a9
Merge pull request #596 from Morganamilo/config
Always pass PacmanConf to pacman
2018-07-28 19:57:28 +01:00
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
6892ea153f
Merge pull request #595 from Morganamilo/noprogress
Use no-progress when cloning packages
2018-07-28 16:15:34 +01:00
morganamilo
a61eb0d568
Use no-progress when cloning packages
The output is annoying and takes up many lines. All AUR packages clone
extremley fast anyway, making the progress unneeded.
2018-07-28 16:15:01 +01:00
Anna
d9aa50b1f5
Merge pull request #592 from Morganamilo/version
Show alpm version with -V
2018-07-28 03:48:08 +01:00
morganamilo
a54b949670
Show alpm version with -V 2018-07-28 03:45:04 +01:00
J Guerreiro
ccbb5e5923
Merge pull request #591 from Jguer/fish
Add completions to fish for series 900
2018-07-27 12:17:22 +01:00
Jguer
a592d1aa87
Add completions to fish for series 900
Signed-off-by: Jguer <me@jguer.space>
2018-07-27 12:16:21 +01:00
morganamilo
f4aa7f7933
Use alpm_sync_sysupgrade for uprepo
This allows us to support the Upgrade Usage option as well as relying on
alpm's logic instead of coming up with out own.

It is possible that this could lead to showing replaces in the upgrade
menu.
2018-07-26 14:00:08 +01:00
morganamilo
3180c66f39
Use alpm's built in searching for -Ss
This allows us to support the usage option in pacman.conf
This also speeds up the searching
2018-07-26 14:00:08 +01:00
morganamilo
2f975c7157
Update vendored dependencies 2018-07-26 14:00:08 +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
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
J Guerreiro
0b9e10e697
Demote FAQ question headers
Prevent FAQs from screaming at you
2018-07-26 12:05:50 +01:00
Anna
23417df29f
Merge pull request #588 from muesli/readme-typos
Fixed typos and improved punctuation consistency in README
2018-07-25 15:19:50 +01:00
Christian Muehlhaeuser
e6c2f6f3e3
Fixed typos and improved punctuation consistency in README 2018-07-25 13:58:18 +02:00
Anna
9670b46d7d
Merge pull request #587 from Morganamilo/print
Wrap -Sp
2018-07-25 11:21: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
Anna
f567abe386
Merge pull request #582 from Morganamilo/aururl
Add extra fields to -Si[i]
2018-07-24 13:06:12 +01:00
morganamilo
7c74dc5dec
Use none for empty fields 2018-07-24 13:04:32 +01:00
morganamilo
523c471a45
Add extra fields to -Si[i] 2018-07-24 13:04:32 +01:00
morganamilo
b3a53d613d
Update vendored dependencies 2018-07-24 13:04:07 +01:00
Anna
c8379db0aa
Merge pull request #583 from Morganamilo/Sca
Support --aur/--repo with -Sc
2018-07-24 02:51:27 +01:00
morganamilo
562a21fb4d
Support --aur/--repo with -Sc 2018-07-24 02:49:45 +01:00
Anna
4063cf9282
Merge pull request #580 from Morganamilo/fix-print
Don't print nothing to do every time
2018-07-24 00:17:08 +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
Anna
c0c018f005
Merge pull request #578 from Morganamilo/refactor-continue
Refactor continueTask()
2018-07-23 13:51:29 +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
Anna
a3564ec3a7
Merge pull request #577 from AladW/patch-1
yay.8: typo in --nopgpfetch flag
2018-07-22 00:09:06 +01:00
Alad Wenter
a5a9afd681 yay.8: fix typo in --nopgpfetch 2018-07-22 01:04:22 +02:00
Anna
17c310156c
Merge pull request #576 from Morganamilo/cleanup
Remove unused code, fix typo for -g flag
2018-07-21 18:15:11 +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
Anna
1d463d1e3f
Merge pull request #575 from Morganamilo/fix#574
Add --{no,ask}removemake
2018-07-21 14:26:52 +01:00
morganamilo
ec48698f35
Add --{no,ask}removemake 2018-07-21 14:20:00 +01:00
Anna
0e5cd51910
Merge pull request #571 from Morganamilo/abort-conflict
Abort ealy when there's conflicts with --noconfirm
2018-07-20 20:53:25 +01:00
morganamilo
1d17940ce9
Abort ealy when there's conflicts with --noconfirm
When using --nouseask, manual intervention is needed to resolve conflicts.
When also useing --noconfirm the install will always fail. So abort
early, before trying to install any AUR packages.
2018-07-20 20:42:47 +01:00
Anna
1bc8d5ef34
Merge pull request #570 from Morganamilo/fix-devel
Fix devel updates
2018-07-20 19:02:48 +01:00
morganamilo
b5b6928803
Fix devel updates
Commit 474cc56f8d77acc70ab7df264d15beea0a05cc91 refactored the
getCommit() function to use the standard passToGit() and capture()
functions.

Unlike every other external call, here we use .Wait() and kill the
command after 5 seconds. This was missed and ended up breaking the
function.

So instead don't use capture but the manual .Wait() call. passToGit() is
still used.
2018-07-20 18:59:12 +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
Anna
dd891aba8c
Merge pull request #568 from Morganamilo/diffs-as-diffs
Show tar diffs as diffs instead of editing
2018-07-19 22:31:05 +01: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
Anna
298afac0e0
Merge pull request #567 from Morganamilo/refactor-install
Refactor install
2018-07-19 21:32:29 +01:00
morganamilo
1d443c0d40
Merge GIT_TERMINAL_PROMPT with the current env 2018-07-19 20:52:30 +01:00
morganamilo
0196a47ad2
Refactor combinedupgrade code 2018-07-19 20:43:03 +01:00
morganamilo
257653047b
Move sudoloop code to exec.go 2018-07-19 18:58:04 +01:00
morganamilo
474cc56f8d
Use passToGit() in getCommit() 2018-07-19 18:51:57 +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
Anna
6e41ef882b
Merge pull request #566 from Morganamilo/fix#564
Fixup FAQ and manpage typo
2018-07-19 17:52:53 +01:00
morganamilo
526cec70ed
Fix typo in man page 2018-07-19 17:50:30 +01:00
morganamilo
6313c14382
Add editing pkgbuild dependencies to the FAQ 2018-07-19 17:50:16 +01:00
morganamilo
a576dbc1fd
Mention --save in --combinedupgrade FAQ 2018-07-19 17:31:22 +01:00
Anna
c10716ab1a
Merge pull request #559 from Morganamilo/install
Show .install files with pkgbuilds when editing
2018-07-19 17:23:03 +01:00
morganamilo
d4d36397fe
Show .install files with pkgbuilds when editing 2018-07-18 09:24:57 +01:00
Anna
ac19616bc3
Merge pull request #558 from Morganamilo/typo
Fix typo
2018-07-17 22:57:05 +01:00
morganamilo
9602d4bc79
Fix typo 2018-07-17 22:36:01 +01:00
Anna
a1b5684a2f
Merge pull request #550 from Morganamilo/go-srcinfo2
Update readme, depreciate -Pu and -Pn
2018-07-17 22:10:31 +01:00
morganamilo
46d09f8ab7
Fixup FAQ Section 2018-07-17 22:07:20 +01:00
morganamilo
686e1baaf4
Update readme, depreciate -Pu and -Pn 2018-07-17 22:01:52 +01:00
Ema Panz
6b30e17b67
Update README.md 2018-07-17 18:08:55 +01:00
Anna
fdcc233cbe
Merge pull request #552 from Morganamilo/fix#551
Fix group installs for --nocombinedupgrade
2018-07-16 17:04:46 +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
J Guerreiro
b1fb1b9656
Add flagged out of date FAQ closes #545 2018-07-16 12:06:29 +01:00
Jguer
f8e84658c0
Major version update 2018-07-16 11:35:25 +01:00
Anna
fafaa26d7b
Merge pull request #544 from Morganamilo/nothing
Show nothing to do message for nocombinedupgrade
2018-07-12 11:14:15 +01:00
morganamilo
2437937372
Show nothing to do message for nocombinedupgrade 2018-07-12 11:12:12 +01:00
Anna
595d362ee6
Merge pull request #537 from Morganamilo/fixagain
Fix -Y and remove debug messages
2018-07-06 15:26:09 +01:00
morganamilo
dcaf1e5595
Fix -Y and remove debug messages 2018-07-06 15:24:03 +01:00
J Guerreiro
a06c21d875
Merge pull request #535 from Morganamilo/fix#534
Properley seprate aur and repo targets.
2018-07-06 00:39:09 +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
Anna
18bbc983c9
Merge pull request #532 from Morganamilo/support-singed
Support source URLs that contain ? again
2018-07-05 01:59:06 +01:00
morganamilo
d627df7288
Support source URLs that contain ? again
Turns out the query part of a source url can be dirrectly after the URL
or after the # fragment. So the branch needs to be stripped too.
2018-07-05 01:58:34 +01:00
Anna
1e0ad92dd1
Merge pull request #531 from Morganamilo/support-singed
Support source URLs that contain ?
2018-07-04 15:34:39 +01:00
morganamilo
b46b111c07
Support source URLs that contain ?
Since pacman 5.1 makepkg supports  ? to signal some stuffg in
a similar way to #. Cut this out so URLs with ? no longer fail.
2018-07-04 15:29:54 +01:00
Anna
b46b005ed7
Merge pull request #530 from Morganamilo/removeyu
Also remove -u when not doing combined upgrade
2018-07-04 14:56:51 +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
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
J Guerreiro
61c7e19a0c
Merge pull request #526 from MorphBonehunter/master
run pacman -Qk(k) as root
2018-07-02 16:20:25 +01:00
Daniel Wendler (@cassandra)
fef91ab371 run pacman -Qk(k) as root
fixes #525
2018-07-02 14:15:57 +02:00
Anna
3406575f9d
Merge pull request #521 from Morganamilo/nativecompletion
Add bash and zsh completion for new flags
2018-07-01 17:28:44 +01:00
morganamilo
4f1a46eed8
Add bash and zsh completion for new flags 2018-07-01 17:21:54 +01:00
J Guerreiro
9f9a10e8f4
Merge pull request #520 from Jguer/fix-Docs
Fix invalid uppercasing in flags
2018-07-01 14:54:27 +01:00
Jguer
89b5a1b798
Fix invalid uppercasing in flags
Signed-off-by: Jguer <me@jguer.space>
2018-07-01 14:53:48 +01:00
J Guerreiro
664e9c7808
Merge pull request #519 from Jguer/fish
Add fish native pacman completions
2018-07-01 14:45:29 +01:00
Anna
38f9df54fd
Merge pull request #518 from Morganamilo/docnativepacman
Document --[no]useask and --[no]combinedupgrade
2018-07-01 14:40:17 +01:00
morganamilo
a91dc9e557
Document --[no]useask and --[no]combinedupgrade 2018-07-01 14:35:01 +01:00
Jguer
52f5c8878f
Add native pacman completions
Signed-off-by: Jguer <me@jguer.space>
2018-07-01 11:59:25 +01:00
Anna
38b4e2bec7
Merge pull request #516 from Morganamilo/combine
Separate Pacman upgrade and AUR Upgrade by default
2018-07-01 00:23:45 +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
Anna
ae24228aed
Merge pull request #507 from Morganamilo/fix#506
Return when no packages are to be installed.
2018-06-23 16:21:35 +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
Anna
da466ba8bf
Merge pull request #503 from Morganamilo/fix#502
Correctly handle AUR providers during noconfirm
2018-06-19 22:25:27 +01:00
morganamilo
f5a35d4d1d
Correctly handle AUR providers during noconfirm 2018-06-19 22:20:24 +01:00
Jguer
2e8d2b4d2c
Bump MAJOR_VERSION 2018-06-19 11:33:07 +01:00
Jguer
da0d83ff10
Merge branch 'master' into travis-exp 2018-06-19 11:04:50 +01:00
Jguer
70fd80c1f1
Merge branch 'master' into travis-exp 2018-06-19 11:04:07 +01:00
J Guerreiro
0c46a22125
Merge pull request #501 from Jguer/fix-fish
Include print in noopt
2018-06-19 11:03:19 +01:00
Jguer
e5bb23d9c6
Include print in noopt 2018-06-19 11:02:11 +01:00
Jguer
6d04c2ebce
Update vendored dependencies 2018-06-19 11:00:47 +01:00
J Guerreiro
fbe04c8658
Merge pull request #499 from Jguer/update-fish
Fix some fish completions. Fixes #498. Add missing flags
2018-06-19 10:56:50 +01:00
J Guerreiro
7e74d93866
Merge pull request #500 from Jguer/fix-zsh
Add missing editorflags
2018-06-19 10:55:39 +01:00
Jguer
21a8569fb0
Add missing editorflags 2018-06-19 10:54:27 +01:00
Jguer
a8d9166113
Fix some fish completions. Fixes #498. Add missing flags 2018-06-19 10:51:10 +01:00
J Guerreiro
87daef421e
Update for yay release
Prepare README for predicted issues so when they do appear users can be shamed for not reading `READMEs`
2018-06-19 10:13:56 +01:00
Anna
1002a4f5e5
Merge pull request #488 from Morganamilo/comp
Update bash and zsh completion
2018-06-12 21:36:10 +01:00
morganamilo
07b3d76a66
Update bash and zsh completion 2018-06-12 21:33:29 +01:00
morganamilo
1952f88c34
Remove a space 2018-06-12 21:10:41 +01:00
Anna
8edaee6136
Merge pull request #489 from Morganamilo/reset
Reset before editing
2018-06-12 21:09:25 +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
Anna
2718cd3d23
Merge pull request #487 from StephenBrown2/remove-showdifs-config
Remove ShowDiffs from config struct
2018-06-11 21:14:38 +01:00
Stephen Brown II
b76fbc8694
Remove ShowDiffs from config struct
Following the improvements in #480, #485, #486, a tiny bit of cleanup for a lone, forgotten line.

Plus the typo had been bugging me since I first saw it.
2018-06-11 15:11:16 -05:00
Anna
14eaf467a1
Merge pull request #486 from Morganamilo/doc3
Add flags for diff and upgrade to match the rest and document it all
2018-06-11 20:14:50 +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
Anna
0960f9a135
Merge pull request #485 from Morganamilo/cleanmenutrue
Enable clean menu by default
2018-06-11 19:56:10 +01:00
morganamilo
065efdbcc0
Enable clean menu by default
I swear set this to true before merging 8430c41 but apparently I didnt.
2018-06-11 19:50:03 +01:00
Anna
0f89e09b6d
Merge pull request #484 from Morganamilo/repoonly
Correctly set op and ignore for repo only installs
2018-06-11 18:53:13 +01:00
morganamilo
ab38507bea
Correctly set op and ignore for repo only installs 2018-06-11 18:49:35 +01:00
Anna
09ad692864
Merge pull request #481 from Morganamilo/hidemessage
Pass to pacman when there's no AUR packages
2018-06-11 00:44:04 +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
Anna
08af51892b
Merge pull request #480 from Morganamilo/git2
Rework editing and diff showing
2018-06-11 00:19:37 +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
Anna
91d3adc8e1
Merge pull request #478 from Morganamilo/git
Show diffs before merging
2018-06-10 16:10:08 +01:00
Anna
4d6c49b64a
Merge pull request #479 from reisub0/master
Fixed trivial typo
2018-06-10 09:41:13 +01:00
Govind KP
219e50e668
Fixed trivial typo
packags -> packages
2018-06-10 13:58:21 +05:30
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
Anna
2c6cff36da
Merge pull request #475 from alanjjenkins/ajj/fix-failing-tests
Fix failing tests
2018-06-09 15:45:01 +01:00
Alan Jenkins
c3a94edd20 Fix failing tests
There were several calls to fmt.Errorf in setPaths where the returned error was not
being used. This was indicated by ```make test``` as shown here:

```
make test
gofmt -l *.go
go vet
./main.go:16: result of fmt.Errorf call not used
./main.go:21: result of fmt.Errorf call not used
./main.go:25: result of fmt.Errorf call not used
./main.go:30: result of fmt.Errorf call not used
./main.go:35: result of fmt.Errorf call not used
./main.go:39: result of fmt.Errorf call not used
make: *** [Makefile:43: test] Error 2
```

With these changes the tests now all pass with no errors.
2018-06-09 15:40:30 +01:00
Anna
218a5e6d6e
Merge pull request #468 from Morganamilo/fixver
Print true pkgver when skipping build
2018-06-05 14:49:58 +01:00
morganamilo
64ab60f4b4
Print true pkgver when skipping build 2018-06-05 14:49:18 +01:00
Anna
cf6068dbd3
Merge pull request #467 from Morganamilo/fix#466
Fix file paths
2018-06-05 14:19:04 +01:00
morganamilo
7fdb5c2007
Make sure enviroment paths are not empty 2018-06-05 14:17:07 +01:00
morganamilo
e5d7cce49c
Fix file paths 2018-06-05 14:14:49 +01:00
Anna
0f6effbdbb
Merge pull request #462 from Morganamilo/fix#460
Tweek config and cache dir initialization
2018-06-04 23:35:46 +01:00
morganamilo
3aea877ab9
Tweek config and cache dir initialization
Check if enviroment variables are set instead if they are empty strings.
Don't care if the dir exists just take the path at face value.
Error if $HOME and the respective $XDG.. variables are not set.
2018-06-04 23:31:50 +01:00
Anna
b56afaaee3
Merge pull request #461 from Morganamilo/repoaur
Support --aur/--repo for -Ss and -Y
2018-06-04 20:37:07 +01:00
morganamilo
ced35af515
Support --aur/--repo for -Ss and -Y 2018-06-04 20:36:10 +01:00
Anna
ab317e52fe
Merge pull request #459 from Morganamilo/doc2
Update docs
2018-06-04 20:14:30 +01:00
morganamilo
bad0af1a8a
Fix typos 2018-06-04 20:12:26 +01:00
morganamilo
6c22d5987c
Update man page 2018-06-04 20:01:14 +01:00
morganamilo
63509365c1
Add less not always paging to the faq 2018-06-04 19:22:16 +01:00
morganamilo
a71784684c
Add new options to usage 2018-06-04 19:16:43 +01:00
J Guerreiro
dda7a0ca08
Merge pull request #456 from Morganamilo/slice
Use slices for targets instead of stringsets
2018-06-02 22:43:41 +01:00
Anna
68ca822fc7
Merge pull request #455 from Morganamilo/fixyogurt
Don't show provider menu for targets during -Y
2018-06-02 19:15:25 +01:00
morganamilo
bf562ee9a7
Don't show provider menu for targets during -Y
Doing `yay -S yay` I expect the provider menu to show, giving me the
choice between yay, yay-bin and yay-git

If I do `yay yay` I will then get a menu of all matching packages. upon
entering 2 for the package yay I would not expect a provider menu.
I have already choosen an exact package.

This commit disables the provider menu during yogurt mode. Only for
targets, the dependencies can still open provider menus.
2018-06-02 19:13:20 +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
Anna
3eb89aac7f
Merge pull request #453 from Morganamilo/fix#451
Disable git terminal prompt
2018-06-02 13:58:48 +01:00
morganamilo
c4d319268c
Disable git terminal prompt
This allows requests that want authentication to fail instantly and
silently. Rather than delying the program and printing to the terminal.
2018-06-02 13:52:18 +01:00
Anna
5b6c4101f8
Merge pull request #447 from Morganamilo/fix#131
Implement diffs for pkgbuild viewing.
2018-06-01 19:11:52 +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
Anna
33f067fe9e
Merge pull request #449 from Morganamilo/fix#448
Support db prefix and --repo/--aur on -G
2018-06-01 05:08:06 +01:00
morganamilo
14b66043a2
Support db prefix and --repo/--aur on -G 2018-06-01 05:06:58 +01:00
morganamilo
444ccce925
Filter out invalid tatgets instead of ignoring them
Invalid targets that occur when combining aur/foo with --repo or db/foo
with --aur. Instead of ignoring them, filter them out and give a warning
as it happens.
2018-06-01 05:06:58 +01:00
morganamilo
477d3b937e
Fix mixing of db prefix with --repo/--aur flags 2018-06-01 03:26:22 +01:00
Anna
af91c2f1b8
Merge pull request #446 from Morganamilo/fix#439
Add config option for pgp key fetching
2018-05-31 16:39:48 +01:00
morganamilo
682040319e
Add config option for pgp key fetching 2018-05-31 16:36:36 +01:00
Anna
796a84bd1a
Merge pull request #445 from Morganamilo/repoflags
Support --aur and --repo flags
2018-05-31 16:30:23 +01:00
morganamilo
0ae8fc2a06
Support --aur and --repo flags
These flags limit operations to only check the repos or only check the
AUR. These flags apply to -S, -Si and -Su.

-a may also be used as a short option for --aur. --repo has no short
option as -r is taken.
2018-05-31 16:25:49 +01:00
Jguer
b5715de4fd
Update vendored aur 2018-05-31 09:23:20 +01:00
Anna
f186bd1de3
Merge pull request #444 from Morganamilo/fix#434
Support any PKGDEST and PKGEXT
2018-05-31 05:44:39 +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
J Guerreiro
c36bfc1237
Merge pull request #401 from Morganamilo/deps3
Dependency system rewrite
2018-05-30 17:16:23 +01:00
J Guerreiro
3381a2119e
Merge pull request #442 from Morganamilo/fix#441
Tweak -Si output
2018-05-30 16:12:50 +01:00
morganamilo
7ba552e91f
Tweak -Si output
Always show popularity as a decimal
Always show out of date value
2018-05-30 16:01:48 +01:00
morganamilo
13754722fd
Fix group install
Using --asdeps with a group install does not work, this seems like
a rare use case so ignoring for now.
2018-05-30 04:41:59 +01:00
morganamilo
943b2f931a
Tweak missing packages text 2018-05-30 04:06:29 +01:00
morganamilo
53227082a5
Skip provider searching for already installed pkgs
We do not offer a provider menu for already installed packages. For
example if you already have yay installed then yay -S yay will just
reinstall yay. No prompt will be given for yay-git or yay-bin.

Therefore it makes sense to disable provider searching for these
packages. Expecially because it is the slowest part of dependency
resolving and many already installed packages are going to be resolved
when using -u.
2018-05-30 03:35:12 +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
c464af6b9b
Implement config option for provider searching 2018-05-29 17:40:35 +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
6df8c58e00
Re add isDevelName() 2018-05-29 13:15:45 +01:00
morganamilo
6e990e4dc5
Don't conflict with pkgs that are in the depPool
When upgrading multiple packages that are already installed we should
not conflict with already installed packages that are in the depPool.

This is because the version in the depTree is going to replace the
currently installed version of the package and may have different
conflicts.

If there is a conflict between stuff in the depPool these should be
handled by the innerConflicts check anyway.
2018-05-29 13:15:45 +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
6423fb55b5
Fix build order being reversed 2018-05-29 13:13:33 +01:00
morganamilo
7b558ba47c
Fix check for missing dependencies
We dont check the dependencies of things already installed becuase,
well, they're already installed. But we should check the dependencies of
targets even if they are installed because they get reinstalled.
2018-05-29 13:13:33 +01:00
morganamilo
8c77ad061e
Clean up unused code 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
c019a2cc02
Remove old dependency code 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
morganamilo
b585cec123
Add Basses to depOrder
This should act exaclty like depCatagories.Basses
2018-05-29 13:13:33 +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
Jguer
d442af9dcc
Fix #435. Update vendor to include SIGLEVEL overflow fix 2018-05-29 11:36:45 +01:00
J Guerreiro
cc2322f492 Update README.md to include temporary notice of manual intervention 2018-05-29 00:41:55 +01:00
J Guerreiro
030f847243
Merge pull request #432 from Jguer/5.1
5.1 vendor update
2018-05-29 00:08:15 +01:00
Jguer
cd4f74a04d 5.1 vendor update
Signed-off-by: Jguer <me@jguer.space>
2018-05-29 00:05:37 +01:00
J Guerreiro
e5b9f0aff4
Merge pull request #431 from Jguer/fix-430
Exit code 1 when packages are missing from -Si and -G
2018-05-28 13:48:43 +01:00
Jguer
2b5c725a0c Fixes #430. Don't abort -G just error to signal not all was good
Signed-off-by: Jguer <me@jguer.space>
2018-05-28 13:45:11 +01:00
Jguer
6d70716ba2 Quick fix to yay -Si error code #430. Will return all possible values and then error
Signed-off-by: Jguer <me@jguer.space>
2018-05-28 13:43:02 +01:00
Jguer
70e5f43171 Quick fix to yay -G error code #430
Signed-off-by: Jguer <me@jguer.space>
2018-05-28 13:31:33 +01:00
Jguer
3f15788c6a
Unexport functions and structures 2018-05-20 16:17:05 +01:00
Jguer
6b7ee97479
add quiet to print options. fish complete 2018-05-20 15:28:43 +01:00
J Guerreiro
20191f5bc4
Merge pull request #423 from Morganamilo/docnews
Document news and use build date over install date
2018-05-18 08:16:07 +01:00
morganamilo
84810a61af
Document news 2018-05-17 20:20:24 +01:00
morganamilo
d6ab6ed9ac
Use native build date when printing news
Use the build date of the newest native package instead of the install
date of any package.
2018-05-17 20:11:07 +01:00
J Guerreiro
6be6ffc7d2
Merge pull request #420 from Morganamilo/news
Only show new news when calling -Pw
2018-05-16 18:57:35 +01:00
morganamilo
9f071a8e9b
Only show new news when calling -Pw
New news is defined as news that is newer than the install date of the
newest package on the users system.

All news can be shown using -Pww
2018-05-16 17:19:09 +01:00
J Guerreiro
0c49f0f7cb
Merge pull request #419 from Jguer/impgopkgchange
Implement new gopkgbuild Newer method
2018-05-15 12:48:39 +01:00
J Guerreiro
a2072aa446
Merge pull request #418 from Jguer/fix#417
Fixes #417
2018-05-15 12:40:55 +01:00
J Guerreiro
7c3ea5b2b3
Merge branch 'master' into impgopkgchange 2018-05-14 22:25:26 +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
Anna
250d6c61f7
Merge pull request #396 from AlexWayfer/print_newer_local_packages
Print warnings about newer local packages then remote versions
2018-05-14 15:36:50 +01:00
Alexander Popov
d1602083f2
Print warnings about newer local packages then remote versions
Inspired by [`pakku`](https://github.com/kitsunyan/pakku)
2018-05-14 11:31:18 +03:00
Anna
e7357f1360
Merge pull request #415 from Morganamilo/update2
Updated vendor dependencies
2018-05-13 19:00:04 +01:00
morganamilo
4b73ba37f3
Updated vendor dependencies 2018-05-13 18:58:08 +01:00
Anna
9437bf1576
Merge pull request #412 from Morganamilo/typos
Fix typos
2018-05-12 17:17:36 +01:00
morganamilo
c399996cab
Fix typos 2018-05-12 17:16:48 +01:00
Anna
d871e2c8de
Merge pull request #411 from Gravemind/fix-foreigne-typo
Fix typo --foreigne to --foreign
2018-05-12 15:32:06 +01:00
Gravemind
6c49436942 Fix typo --foreigne to --foreign 2018-05-12 15:41:32 +02:00
Anna
4143aaf6fd
Merge pull request #410 from Morganamilo/ignore2
Fix --ignore flag while skipping updates ammended
2018-05-12 00:25:54 +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
Anna
58d53b1f8b
Merge pull request #409 from Morganamilo/ignore2
Fix --ignore flag while skipping updates
2018-05-12 00:20:48 +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
J Guerreiro
686d6a3188
Merge pull request #407 from Morganamilo/fix#406
Tweak readme, add install and contrib sections
2018-05-11 22:54:58 +01:00
morganamilo
4c2986a036
Tweak readme, add install and contrib sections 2018-05-11 04:03:27 +01:00
Anna
a634c2d167
Merge pull request #405 from Morganamilo/fix#404
Add missing --ignorearch arg to makepkg call
2018-05-10 21:02:46 +01:00
morganamilo
5e712b221e
Add missing --ignorearch arg to makepkg call 2018-05-10 21:02:03 +01:00
Anna
665d49f8e0
Merge pull request #403 from Morganamilo/fixnil
Lint
2018-05-10 20:19:33 +01:00
morganamilo
38818757c8
Lint 2018-05-10 20:18:16 +01:00
Anna
aaf89c0c1c
Merge pull request #387 from Morganamilo/news2
Print the descriptions of news item
2018-05-08 21:05:10 +01:00
Anna
1fdf62f7d0
Merge pull request #393 from Morganamilo/fix#389
Implement c29a80 properly
2018-05-08 00:45:54 +01:00
morganamilo
dc0765918e
Implement c29a80 properly
It seems the pkgbase is null for installed packages that are not part of
a split package. It was priviously assumed that if a package was not
part of a split package, pkgbase == pkgname would always be true.

Instead try to use pkgbase and if it does not exist fall back to
pkgname.
2018-05-08 00:43:49 +01:00
Anna
4eca2be3c1
Merge pull request #390 from Morganamilo/stringslicemap
Refactor complex map types into their own type
2018-05-07 23:44:05 +01:00
morganamilo
ef7e8acb13
Refactor complex map types into their own type
map[string][]string  -> mapStringSlice
mao[string]stringSet -> mapStringSet
2018-05-07 23:42:41 +01:00
Anna
e6b557f054
Merge pull request #391 from Morganamilo/fix#389
Fix -Sc sometimes cleaning split packages
2018-05-07 23:31:10 +01:00
morganamilo
c29a80d7f7
Fix -Sc sometimes cleaning split packages
If a split package was installed and there was no package that matched
the name of the package base Yay would remove it even though there could
be other packages installed under that base but with a different name.

Now only clean a package if there are no installed packages under the
packagebase.
2018-05-07 23:28:22 +01:00
Anna
58f23bfe9a
Merge pull request #377 from AlexWayfer/make_upgrade_output_as_table
Make upgrade output as table
2018-05-07 23:05:34 +01:00
Alexander Popov
58283a9799
Make upgrade output as table 2018-05-08 00:41:35 +03: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
6af2b5c6e1
Respect bottomup for -Pw
This commit also refactors the news related sructs into their own types
instead of being anonymous and moves the printing to its own .Print()
function.
2018-05-07 01:06:24 +01:00
J Guerreiro
feb3b8b6c7
Merge pull request #385 from PeachIceTea/newsfeed
Get arch package news using --print --news
2018-05-06 04:30:23 +01:00
Jonas Thiem
188df1ac93 Use formatTime for news 2018-05-06 04:25:23 +02:00
Jonas Thiem
2161dace3f Collapsing rss struct 2018-05-06 04:06:58 +02: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
Anna
f9723f67b7
Merge pull request #383 from simon04/date-format
Use ISO 8601 date format (yyyy-mm-dd)
2018-05-04 13:16:21 +01:00
Simon Legner
e6dae03329 Use ISO 8601 date format (yyyy-mm-dd) 2018-05-04 12:36:14 +02:00
Anna
5307e97d66
Merge pull request #380 from Morganamilo/fix#379
Add mised filepath.Join() calls
2018-05-03 01:48:37 +01:00
morganamilo
ee75de0135
Add mised filepath.Join() calls 2018-05-03 01:47:24 +01:00
J Guerreiro
dc10c4b6dd
Fix small indent issue 2018-04-28 17:35:53 +01:00
Jguer
79bfa9fbc8 Fix wrong license on badge
Signed-off-by: Jguer <me@jguer.space>
2018-04-28 17:35:05 +01:00
Jguer
9b351b1779 Remove changelog from README. Update some pictures
We use annotated tags and github releases already
2018-04-28 14:44:23 +01:00
Jguer
ba4ef4f51c Use more filepath.Join, standardize separators 2018-04-28 12:15:18 +01:00
J Guerreiro
408f3e138f
Merge pull request #374 from Jguer/fix#373
Fixes #373
2018-04-28 11:57:10 +01:00
Jguer
58772c871b Fixes #373
Signed-off-by: Jguer <me@jguer.space>
2018-04-28 11:53:10 +01:00
Anna
37b08eabf7
Merge pull request #372 from Morganamilo/fixparsercheck
Fix warning by megacheck in parser
2018-04-27 02:49:19 +01:00
morganamilo
debe19278a
Fix warning by megacheck in parser 2018-04-27 02:43:10 +01:00
J Guerreiro
8342ca724f
Merge pull request #371 from Jguer/megacheck-lint
Use megacheck to lint project
2018-04-27 02:32:06 +01:00
Jguer
4d83ffb915 Simple test install from local yay
Signed-off-by: Jguer <me@jguer.space>
2018-04-27 02:03:58 +01:00
Jguer
d319576303 Use megacheck to lint project
Signed-off-by: Jguer <me@jguer.space>
2018-04-27 01:25:40 +01:00
Jguer
58745060cf Test arch-travis on yay
Signed-off-by: Jguer <me@jguer.space>
2018-04-27 01:01:18 +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
Anna
a5fa47ffac
Merge pull request #367 from tomswartz07/master
Fix typos
2018-04-23 18:55:55 +01:00
Tom Swartz
39cf61f2fd Clarify Package Ranges in doc 2018-04-23 13:43:17 -04:00
Tom Swartz
579cb28361 Fix typo in docs 2018-04-23 13:29:30 -04:00
Tom Swartz
1c9715dddf Fix typos 2018-04-23 13:06:56 -04:00
Anna
c54057931d
Merge pull request #366 from Morganamilo/man
Update man page and tweak usage
2018-04-23 14:49:13 +01:00
morganamilo
99c7b5bb44
Update man page and tweak usage 2018-04-23 02:24:23 +01:00
Jguer
84569ef6d9 Fix completions from using wrong path. Regression introduced in filepath join
Signed-off-by: Jguer <me@jguer.space>
2018-04-21 16:43:12 +01:00
Anna
780f656531
Merge pull request #362 from Morganamilo/fix#359
Prefix aur/ to aur updates
2018-04-17 20:16:35 +01:00
Anna
2d559b874a
Merge pull request #361 from Morganamilo/fixup2
Remove duplicate cmd.Run()
2018-04-17 20:15:03 +01:00
morganamilo
55e7ed8ef7
Remove duplicate cmd.Run()
There was a duplicate cmd.Run() that somehow went unnoticed. It was also
missing an error check, so it was in the code but had no ill effects.
In 86bfacd253aa50f1fdc67c527b435f15e19da24a the error check was added.
This caused it to fail every time sure to the cmd already being ran.

Remove the duplicate cmd.Run() altogether.
2018-04-17 20:14:16 +01:00
morganamilo
8ccb5de6ac
Prefix aur/ to aur updates 2018-04-17 19:54:44 +01:00
Anna
5fb61731a3
Merge pull request #360 from Morganamilo/fixup
Small fixups
2018-04-17 18:26: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
86bfacd253
Remove unneeded vars and fix missing err check 2018-04-17 17:57:02 +01:00
morganamilo
72eaf6f582
gofmt -s 2018-04-17 17:54:22 +01:00
Anna
6118a9f8b6
Merge pull request #358 from Morganamilo/rmtest
Remove test for formatKeysToImport()
2018-04-17 14:28:43 +01:00
morganamilo
8305631b1d
Remove test for formatKeysToImport()
The recent changes to formatting broke this test. While it would be easy
to go back and fix it, I personaly do not like tests that rely on things
such as formatting or an internet connection. This is why I have removed
the test, I believe the other test for key importing should be more that
sufficient.
2018-04-17 14:24:30 +01:00
Morgana
44ce849cb0
Merge pull request #355 from Morganamilo/fix#354
Add support for -Sc
2018-04-17 13:54:14 +01:00
morganamilo
14454875c5
Update manpage for -Sc 2018-04-17 13:53:37 +01:00
morganamilo
6ab876258b
Updated vendor dependencies 2018-04-17 13:53:37 +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
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
J Guerreiro
dccfcb6c69
Merge pull request #357 from AlexWayfer/add_tests_for_upgrade_highlighting
Add more tests for upgrade highlighting
2018-04-17 13:11:43 +01:00
Alexander Popov
6689198623
Add more tests for upgrade highlighting
They are based on `_`, which faced in the `google-musicmanager`
2018-04-17 10:25:21 +03:00
Morgana
a79562677d
Merge pull request #356 from Morganamilo/fix#353
Use filepath.Join() for adding paths together
2018-04-17 02:07:45 +01:00
morganamilo
110a905a0c
Use filepath.Join() for adding paths together 2018-04-17 01:32:31 +01:00
Jguer
bab050a354 Update const var
Signed-off-by: Jguer <me@jguer.space>
2018-04-16 14:17:14 +01:00
Jguer
cfd244f377 Add missing entries
Signed-off-by: Jguer <me@jguer.space>
2018-04-16 14:13:11 +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
6d876a738c Add --gitflags and --[no]gitclone flags 2018-04-16 13:42:15 +01:00
Morgana
55fe22c430
Merge pull request #352 from Morganamilo/fix#351
Dont bump pkgver() while downloading sources
2018-04-16 00:21:17 +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
Morgana
0229ec0861
Merge pull request #350 from Morganamilo/fix#346
Support entering package name during askCleanEdit
2018-04-12 13:17:40 +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
Jguer
0aae012eb5 Update Readme
Signed-off-by: Jguer <me@jguer.space>
2018-04-11 11:34:31 +01:00
Morgana
53a31c2437
Merge pull request #348 from Morganamilo/fix#347
Don't mark repo upgrades as deps during sysupgrade
2018-04-11 05:36:52 +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
Morgana
960109d513
Merge pull request #345 from Morganamilo/fix#343
Support flags when using the editor
2018-04-09 21:09:47 +01:00
morganamilo
60b111545a
Tweak editor input loop
New line before output
Use less bold
Highlight editor and visual variables
Use cyan for highlighting
Use arrow prefix
Use loop instead of goto
2018-04-09 21:04:57 +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
Morgana
2aaf5f8694
Merge pull request #329 from AlexWayfer/improve_versions_output
Highlight diff between old and new versions better
2018-04-09 16:15:40 +01:00
Jguer
0026701888 Update README for release
Signed-off-by: Jguer <me@jguer.space>
2018-04-09 12:33:57 +01:00
Jguer
bc9439b26e Merge branch 'Morganamilo-fix#337' 2018-04-09 12:24:34 +01:00
Jguer
0507bebee9 Merge branch 'fix#337' of https://github.com/Morganamilo/yay into Morganamilo-fix#337 2018-04-09 12:22:37 +01:00
J Guerreiro
0c7ae56301
Merge pull request #341 from Jguer/fish
add fish completions
2018-04-09 12:21:43 +01:00
Jguer
adbc47a4f9 add fish completions
Signed-off-by: Jguer <me@jguer.space>
2018-04-09 12:20:51 +01:00
J Guerreiro
6ad06696d9
Merge pull request #339 from Morganamilo/doc2
Document fcf0ee34d17e20dc7cb99e8b6547f71c5ab522e4
2018-04-09 12:08:47 +01:00
J Guerreiro
a057050e33
Merge pull request #340 from Morganamilo/completion
Update bash and zsh completion
2018-04-09 12:08:11 +01:00
morganamilo
6f223786ef
Update bash and zsh completion 2018-04-08 21:49:27 +01:00
Alexander Popov
f7a636573b
Add tests for upgrade (getVersionDiff function) 2018-04-08 22:46:33 +03:00
Alexander Popov
38b5680619
Fix make test (gofmt threw "Files need to be linted") 2018-04-08 22:46:33 +03:00
Alexander Popov
1e4c029a2e
Add common stylize function for reduce code repeation
Also check for input length, don't create empty stylized strings.
2018-04-08 22:46:28 +03:00
morganamilo
e05d86b31b
Document fcf0ee34d17e20dc7cb99e8b6547f71c5ab522e4 2018-04-08 15:49:56 +01:00
Alexander Popov
46cffa6ba6
Highlight diff between old and new versions better
Split by dots, pluses, dashes, tilds, etc., not only `Version` and `Pkgrel`.

Don't make new version different bold.

Inspired by [`pikaur`](https://github.com/actionless/pikaur).
2018-04-08 02:16:31 +03:00
morganamilo
9ba9b03396
Show pkgver during -Ss when package is out of date 2018-04-07 23:02:10 +01:00
Reeto Chatterjee
992c27e82e
Merge branch 'master' into master 2018-04-07 16:42:56 +00:00
J Guerreiro
ec71a5bb87
Merge pull request #332 from Morganamilo/doc
Update usage and man page for new flags
2018-04-07 00:12:54 +01:00
morganamilo
855c6c841c
Update usage and man page for new flags 2018-04-05 19:25:17 +01:00
Morgana
6eb3dccf06
Merge pull request #330 from Morganamilo/fixnm
Fix number menu
2018-04-05 14:17:03 +01:00
morganamilo
072e8e6189
Fix number menu 2018-04-05 14:10:30 +01:00
Morgana
922a591b64
Merge pull request #328 from Morganamilo/flags
Repect --answer* flags when --noconfirm is set
2018-04-04 22:40:04 +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
Morgana
b0445028e2
Merge pull request #327 from Morganamilo/flags
Add flags for sort order and automating menu input
2018-04-04 21:59:48 +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
Morgana
794e8dd3c7
Merge pull request #325 from Morganamilo/fix#324
Fix sysupgrade and extend help to work with other operators
2018-04-03 18:04:48 +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
Morgana
0ccfd1a19f
Merge pull request #322 from Morganamilo/fix#316
Don't abort during AUR search error
2018-04-03 06:53:24 +01:00
morganamilo
5bcb51bf00
Don't abort during AUR search error 2018-04-03 06:49:41 +01:00
Morgana
c8f6145a18
Merge pull request #318 from ZenixTheHusky/Fix#310
Skip SRCINFOs that cannot be parsed during gendb
2018-04-03 01:58:14 +01:00
Morgana
87943743ef
Merge pull request #320 from Morganamilo/fix#319
Fix versioned dep checking
2018-04-03 01:54:41 +01:00
morganamilo
6125dd979e
Fix versioned dep checking
Before versioned deps with the same name would be combined into a single
version range.

For example:
`foo>1 foo>3 foo<4 foo<5` would be merged into the range `3<foo<4`

This was assumed to be fine because of course no package is going to
have conflicting dependencies `foo>3 foo<1` but what was not thought
about it that a package or packages could provide multiple versions of
a provider. Java being example, you could have 8 and 9 provided for at
the same time.

This then causes a problem when you try to install two packages at once,
one requiring `java<8` and the other `java>9` when combined this leads
to a range that can not be satisfied.

Instead we now never merge dependencies but check them all individually.

We also make sure to pull in all already installed providers. The reason
for this is, before if a package did not apear in the dep tree we
assumed it to be satisfied because of the .FindSatisfier in the dep
resolving. So if you installed a package that needs `foo=1` and you
already had a package providing that it would not be in the dep tree and
we assume it is fine. But if you install a package that needs `foo=1`
and install a package that prvoides `foo=2` then foo will all of
a sudden be in the dep tree but only version 2 will be there. For this
reason we also load all the already installed packages in so that the
`foo=1` will be there.
2018-04-03 01:47:42 +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
Morgana
f986895aa2
Merge pull request #317 from Morganamilo/fix#316again
Strip db prefix from request targets
2018-04-02 17:50:51 +01:00
morganamilo
e5c99778df
Strip db prefix from request targets 2018-04-02 17:50:04 +01:00
Morgana
13ba261977
Merge pull request #315 from Morganamilo/fix#314
Try each search term against RPC if one fails
2018-04-02 15:31:06 +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
Morgana
bf73d29ade
Merge pull request #313 from Morganamilo/fix#312
Try alpmArch and any when looking for built pkgs.
2018-04-02 14:59:00 +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
Morgana
f979d010ca
Merge pull request #309 from Morganamilo/fix#306
Fix missing -P in example.
2018-03-31 22:50:11 +01:00
morganamilo
b268b0a9ce
Fix missing -P in example. 2018-03-31 22:49:17 +01:00
Morgana
b14073a00f
Merge pull request #308 from DL6AKU/fix_default_syu
Default action (running yay without any args) is now to -Syu.
2018-03-31 22:44:55 +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
Morgana
42b7df44e0
Merge pull request #304 from agsimmons/patch-1
Fix typo in man page
2018-03-31 08:29:01 +01:00
Andrew Simmons
81381cb943
Fix typo in man page
Changed "databse" to "database"
2018-03-31 02:33:14 -04:00
J Guerreiro
5bf291b3a3
Merge pull request #301 from Morganamilo/fix#279
Save provides seperatly from pkgnames
2018-03-30 08:24:59 +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
morganamilo
2e7bb5e7a3
Save provides separately from pkgnames
Now if `foo` wants to install `bar`

if you do `yay -S foo bar-git` Yay will detect bar is satisfied and not
try to install `bar` as well as `bar-git`.
2018-03-29 16:38:20 +01:00
Morgana
bb9f7a6205
Merge pull request #300 from Morganamilo/fix#299
Don't check versioning for devel packages
2018-03-29 14:45:51 +01:00
morganamilo
31fecc3ec2
Don't check versioning for devel packages
Devel packages can't be trusted to sho their real provides. Pretend that
that the provide applies to all versions. In the rare case where the
dependency is unsatisfied pacman will refuse to install so no harm can
be caused.
2018-03-29 14:43:22 +01:00
Morgana
ec066fdfc7
Merge pull request #290 from Morganamilo/sortupgrade
Sort upgrade menu by pacman.conf order.
2018-03-28 19:29:03 +01:00
Jguer
d7ef9a9d27 Update README for release
Signed-off-by: Jguer <me@jguer.space>
2018-03-28 19:59:02 +02:00
J Guerreiro
090af6dce4
Merge pull request #296 from Morganamilo/shell
update shell completion
2018-03-28 11:06:30 +02:00
morganamilo
590030525b
Add shell completion for --rebuild* flags 2018-03-27 17:46:04 +01:00
morganamilo
7e20d2d8a3
Remove duplicate config option 2018-03-27 17:13:21 +01:00
J Guerreiro
0767c66e78
Merge pull request #294 from qrwteyrutiyoup/fish
Update fish completion regarding GPG options
2018-03-27 12:11:55 +02:00
J Guerreiro
9c852a9c84
Merge pull request #295 from Morganamilo/fixman
Fix \n in man page.
2018-03-27 12:11:38 +02:00
morganamilo
2cb5a6b6d6
Fix \n in man page. 2018-03-26 22:51:52 +01:00
Sergio Correia
51ad78cb69
Update fish completion regarding GPG options
Added completion for --gpg and --gpgflags.
This was forgotten in #256.
2018-03-26 15:24:32 -04:00
J Guerreiro
75098040ac
Merge pull request #293 from Jguer/Fix#292
Fix #292
2018-03-26 10:19:15 +02:00
Jguer
eb07acbe6b Fix #292
Signed-off-by: Jguer <me@jguer.space>
2018-03-26 10:18:50 +02:00
morganamilo
e807cd637f
Sort upgrade menu by pacman.conf order.
When printing the upgrade menu, sort the repos in the order they are
defined in pacman.conf (or more technically, the order they are
registered in alpm). Packages in the same repo are still sorted
alphabetically.

If a repo is not in pacman.conf or the database query fails it will
fallback to alphabetical.
2018-03-26 02:43:58 +01:00
Morgana
2f845d1a1d
Merge pull request #288 from Morganamilo/Qu
Add -Qu to the extended pacman options
2018-03-25 22:36:02 +01:00
morganamilo
4a8da38c9d
Add -Qu to the extended pacman options 2018-03-25 22:33:15 +01:00
morganamilo
82871e2172
Lint 2018-03-25 22:31:20 +01:00
J Guerreiro
91eb2585e9
Merge pull request #286 from Morganamilo/noerr
Suppress pacman error printing
2018-03-25 18:05:25 +02:00
J Guerreiro
85238c2a93
Merge pull request #277 from Morganamilo/gendb
Separate gendb from install
2018-03-25 18:04:36 +02:00
Reeto Chatterjee
b103a34f3b Use exisiting util function 2018-03-24 18:31:55 +00:00
Reeto Chatterjee
51f7b14777 Remove assumption of unique provides 2018-03-24 12:40:51 +00:00
Reeto Chatterjee
21df6b1d57 Update deps properly and lint 2018-03-24 00:04:28 +00:00
Reeto Chatterjee
1b704a869d Add recursive removal of packages 2018-03-23 23:45:46 +00:00
Reeto Chatterjee
8a0bade6cd Update vendored go-alpm 2018-03-23 23:36:45 +00:00
Morgana
7fd5677678
Merge pull request #284 from qrwteyrutiyoup/offline-gpg-tests
Do not depend on the Internet for keys_test.go
2018-03-23 21:51:20 +00:00
morganamilo
7768fab978
Supress pacman error printing
add22f59577ce2314fb9655dd0f2e4db9d61e8f1 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
Sergio Correia
9c44363a7a
Do not depend on the Internet for keys_test.go
We now mock a PGP key server to provide the keys used during the
testing, making it so that we do not need the Internet anymore for
the testing of the PGP key import feature.
2018-03-23 14:17:47 -04:00
Morgana
69f44759cf
Merge pull request #285 from Morganamilo/db
Handle db/name with --redownload and similar flags
2018-03-23 17:26:18 +00: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
Jguer
6efa83d494 Update README to include past changelogs
Signed-off-by: Jguer <me@jguer.space>
2018-03-23 15:21:54 +01:00
J Guerreiro
966bb425ff
Merge pull request #280 from Morganamilo/makefile
Improve makefile
2018-03-23 15:04:47 +01:00
J Guerreiro
ef91362c8d
Merge pull request #283 from Jguer/fix-zsh
Fix zsh completions
2018-03-23 09:03:25 +01:00
Jguer
686509efe3 Fix zsh completions
Signed-off-by: Jguer <me@jguer.space>
2018-03-23 09:01:46 +01:00
Morgana
b715c1f223
Merge pull request #282 from Morganamilo/provides2
Support provides in -Si
2018-03-23 07:13:50 +00:00
morganamilo
549c75dfeb
Support provides in -Si 2018-03-23 07:11:57 +00:00
morganamilo
67bd8cc9a2
Improve makefile
Created .go/src which symlinks to vendor/. Running `make` now builds
yay using the packages in vendor. This can still be overiden by running
`make GOPATH=$HOME/go`

Even though the makefile calls git to get the version, that can be
overiden using `make MAJORVERSION=5 MINORVERSION=400`, skipping the call to git. This
allows building yay/yay-bin using the makefile

The yay binary is now always yay instead of taking the name of the
parent directory.

Added vet and fmt checks to `make test` for more checking.

Reordered some stuff, made sure the dependency order is correct. Any
command such as `make package` can be ran at any point, even after a
`make clean` instead of having to execute the correct make commands in
order.

Changed install form using `go install` to a traditional install. The
pkgbuilds can now use `make DESTDIR=$PKGDIR install`. Added uninstall to match.

One thing this commit does not do is have proper recepies which depend
on files instead of phonies. The reason for this is that it does not
play that well with go's build system. Go is smart enough to only
recompile needed files anyway.
2018-03-23 05:36:19 +00:00
morganamilo
7274e7d31a
Fix missing %s in callbacks.go 2018-03-23 04:45:59 +00:00
Morgana
3d7870903b
Merge pull request #278 from Morganamilo/fixerr
Add missing err check
2018-03-22 20:19:15 +00:00
morganamilo
f018c0c200
Add missing err check 2018-03-22 19:48:43 +00:00
morganamilo
e331c01143
Print when a vcs source has been found 2018-03-22 18:30:56 +00:00
morganamilo
1e01eafb43
Separate gendb from install 2018-03-22 18:23:20 +00:00
morganamilo
074ea4465a
Make aurInfo return a pointer 2018-03-22 18:11:00 +00:00
Morgana
f1fd4a1203
Merge pull request #276 from Morganamilo/fixagain
Fix nothing to do if upgrading only repo packages
2018-03-22 17:32:41 +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
J Guerreiro
59b74e1253
Merge pull request #273 from Morganamilo/util
Add util.go and main.go
2018-03-22 17:49:13 +01: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
0c0cd4f883
Add utils.go 2018-03-22 16:38:21 +00:00
J Guerreiro
415659d1cd
Merge pull request #272 from Jguer/directory-change
Update version for close release
2018-03-22 17:18:17 +01:00
Jguer
82124c1b46 Update version for close release
Signed-off-by: Jguer <me@jguer.space>
2018-03-22 17:02:40 +01:00
Morgana
ac02498177
Merge pull request #269 from Morganamilo/conflicts
More conflict checking
2018-03-22 15:27:39 +00:00
Morgana
b28a35ccf5
Merge pull request #271 from Morganamilo/fix#270
Don't mark targets as dependencies
2018-03-22 15:23:20 +00:00
morganamilo
a1a05bced4
Don't mark targets as dependencies 2018-03-22 15:22:05 +00:00
morganamilo
d5015b3fe8
Add breif comments for functions in conflicts.go 2018-03-22 14:38:37 +00:00
Morgana
dbe0ace129
Merge pull request #265 from Morganamilo/refactor
Refactor and improve the upgrade menu
2018-03-22 14:05:47 +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
bb211fdbf7
Don't show package in aur/ if it is also in devel/ 2018-03-22 07:13:18 +00:00
morganamilo
624851b80b
More sorting for upgrade menu
Sort accending instead of decending
Sort by package name as well as repo name
Sort AUR packages as well as repo packages
2018-03-22 07:13:18 +00:00
morganamilo
b5c0cb7a11
Simplify upList()
Before the goroutines in upList() were layed out like:
	upLists()
	|- - - 	upRepo()
	|- - - 	pAur()
		| - - -	upDevel()

Simplified by moving upDevel() from upAur() to upList():
	upList()
	|- - - 	upRepo()
	|- - - 	upAur()
	|- - - 	upDevel()

With the simpler layout it was easy to then remove some un need channel
useage entirely and use WaitGroups in other places.

Now if any of the three inner functions error, upList() will return
a combined error instead of just printing the error and carrying on.
2018-03-22 07:13:18 +00:00
Morgana
bb35f202b8
Merge pull request #264 from Morganamilo/fix#262
Move repo install to after numbermenus
2018-03-21 21:51:05 +00:00
Morgana
09e2171b1a
Merge pull request #267 from Morganamilo/colour
Respect --color
2018-03-21 05:42:45 +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
Morgana
8003ca7d44
Merge pull request #266 from Morganamilo/fix#263
Extend aur support for -Qu
2018-03-21 05:04:14 +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
morganamilo
885614ef45
Move repo install to after numbermenus 2018-03-21 00:45:26 +00:00
Morgana
44f2da3211
Merge pull request #251 from Morganamilo/provides
Implement the provider question  and imatate pacman
2018-03-20 15:57:44 +00:00
morganamilo
3ceda128fc
Dont use FindSatisfier() in packageSlices()
Now that install() no longer relies on packageSlices() we can drop the
use of FindSatisfier() so that only direct package names are understood,
this is how pacman -Si works.

This also fixes a small issue where `yay -Si mysql` would fail. This is
because two repo packages provide `mysql`. This causes Yay to not bother
checking the AUR even though there is a package in the AUR called `mysql`
2018-03-20 15:56:13 +00:00
morganamilo
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
Jguer
66eac83c23 Update vendor dependencies
Signed-off-by: Jguer <me@jguer.space>
2018-03-20 08:55:08 +01:00
Morgana
81bb5a1990
Merge pull request #260 from Morganamilo/fix#191
Handle pkgbuilds with an unsupported arch
2018-03-19 20:04:22 +00:00
morganamilo
42fdd01d42
Update keys_tests.go 2018-03-19 20:00: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
Morgana
1a15511dc1
Merge pull request #259 from qrwteyrutiyoup/cleanup
Cleanup
2018-03-19 17:40:53 +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
Morgana
65d5f89dc5
Merge pull request #258 from Morganamilo/arch
Be more exact when looking for cached packages
2018-03-19 11:13:52 +00: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
Morgana
aedbe04b04
Merge pull request #256 from qrwteyrutiyoup/keys
Updates on PGP keys
2018-03-18 22:08:53 +00:00
Sergio Correia
affff21be8
Update completion files to include gpg and gpgflags 2018-03-17 19:15:52 -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
Sergio Correia
03d3753a39
Fix key-related tests after #254
Merge #254 fixed the updating of vsc packages, but did not update
key-related tests. This commit updates such tests so that they keep
working.
2018-03-17 16:47:45 -04:00
Morgana
73d2a0504d
Merge pull request #255 from Morganamilo/fixa
Fix and improve version checking
2018-03-17 02:20:30 +00: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
Morgana
f18d66e8ee
Merge pull request #254 from Morganamilo/pgp2
Fix updating of vsc packages
2018-03-17 00:23:44 +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
Morgana
7944c73b6c
Merge pull request #252 from Morganamilo/update
Update vendored repositories
2018-03-16 20:57:18 +00:00
morganamilo
12b79ae4aa
Update vendored repositories 2018-03-16 20:54:28 +00:00
Morgana
989096a46c
Merge pull request #250 from Morganamilo/fg
Support db/name for groups
2018-03-16 01:15:32 +00:00
morganamilo
fae0c506cc
Support db/name for groups 2018-03-16 01:14:34 +00:00
Morgana
b4ba01c928
Merge pull request #249 from Morganamilo/fix#245
Use a question callback for ignorepkg
2018-03-16 01:04:41 +00:00
Jguer
2b40ff47f7 Update vendored repositories
Signed-off-by: Jguer <me@jguer.space>
2018-03-16 00:39:49 +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
morganamilo
47bb527a1b
Change getNameFromDep to allow getting the dep too 2018-03-15 14:23:12 +00:00
J Guerreiro
e0b8c92433
Merge pull request #243 from Morganamilo/rebuild2
Add --rebuild flag
2018-03-15 09:40:37 +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
4c601c362b
Merge pull request #244 from Morganamilo/fix#241
Error when installing AUR packages as root
2018-03-14 13:08:33 +00:00
morganamilo
de29fc1b0f
Error when installing AUR packages as root 2018-03-14 13:08:04 +00:00
Morgana
345cc5475b
Merge pull request #242 from Morganamilo/dbname
Improve db/name system and add support for -Si
2018-03-13 23:59:51 +00:00
morganamilo
62e244db0f
Improve db/name system and add support for -Si 2018-03-13 21:38:10 +00:00
Morgana
b7eae565fd
Merge pull request #225 from Morganamilo/develspeedup
Use goroutinuies for devel updates
2018-03-13 17:19:24 +00:00
morganamilo
1d2b07fa84
Use channels over WaitGroup in needsUpdate()
Using a WaitGroup forced the code to wait for every goroutine to finish.
Using channels allows us to exit early if any of a packages sources need
an update. No point in waiting for the other requests to finish if we
know there is an update.
2018-03-13 17:18:46 +00:00
morganamilo
57a8048cb8
Use goroutinuies for devel updates
The update process was already partly parallel: repo, aur and devel
updates where each given their own goroutine.

This gives two further layers of parallelization. Firstly the
`needsUpdate()` function is now run in parallel for each package checked.
One package may have many vcs sources so `needsUpdate()` also checks all
of its sources in parallel.

This gives an aproxamte 3x speedup for `yay -Su --devel` timing from
when the command starts to when the number menu apears.

unfortunately git://bitbucket.org/volumesoffun/polyvox.git never
resolves on my machine for some reason so it always hits the 5 second
timout period.

It then moves on to http:/bitbucket.org/volumesoffun/polyvox.git/ which
does resolve as expected. I have not looked into it but I fear this
applies to all gitbucket repos. Luckly they are few and far between.
2018-03-13 17:18:46 +00:00
Morgana
f9d4d9bafb
Merge pull request #235 from Morganamilo/fix#228
Add support for db/name
2018-03-13 17:14:22 +00:00
Morgana
e6c47bee32
Merge pull request #179 from qrwteyrutiyoup/import-keys
Ask if yay should try to import missing PGP keys
2018-03-13 17:13:41 +00:00
Jguer
7f657bebe6 Update version number in makefile
Signed-off-by: Jguer <me@jguer.space>
2018-03-13 16:55:04 +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
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
275 changed files with 50787 additions and 13230 deletions

26
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,26 @@
# Use the jguer/yay-builder image as a parent image with archlinux
FROM docker.io/jguer/yay-builder
# Install extra packages (pacman-contrib and fish)
RUN sudo pacman -Syu --noconfirm pacman-contrib fish git-delta openssh bat go
# Set passwordless sudo for the docker user
RUN echo "docker ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/docker
# Create a non-root user and switch to it
USER docker
# Install xgotext
RUN go install github.com/leonelquinteros/gotext/cli/xgotext@latest
# Add /app/bin to the PATH
ENV PATH="/app/bin:$PATH"
# add /home/docker/go/bin to the PATH
ENV PATH="/home/docker/go/bin:$PATH"
# Set the working directory
WORKDIR /workspace
# Command to run when starting the container
CMD ["bash"]

View File

@ -0,0 +1,14 @@
{
"name": "Existing Dockerfile",
"build": {
"context": "..",
"dockerfile": "../.devcontainer/Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"golang.go"
]
}
}
}

9
.dockerignore Normal file
View File

@ -0,0 +1,9 @@
*
!*.go
!pkg
!go.mod
!go.sum
!Makefile
!po
!doc
!completions

1
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1 @@
* @Jguer

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
github: [Jguer]

44
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,44 @@
---
name: Bug report
about: Report a malfunction to help us improve
title: ""
labels: "Status: Triage, Type: Bug"
assignees: ""
---
### Affected Version
<!-- Please ensure you are using the latest yay-git package
Use `yay -V` to get installed version
Example: `yay v8.1139.r0.g9ac4ab6 - libalpm v11.0.1` -->
### Describe the bug
<!-- A clear and concise description of the bug. -->
### Reproduction Steps
1.
2.
3.
### Expected behavior
<!-- A clear and concise description of what you expected to happen. -->
### Output
<!--
Include the FULL output of any relevant commands/configs
The current yay config can be printed with `yay -Pg`
Paste services are only needed for excessive output (>500 lines)
Use --debug to add pacman and yay debug logs
or add the following key to your ~/.config/yay/config.json to only get yay debug logs
{
"debug": true
}
-->
```sh
```

View File

@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: "Type: Feature Request, Status: Discussion Open"
assignees: ""
---
### Is your feature request related to a problem? Please describe.
<!-- A clear and concise description of the problem, e.g. I'm always frustrated when ... -->
### Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->
### Describe alternatives you've considered
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
### Additional context
<!-- Add any other context or screenshots about the feature request here. -->

15
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
groups:
go-all:
patterns:
- '*'

20
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,20 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 120
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 40
# Issues with these labels will never be considered stale
exemptLabels:
- "Status: In Progress"
- "Status: Confirmed"
- "Status: Approved"
- "Status: Triage"
- "Type: Bug"
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

143
.github/workflows/builder-image.yml vendored Normal file
View File

@ -0,0 +1,143 @@
name: Builder Image
on:
schedule:
- cron: "0 3 * * 1" # Every Monday at 3 AM
push:
paths:
- "ci.Dockerfile"
- ".github/workflows/builder-image.yml"
env:
REGISTRY_IMAGE: jguer/yay-builder
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm/v7
- linux/arm64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_IMAGE }}
ghcr.io/${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=latest
type=sha,format=long
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
file: ci.Dockerfile
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
echo -n "$digest" > "/tmp/digests/$(echo "${{ matrix.platform }}" | tr '/' '_')"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digest-${{ matrix.platform == 'linux/amd64' && 'amd64' || matrix.platform == 'linux/arm/v7' && 'armv7' || 'arm64' }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
pattern: digest-*
merge-multiple: true
path: /tmp/digests
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_IMAGE }}
ghcr.io/${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=latest
type=sha,format=short
- name: Create and push manifest list
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
# Extract Docker Hub tags
DH_TAGS=$(echo '${{ steps.meta.outputs.tags }}' | grep -v "^ghcr.io" | xargs -I {} echo "-t {}")
# Extract GitHub Container Registry tags
GHCR_TAGS=$(echo '${{ steps.meta.outputs.tags }}' | grep "^ghcr.io" | xargs -I {} echo "-t {}")
# Create a manifest list using the image digests from /tmp/digests/*
DIGESTS=$(for file in /tmp/digests/*; do
echo -n "${{ env.REGISTRY_IMAGE }}@$(cat $file) "
done)
# Create the manifest list for Docker Hub
docker buildx imagetools create $DH_TAGS $DIGESTS
# Create the manifest list for GitHub Container Registry
docker buildx imagetools create $GHCR_TAGS $DIGESTS
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest

93
.github/workflows/multiarch-build.yml vendored Normal file
View File

@ -0,0 +1,93 @@
name: Build Release
on:
push:
tags:
- v*
jobs:
build-releases:
strategy:
matrix:
arch: ["linux/amd64 x86_64", "linux/arm/v7 armv7h", "linux/arm64 aarch64"]
name: Build ${{ matrix.arch }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Read info
id: tags
run: |
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
arch="${{ matrix.arch }}"
echo "PLATFORM=${arch%% *}" >> $GITHUB_OUTPUT
echo "ARCH=${arch##* }" >> $GITHUB_OUTPUT
- name: Build ${{ matrix.arch }} release
run: |
mkdir artifacts
docker buildx build --platform ${{ steps.tags.outputs.platform }} \
--build-arg VERSION=${{ steps.tags.outputs.version }} \
--build-arg ARCH=${{ steps.tags.outputs.arch }} \
--build-arg PREFIX="/usr" \
-t yay:${{ steps.tags.outputs.arch }} . --load
make docker-release ARCH=${{ steps.tags.outputs.arch }} VERSION=${{ steps.tags.outputs.version }} PREFIX="/usr"
mv *.tar.gz artifacts
- uses: actions/upload-artifact@v4
with:
name: yay_${{ steps.tags.outputs.arch }}
path: artifacts
create_release:
name: Create release from this build
needs: [build-releases]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read info
id: tags
run: |
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
pattern: yay_*
merge-multiple: true
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.tags.outputs.tag }} \
--title "${{ steps.tags.outputs.tag }}" \
--generate-notes \
./yay_${{ steps.tags.outputs.version }}_*.tar.gz
- name: Release Notary Action
uses: docker://aevea/release-notary:latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

39
.github/workflows/testing-git.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: Test against pacman-git
on:
pull_request:
paths-ignore:
- "doc/**"
- "**/*.po"
- "README.md"
- ".gitignore"
jobs:
build:
name: Lint and test yay (-git)
runs-on: ubuntu-latest
container:
image: ghcr.io/jguer/yay-builder:latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/cache@v3
with:
path: /home/runner/work/yay/yay/pacman-git
key: ${{ runner.os }}-pacman-${{ hashFiles('/home/runner/work/yay/yay/pacman-git/PKGBUILD') }}
restore-keys: |
${{ runner.os }}-pacman-
- name: checkout pacman-git
run: |
git -C ./pacman-git pull || git clone https://aur.archlinux.org/pacman-git
useradd github
echo 'github ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
chmod -R 777 pacman-git
su github -c 'cd pacman-git; yes | makepkg -i --nocheck'
- name: Run Build and Tests with pacman-git
run: |
make test

44
.github/workflows/testing.yml vendored Normal file
View File

@ -0,0 +1,44 @@
name: Test against pacman
on:
pull_request:
jobs:
build:
name: Lint and test yay
runs-on: ubuntu-latest
container:
image: ghcr.io/jguer/yay-builder:latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Lint
env:
GOFLAGS: -buildvcs=false -tags=next
run: /app/bin/golangci-lint run -v ./...
- name: Run Build and Tests
run: make test
- name: Run Integration Tests
continue-on-error: true
run: |
useradd -m yay &&
chown -R yay:yay . &&
cp -r ~/go/ /home/yay/go/ &&
chown -R yay:yay /home/yay/go/ &&
su yay -c "make test-integration"
- name: Build yay Artifact
env:
GOFLAGS: -buildvcs=false -tags=next
run: make
- name: Upload yay Artifact
uses: actions/upload-artifact@v4
with:
name: yay
path: ./yay
if-no-files-found: error
overwrite: true

17
.gitignore vendored
View File

@ -6,10 +6,7 @@
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
.vscode
*.cgo1.go
*.cgo2.c
@ -23,3 +20,15 @@ _cgo_export.*
yay
yay_*/
*.tar.gz
qemu-*
.go
# Locale
*.mo
*.pot
*.po~
*.pprof
node_modules/
xgotext
.devcontainer/

94
.golangci.yml Normal file
View File

@ -0,0 +1,94 @@
version: "2"
run:
go: "1.20"
linters:
default: none
enable:
- bodyclose
- dogsled
- dupl
- errcheck
- errorlint
- gochecknoinits
- gocritic
- goprintffuncname
- gosec
- govet
- ineffassign
- lll
- misspell
- nakedret
- noctx
- nolintlint
- staticcheck
- unconvert
- unparam
- unused
- whitespace
settings:
dupl:
threshold: 100
funlen:
lines: 100
statements: 50
goconst:
min-len: 3
min-occurrences: 4
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
gocyclo:
min-complexity: 15
lll:
line-length: 140
misspell:
locale: US
nolintlint:
require-explanation: false
require-specific: false
allow-unused: false
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- dupl
- errcheck
- errorlint
- gochecknoinits
- gocritic
- godot
- govet
- lll
- revive
- staticcheck
- wsl
path: (.+)_test.go
- path: (.+)\.go$
text: G204
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- github.com/Jguer/yay/v12
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$

29
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,29 @@
default_stages: [commit]
repos:
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: go-fmt
- id: golangci-lint
- id: go-unit-tests
- id: go-build
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8 # Use the sha or tag you want to point at
hooks:
- id: prettier
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 # Use the ref you want to point at
hooks:
- id: trailing-whitespace
- id: check-json
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.15.0
hooks:
- id: commitizen
stages: [commit-msg]

7
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"go.lintTool": "golangci-lint",
"gopls": {
"formatting.gofumpt": true,
"formatting.local": "github.com/Jguer/yay/v12"
}
}

79
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,79 @@
# Contributing to yay
## Translation
[Transifex](https://www.transifex.com/yay-1/yay/)
## Quality Assurance
```sh
pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay-git.git
cd yay-git
makepkg -si
```
Installing `yay-git` and using issues to help determine what's broken is already
a very big help.
## Development
Contributors are always welcome!
If you plan to make any large changes or changes that may not be 100% agreed
on, we suggest opening an issue detailing your ideas first.
Otherwise send us a pull request and we will be happy to review it.
### Vision
Yay is based on the design of [yaourt](https://github.com/archlinuxfr/yaourt), [apacman](https://github.com/oshazard/apacman) and [pacaur](https://github.com/rmarquis/pacaur). It is developed with these objectives in mind:
- Provide an interface for pacman
- Yaourt-style interactive search/install
- Minimal dependencies
- Minimize user input
### Dependencies
Yay depends on:
- go (make only)
- git
- base-devel
- pacman
Note: Yay also depends on a few other projects, these are pulled as go modules.
### Building
Run `make` to build Yay. This command will generate a binary called `yay` in
the same directory as the Makefile.
#### Docker Release
`make docker-release` will build the release packages for `aarch64` and for `x86_64`.
For `aarch64` to run on a `x86_64` platform `qemu-user-static(-bin)` must be
installed.
```
docker run --rm --privileged multiarch/qemu-user-static:register --reset
```
will register QEMU in the build agent. ARM builds tend to crash sometimes but
repeated runs tend to succeed.
### Code Style
All code should be formatted through `go fmt`. This tool will automatically
format code for you. We recommend, however, that you write code in the proper
style and use `go fmt` only to catch mistakes.
Use [pre-commit](https://pre-commit.com/) to validate your commits against the various
linters configured for this repository.
### Testing
Run `make test` to test Yay. This command will verify that the code is
formatted correctly, run the code through `go vet`, and run unit tests.

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM ghcr.io/jguer/yay-builder:latest
LABEL maintainer="Jguer,docker@jguer.space"
ARG VERSION
ARG PREFIX
ARG ARCH
WORKDIR /app
COPY . .
RUN make release VERSION=${VERSION} PREFIX=${PREFIX} ARCH=${ARCH}

27
Gopkg.lock generated
View File

@ -1,27 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
name = "github.com/jguer/go-alpm"
packages = ["."]
revision = "946a37df2f6cbb5b3c26870a9a51d3fc02ea0fe1"
[[projects]]
branch = "master"
name = "github.com/mikkeloscar/aur"
packages = ["."]
revision = "03627b6521ed20e90583c747d106f65a33bd3720"
[[projects]]
branch = "master"
name = "github.com/mikkeloscar/gopkgbuild"
packages = ["."]
revision = "3cdebdb8609f66a83e1b8bf5bf33b6d12d29940d"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "456465ee334310996a51a2282bf4cfe9f6269db508479c962474d61a4ce0a08c"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -1,16 +0,0 @@
[prune]
non-go = true
unused-packages = true
go-tests = true
[[constraint]]
branch = "master"
name = "github.com/jguer/go-alpm"
[[constraint]]
branch = "master"
name = "github.com/mikkeloscar/aur"
[[constraint]]
branch = "master"
name = "github.com/mikkeloscar/gopkgbuild"

View File

@ -1,12 +0,0 @@
#### Affected Version
<!-- Please ensure you are using the latest yay-git package -->
<!-- Use `yay -V` to get installed version -->
<!-- Example: `yay v3.373` -->
#### Issue
#### Steps to reproduce
<!-- Exact commands are useful -->
1.
2.
3.

151
Makefile
View File

@ -1,31 +1,134 @@
.PHONY: all default install test build release clean
VERSION := $(shell git rev-list --count master)
LDFLAGS=-ldflags '-s -w -X main.version=3.${VERSION}'
GOFILES := $(shell ls *.go | grep -v /vendor/)
ARCH=$(shell uname -m)
PKGNAME=yay
export GO111MODULE=on
GOPROXY ?= https://proxy.golang.org,direct
export GOPROXY
PACKAGE=${PKGNAME}_3.${VERSION}_${ARCH}
BUILD_TAG = devel
ARCH ?= $(shell uname -m)
BIN := yay
DESTDIR :=
GO ?= go
PKGNAME := yay
PREFIX := /usr/local
MAJORVERSION := 12
MINORVERSION := 0
PATCHVERSION := 0
VERSION ?= ${MAJORVERSION}.${MINORVERSION}.${PATCHVERSION}
LOCALEDIR := po
SYSTEMLOCALEPATH := $(PREFIX)/share/locale/
# ls -1 po | sed -e 's/\.po$//' | paste -sd " "
LANGS := ca cs de en es eu fr_FR he id it_IT ja ko pl_PL pt_BR pt ru_RU ru sv tr uk zh_CN zh_TW
POTFILE := default.pot
POFILES := $(addprefix $(LOCALEDIR)/,$(addsuffix .po,$(LANGS)))
MOFILES := $(POFILES:.po=.mo)
FLAGS ?= -trimpath -mod=readonly -modcacherw
EXTRA_FLAGS ?= -buildmode=pie
LDFLAGS := -X "main.yayVersion=${VERSION}" -X "main.localePath=${SYSTEMLOCALEPATH}" -linkmode=external -compressdwarf=false
RELEASE_DIR := ${PKGNAME}_${VERSION}_${ARCH}
PACKAGE := $(RELEASE_DIR).tar.gz
SOURCES ?= $(shell find . -name "*.go" -type f)
.PRECIOUS: ${LOCALEDIR}/%.po
.PHONY: default
default: build
all: clean build release package
.PHONY: all
all: | clean release
install:
go install -v ${LDFLAGS} ${GO_FILES}
test:
go test ./...
build:
go build -v ${LDFLAGS}
release:
mkdir ${PACKAGE}
cp ./yay ${PACKAGE}/
cp ./yay.8 ${PACKAGE}/
cp ./zsh-completion ${PACKAGE}/
cp ./yay.fish ${PACKAGE}/
cp ./bash-completion ${PACKAGE}/
package:
tar -czvf ${PACKAGE}.tar.gz ${PACKAGE}
.PHONY: clean
clean:
-rm -rf ${PKGNAME}_*
$(GO) clean $(FLAGS) -i ./...
rm -rf $(BIN) $(PKGNAME)_*
.PHONY: test_lint
test_lint: test lint
.PHONY: test
test:
$(GO) test -race -covermode=atomic $(FLAGS) ./...
.PHONY: test-integration
test-integration:
$(GO) test -tags=integration $(FLAGS) ./...
.PHONY: build
build: $(BIN)
.PHONY: release
release: $(PACKAGE)
.PHONY: docker-release-all
docker-release-all:
make docker-release-armv7h ARCH=armv7h
make docker-release-x86_64 ARCH=x86_64
make docker-release-aarch64 ARCH=aarch64
docker-release:
docker create --name yay-$(ARCH) yay:${ARCH} /bin/sh
docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE)
docker container rm yay-$(ARCH)
.PHONY: docker-build
docker-build:
docker build -t yay-$(ARCH):${VERSION} .
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make build VERSION=${VERSION} PREFIX=${PREFIX}
docker cp yay-$(ARCH):/app/${BIN} $(BIN)
docker container rm yay-$(ARCH)
.PHONY: lint
lint:
GOFLAGS="$(FLAGS)" golangci-lint run ./...
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: install
install: build ${MOFILES}
install -Dm755 ${BIN} $(DESTDIR)$(PREFIX)/bin/${BIN}
install -Dm644 doc/${PKGNAME}.8 $(DESTDIR)$(PREFIX)/share/man/man8/${PKGNAME}.8
install -Dm644 completions/bash $(DESTDIR)$(PREFIX)/share/bash-completion/completions/${PKGNAME}
install -Dm644 completions/zsh $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_${PKGNAME}
install -Dm644 completions/fish $(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d/${PKGNAME}.fish
for lang in ${LANGS}; do \
install -Dm644 ${LOCALEDIR}/$${lang}.mo $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/${PKGNAME}.mo; \
done
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/${BIN}
rm -f $(DESTDIR)$(PREFIX)/share/man/man8/${PKGNAME}.8
rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/${PKGNAME}
rm -f $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_${PKGNAME}
rm -f $(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d/${PKGNAME}.fish
for lang in ${LANGS}; do \
rm -f $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/${PKGNAME}.mo; \
done
$(BIN): $(SOURCES)
$(GO) build $(FLAGS) -ldflags '$(LDFLAGS)' $(EXTRA_FLAGS) -o $@
$(RELEASE_DIR):
mkdir $(RELEASE_DIR)
$(PACKAGE): $(BIN) $(RELEASE_DIR) ${MOFILES}
strip ${BIN}
cp -t $(RELEASE_DIR) ${BIN} doc/${PKGNAME}.8 completions/* ${MOFILES}
tar -czvf $(PACKAGE) $(RELEASE_DIR)
locale:
xgotext -in . -out po
mv po/default.pot po/en.po
for lang in ${LANGS}; do \
test -f po/$$lang.po || msginit --no-translator -l po/$$lang.po -i po/${POTFILE} -o po/$$lang.po; \
msgmerge -U po/$$lang.po po/${POTFILE}; \
touch po/$$lang.po; \
done
${LOCALEDIR}/%.mo: ${LOCALEDIR}/%.po
msgfmt $< -o $@

274
README.md
View File

@ -1,187 +1,189 @@
# yay
[![yay](https://img.shields.io/aur/version/yay?color=1793d1&label=yay&logo=arch-linux&style=for-the-badge)](https://aur.archlinux.org/packages/yay/)
[![yay-bin](https://img.shields.io/aur/version/yay-bin?color=1793d1&label=yay-bin&logo=arch-linux&style=for-the-badge)](https://aur.archlinux.org/packages/yay-bin/)
[![yay-git](https://img.shields.io/aur/version/yay-git?color=1793d1&label=yay-git&logo=arch-linux&style=for-the-badge)](https://aur.archlinux.org/packages/yay-git/)
![AUR votes](https://img.shields.io/aur/votes/yay?color=333333&style=for-the-badge)
[![GitHub license](https://img.shields.io/github/license/jguer/yay?color=333333&style=for-the-badge)](https://github.com/Jguer/yay/blob/master/LICENSE)
Yet another Yogurt - An AUR Helper written in Go
# Yay
#### Packages
Yet Another Yogurt - An AUR Helper Written in Go
[![yay](https://img.shields.io/aur/version/yay.svg?label=yay)](https://aur.archlinux.org/packages/yay/) [![yay-bin](https://img.shields.io/aur/version/yay-bin.svg?label=yay-bin)](https://aur.archlinux.org/packages/yay-bin/) [![yay-git](https://img.shields.io/aur/version/yay-git.svg?label=yay-git)](https://aur.archlinux.org/packages/yay-git/) [![GitHub license](https://img.shields.io/badge/license-AGPL-blue.svg)](https://raw.githubusercontent.com/Jguer/yay/master/LICENSE)
There's a point in everyone's life when you feel the need to write an AUR helper because there are only about 20 of them.
So say hi to 20+1.
Yay was created with a few objectives in mind and based on the design of [yaourt](https://github.com/archlinuxfr/yaourt) and [apacman](https://github.com/oshazard/apacman):
* Have almost no dependencies.
* Provide an interface for pacman.
* Have yaourt like search.
* Minimize user input
* Know when git packages are due for an upgrade.
### Help translate yay: [Transifex](https://www.transifex.com/yay-1/yay/)
## Features
* AUR Tab completion
* Download PKGBUILD from ABS or AUR
* Ask all questions first and then start building
* Search narrowing (`yay linux header` will first search linux and then narrow on header)
* No sourcing of PKGBUILD is done
* The binary has no dependencies that pacman doesn't already have.
* Sources build dependencies
* Removes make dependencies at the end of build process
- Advanced dependency solving
- PKGBUILD downloading from ABS or AUR
- Completions for AUR packages
- Query user up-front for all input (prior to starting builds)
- Narrow search (`yay linux header` will first search `linux` and then narrow on `header`)
- Find matching package providers during search and allow selection
- Remove make dependencies at the end of the build process
- Build local PKGBUILDs with AUR dependencies
- Un/Vote for packages
#### Frequently Asked Questions
[![asciicast](https://asciinema.org/a/399431.svg)](https://asciinema.org/a/399431)
* Yay does not display colored output. How do I fix it?
Make sure you have the `Color` option in your `/etc/pacman.conf` [#123](https://github.com/Jguer/yay/issues/123)
#### Example of Custom Operations
[![asciicast](https://asciinema.org/a/399433.svg)](https://asciinema.org/a/399433)
* `yay <Search Term>` presents package selection menu
* `yay -Ps` prints system statistics
* `yay -Pu` prints update list
* `yay -Yc` cleans unneeded dependencies
* `yay -G` downloads PKGBUILD from ABS or AUR
* `yay -Y --gendb` generates development package DB used for devel updates.
## Installation
<img src="http://jguer.github.io/yay/yayupgrade.png" width="450">
<img src="http://jguer.github.io/yay/yay2.png" width="450">
<img src="http://jguer.github.io/yay/yay4.png" width="450">
If you are migrating from another AUR helper, you can simply install Yay with that helper.
### Changelog
> [!WARNING]
> We are using `sudo` in these examples, you can switch that out for a different privilege escalation tool.
#### 3.373
### Source
* Version bump to V3 to reflect all of the changes to syntax
* `yay -Pd` prints default config
* `yay -Pg` prints current config
* Fixes #174
* Fixes #176
* Fixes -G being unable to download split packages
* Fixes #171
* Fixes -Si failing when given a non existing package on https://github.com/Jguer/yay/pull/155
* Fixes other small bugs on 2.350 without adding new features
The initial installation of Yay can be done by cloning the PKGBUILD and
building with makepkg:
#### 2.350
We make sure we have the `base-devel` package group installed.
* Adds sudo loop (off by default, enable only by editing config file) #147
* Adds replace package support #154 #134
* Minor display improvements #150 for example
* Fixes GenDB
* Fixes Double options passing to pacman
* Noconfirm works more as expected
* Minor fixes and refactoring
* Yay filters out the repository name if it's included.
* Fixes #122
```sh
sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
```
#### 2.298
If you want to do all of this at once, we can chain the commands like so:
* Adds #115
```sh
sudo pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si
```
#### 2.296
### Binary
* New argument parsing @Morganamilo (check manpage or --help for new
information)
* yay -Qstats changed to yay -Ps or yay -P --stats
* yay -Cd changed to yay -Yc or yay -Y --clean
* yay -Pu (--upgrades) prints update list
* yay -Pn (--numberupgrades) prints number of updates
* yay -G also possible through -Yg or -Y --getpkgbuild (yay -G will be
discontinued once it's possible to add options to the getpkgbuild operation)
* yay now counts from 1 instead of 0 @Morganamilo
* Support for ranges when selecting packages @samosaara
* Pacaur style ask all questions first and download first @Morganamilo
* Updated vendor dependencies (Fixes pacman.conf parsing errors and PKGBUILD
parsing errors)
* Updated completions
If you do not want to compile yay yourself you can use the builds generated by
GitHub Actions.
#### 2.219
```sh
sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si
```
* Updated manpage
* Updated --help
* Fixed AUR update fails with large number of packages #59
* Check if package is already in upgrade list and skip it. #60
* Add -V and -h for flag parsing @AnthonyLam
* Prevent file corruption by truncating the files @maximbaz
* Print VCS error details @maximbaz
* Using '-' doesn't raise an error @PietroCarrara
* use Command.Dir in aur.PkgInstall; Fixes #32 #47 @afg984
* Suffix YayConf.BuildDir with uid to avoid permission issues @afg984 (Not included in last changelog)
If you want to do all of this at once, we can chain the commands like so:
#### 2.200
```sh
sudo pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay-bin.git && cd yay-bin && makepkg -si
```
* Development github package support readded
### Other distributions
#### 2.196
If you're using Manjaro or [another distribution that packages `yay`](https://repology.org/project/yay/versions)
you can simply install yay using pacman (as root):
* XDG_CONFIG_HOME support
* XDG_CACHE_HOME support
```sh
pacman -S --needed git base-devel yay
```
> [!WARNING]
> distributions sometimes lag updating yay on their repositories.
#### 2.165
## First Use
* Upgrade list now allows skipping upgrade install
#### Development packages upgrade
#### 2.159
- Use `yay -Y --gendb` to generate a development package database for `*-git`
packages that were installed without yay.
This command should only be run once.
* Qstats now warns about packages not available in AUR
- `yay -Syu --devel` will then check for development package updates
#### 2.152
- Use `yay -Y --devel --save` to make development package updates permanently
enabled (`yay` and `yay -Syu` will then always check dev packages)
* Fetching backend changed to Mikkel Oscar's [Aur](https://github.com/mikkeloscar/aur)
* Added support for development packages from github.
* Pacman backend rewritten and simplified
* Added config framework.
## Examples of Custom Operations
#### 1.115
| Command | Description |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `yay` | Alias to `yay -Syu`. |
| `yay <Search Term>` | Present package-installation selection menu. |
| `yay -Bi <dir>` | Install dependencies and build a local PKGBUILD. |
| `yay -G <AUR Package>` | Download PKGBUILD from ABS or AUR. (yay v12.0+) |
| `yay -Gp <AUR Package>` | Print to stdout PKGBUILD from ABS or AUR. |
| `yay -Ps` | Print system statistics. |
| `yay -Syu --devel` | Perform system upgrade, but also check for development package updates. |
| `yay -Syu --timeupdate` | Perform system upgrade and use PKGBUILD modification time (not version number) to determine update. |
| `yay -Wu <AUR Package>` | Unvote for package (Requires setting `AUR_USERNAME` and `AUR_PASSWORD` environment variables) (yay v11.3+) |
| `yay -Wv <AUR Package>` | Vote for package (Requires setting `AUR_USERNAME` and `AUR_PASSWORD` environment variables). (yay v11.3+) |
| `yay -Y --combinedupgrade --save` | Make combined upgrade the default mode. |
| `yay -Y --gendb` | Generate development package database used for devel update. |
| `yay -Yc` | Clean unneeded dependencies. |
* Added AUR completions (updates on first completion every 48h)
## Frequently Asked Questions
#### 1.101
- **Yay does not display colored output. How do I fix it?**
* Search speed and quality improved [#3](https://github.com/Jguer/yay/issues/3)
Make sure you have the `Color` option in your `/etc/pacman.conf`
(see issue [#123](https://github.com/Jguer/yay/issues/123)).
#### 1.100
- **Sometimes diffs are printed to the terminal, and other times they are paged via less. How do I fix this?**
* Added manpage
* Improved search [#3](https://github.com/Jguer/yay/issues/3)
* Added -G to get pkgbuild from the AUR or ABS. [#6](https://github.com/Jguer/yay/issues/6)
* Fixed [#8](https://github.com/Jguer/yay/issues/8)
* Completed and decluttered zsh completions
* If `$EDITOR` or `$VISUAL` is not set yay will prompt you for an editor [#7](https://github.com/Jguer/yay/issues/7)
Yay uses `git diff` to display diffs, which by default tells less not to
page if the output can fit into one terminal length. This behavior can be
overridden by exporting your own flags (`export LESS=SRX`).
#### 1.91
- **Yay is not asking me to edit PKGBUILDS, and I don't like the diff menu! What can I do?**
* `--downtop` has been replaced with `--bottomup` (as is logical)
* `yay -Ssq` and `yay -Sqs` now displays AUR packages with less information
* Repository search now uses the same criteria as pacman
`yay --editmenu --diffmenu=false --save`
#### 1.85
- **How can I tell Yay to act only on AUR packages, or only on repo packages?**
* yay now does -Si for AUR packages
* Fixed package install bugs
`yay -{OPERATION} --aur`
`yay -{OPERATION} --repo`
#### 1.83
- **A `Flagged Out Of Date AUR Packages` message is displayed. Why doesn't Yay update them?**
* Added new dependency resolver for future features
* Sort package statistics
This message does not mean that updated AUR packages are available. It means
the packages have been flagged out of date on the AUR, but
their maintainers have not yet updated the `PKGBUILD`s
(see [outdated AUR packages](https://wiki.archlinux.org/index.php/Arch_User_Repository#Foo_in_the_AUR_is_outdated.3B_what_should_I_do.3F)).
#### 1.80
- **Yay doesn't install dependencies added to a PKGBUILD during installation.**
* yay now warns when installing orphan packages
* Added orphan status to number menu
* Qstats now checks if system has orphan packages installed
Yay resolves all dependencies ahead of time. You are free to edit the
PKGBUILD in any way, but any problems you cause are your own and should not be
reported unless they can be reproduced with the original PKGBUILD.
#### 1.78
- **I know my `-git` package has updates but yay doesn't offer to update it**
* Added foreign package statistics to Qstats
* Group installing is now possible
* Better handling of package dependency installing
Yay uses a hash cache for development packages. Normally it is updated at the end of the package install with the message `Found git repo`.
If you transition between aur helpers and did not install the devel package using yay at some point, it is possible it never got added to the cache. `yay -Y --gendb` will fix the current version of every devel package and start checking from there.
#### 1.76
- **I want to help out!**
* Fixed critical bug that prevented AUR dependencies from being installed.
Check [CONTRIBUTING.md](./CONTRIBUTING.md) for more information.
#### 1.70
## Support
* Stable for everyday use
* Bottom up package display
* Number menu like yaourt/apacman
* System package statistics
All support related to Yay should be requested via GitHub issues. Since Yay is not
officially supported by Arch Linux, support should not be sought out on the
forums, AUR comments or other official channels.
A broken AUR package should be reported as a comment on the package's AUR page.
A package may only be considered broken if it fails to build with makepkg.
Reports should be made using makepkg and include the full output as well as any
other relevant information. Never make reports using Yay or any other external
tools.
## Images
<p align="center">
<img src="https://raw.githubusercontent.com/Jguer/jguer.github.io/refs/heads/master/yay/yay.png" width="42%">
<img src="https://raw.githubusercontent.com/Jguer/jguer.github.io/refs/heads/master/yay/yay-s.png" width="42%">
</p>
<p align="center">
<img src="https://raw.githubusercontent.com/Jguer/jguer.github.io/refs/heads/master/yay/yay-y.png" width="42%">
<img src="https://raw.githubusercontent.com/Jguer/jguer.github.io/refs/heads/master/yay/yay-ps.png" width="42%">
</p>
### Other AUR helpers/tools
- [paru](https://github.com/morganamilo/paru)
- [aurutils](https://github.com/AladW/aurutils)
- [pikaur](https://github.com/actionless/pikaur)

13
SECURITY.md Normal file
View File

@ -0,0 +1,13 @@
# Security Policy
Thank you for helping keep yay secure!
## Supported Versions
We only provide security updates and support for the latest released version of yay. Please ensure you are using the most up-to-date version before reporting vulnerabilities.
## Reporting a Vulnerability
If you discover a security vulnerability, please email us at [security@jguer.space](mailto:security@jguer.space). We will respond as quickly as possible and coordinate a fix.
We appreciate responsible disclosure and your help in making this project safe for everyone.

View File

@ -1,113 +0,0 @@
# This file is in the public domain.
_arch_compgen() {
local i r
COMPREPLY=($(compgen -W '$*' -- "$cur"))
for ((i=1; i < ${#COMP_WORDS[@]}-1; i++)); do
for r in ${!COMPREPLY[@]}; do
if [[ ${COMP_WORDS[i]} = ${COMPREPLY[r]} ]]; then
unset 'COMPREPLY[r]'; break
fi
done
done
}
_arch_ptr2comp() {
local list= x y
for x; do
for y in '0 --' '1 -'; do
eval 'set -- ${'$x'[${y% *}]}'
list+=\ ${@/#/${y#* }}
done
done
_arch_compgen $list
}
_arch_incomp() {
local r="\s-(-${1#* }\s|\w*${1% *})"; [[ $COMP_LINE =~ $r ]]
}
_pacman_keyids() {
\pacman-key --list-keys 2>/dev/null | awk '
$1 == "pub" {
# key id
split($2, a, "/"); print a[2]
}
$1 == "uid" {
# email
if (match($NF, /<[^>]+>/))
print substr($NF, RSTART + 1, RLENGTH - 2)
}'
}
_pacman_pkg() {
_arch_compgen "$(
if [[ $2 ]]; then
\pacman -$1 2>/dev/null | \cut -d' ' -f1 | \sort -u
else
\pacman -$1 2>/dev/null
fi
)"
}
_yay() {
local common core cur database prev query remove sync upgrade yays print o
COMPREPLY=()
_get_comp_words_by_ref cur prev
database=('asdeps asexplicit')
files=('list machinereadable owns search refresh regex' 'l o s x y')
query=('changelog check deps explicit file foreign groups info list owns
search unrequired upgrades' 'c e g i k l m o p s t u')
remove=('cascade dbonly nodeps assume-installed nosave print recursive unneeded' 'c n p s u')
sync=('asdeps asexplicit clean dbonly downloadonly force groups ignore ignoregroup
info list needed nodeps assume-installed print refresh recursive search sysupgrade'
'c g i l p s u w y')
upgrade=('asdeps asexplicit force needed nodeps assume-installed print recursive' 'p')
yays=('clean gendb' 'c')
print=('complete defaultconfig config numberupgrades stats upgrades' 'c d g n
s u')
common=('arch cachedir color config confirm dbpath debug gpgdir help hookdir logfile
noconfirm noprogressbar noscriptlet quiet save mflags buildir editor
makepkg pacman tar git config requestsplitn sudoloop nosudoloop
redownload noredownload redownloadall root verbose' 'b d h q r v')
core=('database files help query remove sync upgrade version' 'D F Q R S U V h')
for o in 'D database' 'F files' 'Q query' 'R remove' 'S sync' 'U upgrade' 'Y yays' 'P print'; do
_arch_incomp "$o" && break
done
if [[ $? != 0 ]]; then
_arch_ptr2comp core
elif [[ ! $prev =~ ^-\w*[Vbhr] &&
! $prev = --@(cachedir|color|config|dbpath|help|hookdir|gpgdir|logfile|root|version) ]]
then
[[ $cur = -* ]] && _arch_ptr2comp ${o#* } common ||
case ${o% *} in
D|R)
_pacman_pkg Qq;;
F)
_arch_incomp 'l list' && _pacman_pkg Slq;
;;
Q)
{ _arch_incomp 'g groups' && _pacman_pkg Qg sort; } ||
{ _arch_incomp 'p file' && _pacman_file; } ||
_arch_incomp 'o owns' || _arch_incomp 'u upgrades' ||
_pacman_pkg Qq;;
S)
{ _arch_incomp 'g groups' && _pacman_pkg Sg; } ||
{ _arch_incomp 'l list' && _arch_compgen "$(yay -Pc | \sort -u)"; } ||
_arch_compgen "$(yay -Pc )";;
U)
_pacman_file;;
esac
fi
true
}
_pacman_file() {
compopt -o filenames; _filedir 'pkg.tar*'
}
complete -F _yay -o default yay
# ex:et ts=2 sw=2 ft=sh

15
ci.Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM docker.io/ljmf00/archlinux:devel
LABEL maintainer="Jguer,docker@jguer.space"
ENV GO111MODULE=on
WORKDIR /app
RUN sed -i '/^\[community\]/,/^\[/ s/^/#/' /etc/pacman.conf
COPY go.mod .
RUN pacman-key --init && pacman -Sy && pacman -S --overwrite=* --noconfirm archlinux-keyring && \
pacman -Su --overwrite=* --needed --noconfirm pacman doxygen meson asciidoc go git gcc make sudo base-devel && \
rm -rfv /var/cache/pacman/* /var/lib/pacman/sync/* && \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v2.1.5 && \
go mod download

230
clean.go
View File

@ -1,53 +1,207 @@
package main
// GetPkgbuild gets the pkgbuild of the package 'pkg' trying the ABS first and then the AUR trying the ABS first and then the AUR.
import (
"context"
"os"
"path/filepath"
// RemovePackage removes package from VCS information
func removeVCSPackage(pkgs []string) {
updated := false
"github.com/Jguer/aur"
mapset "github.com/deckarep/golang-set/v2"
"github.com/leonelquinteros/gotext"
for _, pkgName := range pkgs {
_, ok := savedInfo[pkgName]
if ok {
delete(savedInfo, pkgName)
updated = true
}
}
if updated {
saveVCSInfo()
}
}
// CleanDependencies removes all dangling dependencies in system
func cleanDependencies() error {
hanging, err := hangingPackages()
if err != nil {
return err
}
"github.com/Jguer/yay/v12/pkg/db"
"github.com/Jguer/yay/v12/pkg/runtime"
"github.com/Jguer/yay/v12/pkg/settings"
"github.com/Jguer/yay/v12/pkg/settings/exe"
"github.com/Jguer/yay/v12/pkg/settings/parser"
)
// CleanDependencies removes all dangling dependencies in system.
func cleanDependencies(ctx context.Context, cfg *settings.Configuration,
cmdBuilder exe.ICmdBuilder, cmdArgs *parser.Arguments, dbExecutor db.Executor,
removeOptional bool,
) error {
hanging := hangingPackages(removeOptional, dbExecutor)
if len(hanging) != 0 {
if !continueTask("Confirm Removal?", "nN") {
return nil
}
err = cleanRemove(hanging)
return cleanRemove(ctx, cfg, cmdBuilder, cmdArgs, hanging)
}
return err
return nil
}
// CleanRemove sends a full removal command to pacman with the pkgName slice
func cleanRemove(pkgNames []string) (err error) {
// CleanRemove sends a full removal command to pacman with the pkgName slice.
func cleanRemove(ctx context.Context, cfg *settings.Configuration,
cmdBuilder exe.ICmdBuilder, cmdArgs *parser.Arguments, pkgNames []string,
) error {
if len(pkgNames) == 0 {
return nil
}
oldvalue := config.NoConfirm
config.NoConfirm = true
arguments := makeArguments()
arguments.addArg("R")
arguments.addTarget(pkgNames...)
err = passToPacman(arguments)
config.NoConfirm = oldvalue
return err
arguments := cmdArgs.CopyGlobal()
if err := arguments.AddArg("R", "s", "u"); err != nil {
return err
}
arguments.AddTarget(pkgNames...)
return cmdBuilder.Show(
cmdBuilder.BuildPacmanCmd(ctx,
arguments, cfg.Mode, settings.NoConfirm))
}
func syncClean(ctx context.Context, run *runtime.Runtime, cmdArgs *parser.Arguments, dbExecutor db.Executor) error {
keepInstalled := false
keepCurrent := false
_, removeAll, _ := cmdArgs.GetArg("c", "clean")
for _, v := range run.PacmanConf.CleanMethod {
switch v {
case "KeepInstalled":
keepInstalled = true
case "KeepCurrent":
keepCurrent = true
}
}
if run.Cfg.Mode.AtLeastRepo() {
if err := run.CmdBuilder.Show(run.CmdBuilder.BuildPacmanCmd(ctx,
cmdArgs, run.Cfg.Mode, settings.NoConfirm)); err != nil {
return err
}
}
if !run.Cfg.Mode.AtLeastAUR() {
return nil
}
var question string
if removeAll {
question = gotext.Get("Do you want to remove ALL AUR packages from cache?")
} else {
question = gotext.Get("Do you want to remove all other AUR packages from cache?")
}
run.Logger.Println(gotext.Get("\nBuild directory:"), run.Cfg.BuildDir)
if run.Logger.ContinueTask(question, true, settings.NoConfirm) {
if err := cleanAUR(ctx, run, keepInstalled, keepCurrent, removeAll, dbExecutor); err != nil {
return err
}
}
if removeAll {
return nil
}
if run.Logger.ContinueTask(gotext.Get("Do you want to remove ALL untracked AUR files?"), true, settings.NoConfirm) {
return cleanUntracked(ctx, run)
}
return nil
}
func cleanAUR(ctx context.Context, run *runtime.Runtime,
keepInstalled, keepCurrent, removeAll bool, dbExecutor db.Executor,
) error {
run.Logger.Println(gotext.Get("removing AUR packages from cache..."))
installedBases := mapset.NewThreadUnsafeSet[string]()
inAURBases := mapset.NewThreadUnsafeSet[string]()
remotePackages := dbExecutor.InstalledRemotePackages()
files, err := os.ReadDir(run.Cfg.BuildDir)
if err != nil {
return err
}
cachedPackages := make([]string, 0, len(files))
for _, file := range files {
if !file.IsDir() {
continue
}
cachedPackages = append(cachedPackages, file.Name())
}
// Most people probably don't use keep current and that is the only
// case where this is needed.
// Querying the AUR is slow and needs internet so don't do it if we
// don't need to.
if keepCurrent {
info, errInfo := run.AURClient.Get(ctx, &aur.Query{
Needles: cachedPackages,
})
if errInfo != nil {
return errInfo
}
for i := range info {
inAURBases.Add(info[i].PackageBase)
}
}
for _, pkg := range remotePackages {
if pkg.Base() != "" {
installedBases.Add(pkg.Base())
} else {
installedBases.Add(pkg.Name())
}
}
for _, file := range files {
if !file.IsDir() {
continue
}
if !removeAll {
if keepInstalled && installedBases.Contains(file.Name()) {
continue
}
if keepCurrent && inAURBases.Contains(file.Name()) {
continue
}
}
dir := filepath.Join(run.Cfg.BuildDir, file.Name())
run.Logger.Debugln("removing", dir)
if err = os.RemoveAll(dir); err != nil {
run.Logger.Warnln(gotext.Get("Unable to remove %s: %s", dir, err))
}
}
return nil
}
func cleanUntracked(ctx context.Context, run *runtime.Runtime) error {
run.Logger.Println(gotext.Get("removing untracked AUR files from cache..."))
files, err := os.ReadDir(run.Cfg.BuildDir)
if err != nil {
return err
}
for _, file := range files {
if !file.IsDir() {
continue
}
dir := filepath.Join(run.Cfg.BuildDir, file.Name())
run.Logger.Debugln("cleaning", dir)
if isGitRepository(dir) {
if err := run.CmdBuilder.Show(run.CmdBuilder.BuildGitCmd(ctx, dir, "clean", "-fx")); err != nil {
run.Logger.Warnln(gotext.Get("Unable to clean:"), dir)
return err
}
}
}
return nil
}
func isGitRepository(dir string) bool {
_, err := os.Stat(filepath.Join(dir, ".git"))
return !os.IsNotExist(err)
}

116
clean_test.go Normal file
View File

@ -0,0 +1,116 @@
//go:build !integration
// +build !integration
package main
import (
"context"
"fmt"
"os/exec"
"strings"
"testing"
"github.com/Jguer/go-alpm/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/Jguer/yay/v12/pkg/db/mock"
"github.com/Jguer/yay/v12/pkg/runtime"
"github.com/Jguer/yay/v12/pkg/settings"
"github.com/Jguer/yay/v12/pkg/settings/exe"
"github.com/Jguer/yay/v12/pkg/settings/parser"
)
func TestCleanHanging(t *testing.T) {
pacmanBin := t.TempDir() + "/pacman"
t.Parallel()
testCases := []struct {
name string
args []string
wantShow []string
}{
{
name: "clean",
args: []string{"Y", "c"},
wantShow: []string{"pacman", "-R", "-s", "-u", "--config", "/etc/pacman.conf", "--", "lsp-plugins"},
},
{
name: "clean double",
args: []string{"Y", "c", "c"},
wantShow: []string{"pacman", "-R", "-s", "-u", "--config", "/etc/pacman.conf", "--", "lsp-plugins", "linux-headers"},
},
}
dbExc := &mock.DBExecutor{
PackageOptionalDependsFn: func(i alpm.IPackage) []alpm.Depend {
if i.Name() == "linux" {
return []alpm.Depend{
{
Name: "linux-headers",
},
}
}
return []alpm.Depend{}
},
PackageProvidesFn: func(p alpm.IPackage) []alpm.Depend { return []alpm.Depend{} },
PackageDependsFn: func(p alpm.IPackage) []alpm.Depend { return []alpm.Depend{} },
LocalPackagesFn: func() []mock.IPackage {
return []mock.IPackage{
&mock.Package{
PReason: alpm.PkgReasonExplicit,
PName: "linux",
},
&mock.Package{
PReason: alpm.PkgReasonDepend,
PName: "lsp-plugins",
},
&mock.Package{
PReason: alpm.PkgReasonDepend,
PName: "linux-headers",
},
}
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
mockRunner := &exe.MockRunner{
CaptureFn: func(cmd *exec.Cmd) (stdout string, stderr string, err error) {
return "", "", nil
},
ShowFn: func(cmd *exec.Cmd) error { return nil },
}
cmdBuilder := &exe.CmdBuilder{
SudoBin: "su",
PacmanBin: pacmanBin,
PacmanConfigPath: "/etc/pacman.conf",
GitBin: "git",
Runner: mockRunner,
SudoLoopEnabled: false,
}
run := &runtime.Runtime{CmdBuilder: cmdBuilder, Cfg: &settings.Configuration{}}
cmdArgs := parser.MakeArguments()
cmdArgs.AddArg(tc.args...)
err := handleCmd(context.Background(),
run, cmdArgs, dbExc,
)
require.NoError(t, err)
for i, call := range mockRunner.ShowCalls {
show := call.Args[0].(*exec.Cmd).String()
show = strings.ReplaceAll(show, pacmanBin, "pacman")
// options are in a different order on different systems and on CI root user is used
assert.Subset(t, strings.Split(show, " "),
strings.Split(tc.wantShow[i], " "),
fmt.Sprintf("%d - %s", i, show))
}
})
}
}

999
cmd.go

File diff suppressed because it is too large Load Diff

140
cmd_test.go Normal file
View File

@ -0,0 +1,140 @@
//go:build !integration
// +build !integration
package main
import (
"context"
"fmt"
"io"
"os"
"os/exec"
"strings"
"testing"
"github.com/Jguer/aur"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/Jguer/yay/v12/pkg/db/mock"
mockaur "github.com/Jguer/yay/v12/pkg/dep/mock"
"github.com/Jguer/yay/v12/pkg/query"
"github.com/Jguer/yay/v12/pkg/runtime"
"github.com/Jguer/yay/v12/pkg/settings"
"github.com/Jguer/yay/v12/pkg/settings/exe"
"github.com/Jguer/yay/v12/pkg/settings/parser"
"github.com/Jguer/yay/v12/pkg/text"
"github.com/Jguer/yay/v12/pkg/vcs"
)
func TestYogurtMenuAURDB(t *testing.T) {
t.Skip("skip until Operation service is an interface")
t.Parallel()
makepkgBin := t.TempDir() + "/makepkg"
pacmanBin := t.TempDir() + "/pacman"
gitBin := t.TempDir() + "/git"
f, err := os.OpenFile(makepkgBin, os.O_RDONLY|os.O_CREATE, 0o755)
require.NoError(t, err)
require.NoError(t, f.Close())
f, err = os.OpenFile(pacmanBin, os.O_RDONLY|os.O_CREATE, 0o755)
require.NoError(t, err)
require.NoError(t, f.Close())
f, err = os.OpenFile(gitBin, os.O_RDONLY|os.O_CREATE, 0o755)
require.NoError(t, err)
require.NoError(t, f.Close())
captureOverride := func(cmd *exec.Cmd) (stdout string, stderr string, err error) {
return "", "", nil
}
showOverride := func(cmd *exec.Cmd) error {
return nil
}
mockRunner := &exe.MockRunner{CaptureFn: captureOverride, ShowFn: showOverride}
cmdBuilder := &exe.CmdBuilder{
MakepkgBin: makepkgBin,
SudoBin: "su",
PacmanBin: pacmanBin,
PacmanConfigPath: "/etc/pacman.conf",
GitBin: "git",
Runner: mockRunner,
SudoLoopEnabled: false,
}
cmdArgs := parser.MakeArguments()
cmdArgs.AddArg("Y")
cmdArgs.AddTarget("yay")
db := &mock.DBExecutor{
AlpmArchitecturesFn: func() ([]string, error) {
return []string{"x86_64"}, nil
},
RefreshHandleFn: func() error {
return nil
},
ReposFn: func() []string {
return []string{"aur"}
},
SyncPackagesFn: func(s ...string) []mock.IPackage {
return []mock.IPackage{
&mock.Package{
PName: "yay",
PBase: "yay",
PVersion: "10.0.0",
PDB: mock.NewDB("aur"),
},
}
},
LocalPackageFn: func(s string) mock.IPackage {
return nil
},
}
aurCache := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{
{
Name: "yay",
PackageBase: "yay",
Version: "10.0.0",
},
}, nil
},
}
logger := text.NewLogger(io.Discard, os.Stderr, strings.NewReader("1\n"), true, "test")
run := &runtime.Runtime{
Cfg: &settings.Configuration{
RemoveMake: "no",
},
Logger: logger,
CmdBuilder: cmdBuilder,
VCSStore: &vcs.Mock{},
QueryBuilder: query.NewSourceQueryBuilder(aurCache, logger, "votes", parser.ModeAny, "name",
true, false, true),
AURClient: aurCache,
}
err = handleCmd(context.Background(), run, cmdArgs, db)
require.NoError(t, err)
wantCapture := []string{}
wantShow := []string{
"pacman -S -y --config /etc/pacman.conf --",
"pacman -S -y -u --config /etc/pacman.conf --",
}
require.Len(t, mockRunner.ShowCalls, len(wantShow))
require.Len(t, mockRunner.CaptureCalls, len(wantCapture))
for i, call := range mockRunner.ShowCalls {
show := call.Args[0].(*exec.Cmd).String()
show = strings.ReplaceAll(show, makepkgBin, "makepkg")
show = strings.ReplaceAll(show, pacmanBin, "pacman")
show = strings.ReplaceAll(show, gitBin, "pacman")
// options are in a different order on different systems and on CI root user is used
assert.Subset(t, strings.Split(show, " "), strings.Split(wantShow[i], " "), fmt.Sprintf("%d - %s", i, show))
}
}

View File

@ -1,101 +0,0 @@
package main
import (
"bufio"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"time"
alpm "github.com/jguer/go-alpm"
)
//CreateAURList creates a new completion file
func createAURList(out *os.File, shell string) (err error) {
resp, err := http.Get("https://aur.archlinux.org/packages.gz")
if err != nil {
return err
}
defer resp.Body.Close()
scanner := bufio.NewScanner(resp.Body)
scanner.Scan()
for scanner.Scan() {
fmt.Print(scanner.Text())
out.WriteString(scanner.Text())
if shell == "fish" {
fmt.Print("\tAUR\n")
out.WriteString("\tAUR\n")
} else {
fmt.Print("\n")
out.WriteString("\n")
}
}
return nil
}
//CreatePackageList appends Repo packages to completion cache
func createRepoList(out *os.File, shell string) (err error) {
dbList, err := alpmHandle.SyncDbs()
if err != nil {
return
}
_ = dbList.ForEach(func(db alpm.Db) error {
_ = db.PkgCache().ForEach(func(pkg alpm.Package) error {
fmt.Print(pkg.Name())
out.WriteString(pkg.Name())
if shell == "fish" {
fmt.Print("\t" + pkg.DB().Name() + "\n")
out.WriteString("\t" + pkg.DB().Name() + "\n")
} else {
fmt.Print("\n")
out.WriteString("\n")
}
return nil
})
return nil
})
return nil
}
// Complete provides completion info for shells
func complete(shell string) error {
var path string
if shell == "fish" {
path = completionFile + "fish" + ".cache"
} else {
path = completionFile + "sh" + ".cache"
}
info, err := os.Stat(path)
if os.IsNotExist(err) || time.Since(info.ModTime()).Hours() > 48 {
os.MkdirAll(filepath.Dir(completionFile), 0755)
out, errf := os.Create(path)
if errf != nil {
return errf
}
if createAURList(out, shell) != nil {
defer os.Remove(path)
}
erra := createRepoList(out, shell)
out.Close()
return erra
}
in, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, 0644)
if err != nil {
return err
}
defer in.Close()
_, err = io.Copy(os.Stdout, in)
return err
}

138
completions/bash Normal file
View File

@ -0,0 +1,138 @@
# This file is in the public domain.
_arch_compgen() {
local i r
COMPREPLY=($(compgen -W '$*' -- "$cur"))
for ((i = 1; i < ${#COMP_WORDS[@]} - 1; i++)); do
for r in ${!COMPREPLY[@]}; do
if [[ ${COMP_WORDS[i]} == ${COMPREPLY[r]} ]]; then
unset 'COMPREPLY[r]'
break
fi
done
done
}
_arch_ptr2comp() {
local list= x y
for x; do
for y in '0 --' '1 -'; do
eval 'set -- ${'$x'[${y% *}]}'
list+=\ ${@/#/${y#* }}
done
done
_arch_compgen $list
}
_arch_incomp() {
local r="[[:space:]]-(-${1#* }[[:space:]]|[[:alnum:]_]*${1% *})"
[[ $COMP_LINE =~ $r ]]
}
_pacman_pkg() {
_arch_compgen "$(
if [[ $2 ]]; then
\pacman -$1 2>/dev/null | \cut -d' ' -f1 | \sort -u
else
\pacman -$1 2>/dev/null
fi
)"
}
_yay_pkg() {
[ -z "$cur" ] && _pacman_pkg Slq && return
_arch_compgen "$(yay -Pc)"
}
_pacman_repo_list() {
_arch_compgen "$(pacman-conf --repo-list)"
}
_yay() {
compopt -o default
local common core cur database files prev query remove sync upgrade o
local yays show getpkgbuild web
local cur prev words cword
_init_completion || return
database=('asdeps asexplicit')
files=('list machinereadable refresh regex' 'l x y')
query=('changelog check deps explicit file foreign groups info list native owns
search unrequired upgrades' 'c e g i k l m n o p s t u')
remove=('cascade dbonly nodeps assume-installed nosave print recursive unneeded' 'c n p s u')
sync=('asdeps asexplicit clean dbonly downloadonly overwrite groups ignore ignoregroup
info list needed nodeps assume-installed print refresh recursive search sysupgrade aur repo'
'c g i l p s u w y a N')
upgrade=('asdeps asexplicit overwrite needed nodeps assume-installed print recursive' 'p')
core=('database files help query remove sync upgrade version' 'D F Q R S U V h')
##yay stuff
common=('arch cachedir color config confirm dbpath debug gpgdir help hookdir logfile
noconfirm noprogressbar noscriptlet quiet root verbose
makepkg pacman git gpg gpgflags config requestsplitn sudoloop
redownload noredownload redownloadall rebuild rebuildall rebuildtree norebuild sortby
singlelineresults doublelineresults answerclean answerdiff answeredit answerupgrade noanswerclean noanswerdiff
noansweredit noanswerupgrade cleanmenu diffmenu editmenu cleanafter keepsrc
provides pgpfetch
useask combinedupgrade aur repo makepkgconf
nomakepkgconf askremovemake askyesremovemake removemake noremovemake completioninterval aururl aurrpcurl
searchby batchinstall'
'b d h q r v')
yays=('clean gendb' 'c')
show=('complete defaultconfig currentconfig stats news' 'c d g s w')
getpkgbuild=('force print' 'f p')
web=('vote unvote' 'v u')
for o in 'D database' 'F files' 'Q query' 'R remove' 'S sync' 'U upgrade' 'Y yays' 'P show' 'G getpkgbuild' 'W web'; do
_arch_incomp "$o" && break
done
if [[ $? != 0 ]]; then
_arch_ptr2comp core
elif [[ ! $prev =~ ^-[[:alnum:]_]*[Vbhr] && ! $prev == --@(cachedir|color|config|dbpath|help|hookdir|gpgdir|logfile|root|version) ]]; then
[[ $cur == -* ]] && _arch_ptr2comp ${o#* } common ||
case ${o% *} in
D | R)
_pacman_pkg Qq
;;
F)
{ _arch_incomp 'l list' && _pacman_pkg Slq; } ||
_arch_incomp 'o owns' ||
compopt +o default
;;
Q)
{ _arch_incomp 'g groups' && _pacman_pkg Qg sort; } ||
{ _arch_incomp 'p file' && _pacman_file; } ||
{ _arch_incomp 's search' && compopt +o default; } ||
{ _arch_incomp 'u upgrades' && compopt +o default; } ||
_arch_incomp 'o owns' ||
_pacman_pkg Qq
;;
S)
{ _arch_incomp 'g groups' && _pacman_pkg Sg; } ||
{ _arch_incomp 'l list' && _pacman_repo_list; } ||
{ _arch_incomp 's search' && compopt +o default; } ||
_yay_pkg
;;
U)
_pacman_file
;;
G)
_yay_pkg
;;
W)
_yay_pkg
;;
esac
fi
true
}
_pacman_file() {
compopt -o filenames
_filedir 'pkg.*'
}
complete -F _yay yay
# ex:et ts=2 sw=2 ft=sh

245
completions/fish Normal file
View File

@ -0,0 +1,245 @@
# vim:fdm=marker foldlevel=0 tabstop=2 shiftwidth=2 filetype=fish
# Original Author for pacman: Giorgio Lando <patroclo7@gmail.com>
# Updated for yay by jguer
set -l progname yay
# Yay constants
set -l listall "(yay -Pc)"
set -l listpacman "(__fish_print_packages)"
set -l yayspecific '__fish_contains_opt -s Y yay'
set -l webspecific '__fish_contains_opt -s W web'
set -l show '__fish_contains_opt -s P show'
set -l getpkgbuild '__fish_contains_opt -s G getpkgbuild'
# Pacman constants
set -l listinstalled "(pacman -Q | string replace ' ' \t)"
set -l listrepos "(__fish_print_pacman_repos)"
set -l listgroups "(pacman -Sg)\t'Package Group'"
set -l noopt 'not __fish_contains_opt -s S -s D -s Q -s R -s U -s T -s F -s Y -s W -s P -s G database query sync remove upgrade deptest files show getpkgbuild web yay'
set -l database '__fish_contains_opt -s D database'
set -l query '__fish_contains_opt -s Q query'
set -l remove '__fish_contains_opt -s R remove'
set -l sync '__fish_contains_opt -s S sync'
set -l upgrade '__fish_contains_opt -s U upgrade'
set -l files '__fish_contains_opt -s F files'
complete -c $progname -e
complete -c $progname -f
# HACK: We only need these two to coerce fish to stop file completion and complete options
complete -c $progname -n "$noopt" -a "-D" -d "Modify the package database"
complete -c $progname -n "$noopt" -a "-Q" -d "Query the package database"
# Primary operations
complete -c $progname -s D -f -l database -n "$noopt" -d 'Modify the package database'
complete -c $progname -s Q -f -l query -n "$noopt" -d 'Query the package database'
complete -c $progname -s R -f -l remove -n "$noopt" -d 'Remove packages from the system'
complete -c $progname -s S -f -l sync -n "$noopt" -d 'Synchronize packages'
complete -c $progname -s T -f -l deptest -n "$noopt" -d 'Check dependencies'
complete -c $progname -s U -l upgrade -n "$noopt" -d 'Upgrade or add a local package'
complete -c $progname -s F -f -l files -n "$noopt" -d 'Query the files database'
complete -c $progname -s V -f -l version -d 'Display version and exit'
complete -c $progname -s h -f -l help -d 'Display help'
# General options
# Only offer these once a command has been given so they get prominent display
complete -c $progname -n "not $noopt" -s b -l dbpath -d 'Alternate database location' -xa "(__fish_complete_directories)"
complete -c $progname -n "not $noopt" -s r -l root -d 'Alternate installation root' -xa "(__fish_complete_directories)"
complete -c $progname -n "not $noopt" -s v -l verbose -d 'Output more status messages' -f
complete -c $progname -n "not $noopt" -l arch -d 'Alternate architecture' -f
complete -c $progname -n "not $noopt" -l cachedir -d 'Alternate package cache location' -xa "(__fish_complete_directories)"
complete -c $progname -n "not $noopt" -l color -d 'Colorize the output' -fa '{auto,always,never}'
complete -c $progname -n "not $noopt" -l config -d 'Alternate config file' -rF
complete -c $progname -n "not $noopt" -l confirm -d 'Always ask for confirmation' -f
complete -c $progname -n "not $noopt" -l debug -d 'Display debug messages' -f
complete -c $progname -n "not $noopt" -l disable-download-timeout -d 'Use relaxed timeouts for download' -f
complete -c $progname -n "not $noopt" -l gpgdir -d 'Alternate home directory for GnuPG' -xa "(__fish_complete_directories)"
complete -c $progname -n "not $noopt" -l hookdir -d 'Alternate hook location' -xa "(__fish_complete_directories)"
complete -c $progname -n "not $noopt" -l logfile -d 'Alternate log file'
complete -c $progname -n "not $noopt" -l noconfirm -d 'Bypass any confirmation' -f
complete -c $progname -n "not $noopt" -l sysroot -d 'Operate on a mounted guest system (root-only)' -xa "(__fish_complete_directories)"
# File, query, sync options (files, query, sync)
for condition in files query sync
complete -c $progname -n "$$condition" -s q -l quiet -d 'Show less information' -f
end
# Transaction options (sync, remove, upgrade)
for condition in sync remove upgrade
complete -c $progname -n "$$condition" -s d -l nodeps -d 'Skip [all] dependency checks' -f
complete -c $progname -n "$$condition" -s p -l print -d 'Dry run, only print targets' -f
complete -c $progname -n "$$condition" -l assume-installed -d 'Add a virtual package to satisfy dependencies' -f
complete -c $progname -n "$$condition" -l dbonly -d 'Modify database entry only' -f
complete -c $progname -n "$$condition" -l noprogressbar -d 'Do not display progress bar' -f
complete -c $progname -n "$$condition" -l noscriptlet -d 'Do not execute install script' -f
complete -c $progname -n "$$condition" -l print-format -d 'Specify printf-like format' -x
end
# File and query options (files, query)
for condition in files query
complete -c $progname -n "$$condition" -s l -l list -d 'List the files owned by PACKAGE' -f
end
# File and sync options (files, sync)
for condition in files sync
complete -c $progname -n "$$condition" -s y -l refresh -d 'Download fresh package databases [force]' -f
end
# Query and sync options (query, sync)
for condition in query sync
complete -c $progname -n "$$condition" -s g -l groups -d 'Display members of [all] package GROUP' -xa "$listgroups"
end
# Sync and upgrade options (sync, upgrade)
for condition in sync upgrade
complete -c $progname -n "$$condition" -l asdeps -d 'Install packages as non-explicitly installed' -f
complete -c $progname -n "$$condition" -l asexplicit -d 'Install packages as explicitly installed' -f
complete -c $progname -n "$$condition" -l ignore -d 'Ignore a package upgrade (can be used more than once)' -xa "$listall"
complete -c $progname -n "$$condition" -l ignoregroup -d 'Ignore a group upgrade (can be used more than once)' -xa "$listgroups"
complete -c $progname -n "$$condition" -l needed -d 'Do not reinstall up to date packages' -f
complete -c $progname -n "$$condition" -l overwrite -d 'Overwrite conflicting files (can be used more than once)' -rF
end
# Database options
set -l has_db_opt '__fish_contains_opt asdeps asexplicit check -s k'
complete -c $progname -n "$database; and not $has_db_opt" -s k -l check -d 'Check database validity'
complete -c $progname -n "$database" -s q -l quite -d 'Suppress output of success messages' -f
complete -c $progname -n "$database; and not $has_db_opt" -l asdeps -d 'Mark PACKAGE as dependency' -x
complete -c $progname -n "$database; and not $has_db_opt" -l asexplicit -d 'Mark PACKAGE as explicitly installed' -x
complete -c $progname -n "$has_db_opt; and $database" -xa "$listinstalled"
# File options - since pacman 5
complete -c $progname -n "$files" -s x -l regex -d 'Interpret each query as a regular expression' -f
complete -c $progname -n "$files" -l machinereadable -d 'Print each match in a machine readable output format' -f
complete -c $progname -n "$files" -d Package -xa "$listpacman"
# Query options
complete -c $progname -n "$query" -s c -l changelog -d 'View the change log of PACKAGE' -f
complete -c $progname -n "$query" -s d -l deps -d 'List only non-explicit packages (dependencies)' -f
complete -c $progname -n "$query" -s e -l explicit -d 'List only explicitly installed packages' -f
complete -c $progname -n "$query" -s i -l info -d 'View PACKAGE [backup files] information' -f
complete -c $progname -n "$query" -s k -l check -d 'Check that PACKAGE files exist' -f
complete -c $progname -n "$query" -s m -l foreign -d 'List installed packages not found in sync database' -f
complete -c $progname -n "$query" -s n -l native -d 'list installed packages only found in sync database' -f
complete -c $progname -n "$query" -s o -l owns -d 'Query the package that owns FILE' -rF
complete -c $progname -n "$query" -s p -l file -d 'Query a package file instead of the database' -rF
complete -c $progname -n "$query" -s s -l search -d 'Search locally-installed packages for regexp' -f
complete -c $progname -n "$query" -s t -l unrequired -d 'List only unrequired packages [and optdepends]' -f
complete -c $progname -n "$query" -s u -l upgrades -d 'List only out-of-date packages' -f
complete -c $progname -n "$query" -d 'Installed package' -xa "$listinstalled"
# Remove options
complete -c $progname -n "$remove" -s c -l cascade -d 'Also remove packages depending on PACKAGE' -f
complete -c $progname -n "$remove" -s n -l nosave -d 'Ignore file backup designations' -f
complete -c $progname -n "$remove" -s s -l recursive -d 'Also remove dependencies of PACKAGE' -f
complete -c $progname -n "$remove" -s u -l unneeded -d 'Only remove targets not required by PACKAGE' -f
complete -c $progname -n "$remove" -d 'Installed package' -xa "$listinstalled"
# Sync options
complete -c $progname -n "$sync" -s c -l clean -d 'Remove [all] packages from cache' -f
complete -c $progname -n "$sync" -s i -l info -d 'View PACKAGE [extended] information' -f
complete -c $progname -n "$sync" -s l -l list -d 'List all packages in REPOSITORY' -xa "$listrepos"
complete -c $progname -n "$sync" -s s -l search -d 'Search remote repositories for regexp' -f
complete -c $progname -n "$sync" -s u -l sysupgrade -d 'Upgrade all packages that are out of date'
complete -c $progname -n "$sync" -s w -l downloadonly -d 'Only download the target packages'
complete -c $progname -n "$sync" -xa "$listall $listgroups"
# Upgrade options
# Theoretically, pacman reads packages in all formats that libarchive supports
# In practice, it's going to be tar.xz, tar.gz, tar.zst, or just pkg.tar (uncompressed pkg)
complete -c $progname -n "$upgrade" -xa '(__fish_complete_suffix pkg.tar.zst; __fish_complete_suffix pkg.tar.xz; __fish_complete_suffix pkg.tar.gz; __fish_complete_suffix pkg.tar;)' -d 'Package file'
# Yay operations
complete -c $progname -s Y -f -l yay -n "$noopt" -d 'Yay specific operations'
complete -c $progname -s P -f -l show -n "$noopt" -d 'Print information'
complete -c $progname -s G -f -l getpkgbuild -n "$noopt" -d 'Get PKGBUILD from ABS or AUR'
complete -c $progname -s W -f -l web -n "$noopt" -d 'Web operations'
# Web options
complete -c $progname -n "$webspecific" -s v -l vote -d 'Vote for AUR packages' -f
complete -c $progname -n "$webspecific" -s u -l unvote -d 'Unvote for AUR packages' -f
complete -c $progname -n "$webspecific" -xa "$listall"
# New options
complete -c $progname -n "not $noopt" -s a -l aur -d 'Assume targets are from the AUR' -f
complete -c $progname -n "not $noopt" -s N -l repo -d 'Assume targets are from the repositories' -f
# Yay options
complete -c $progname -n "$yayspecific" -s c -l clean -d 'Remove unneeded dependencies' -f
complete -c $progname -n "$yayspecific" -l gendb -d 'Generate development package DB' -f
# Show options
complete -c $progname -n "$show" -s c -l complete -d 'Print a list of all AUR and repo packages' -f
#complete -c $progname -n "$show" -s f -l fish -d 'During complete adjust the output for the fish shell' -f
complete -c $progname -n "$show" -s d -l defaultconfig -d 'Print default yay configuration' -f
complete -c $progname -n "$show" -s g -l currentconfig -d 'Print current yay configuration' -f
complete -c $progname -n "$show" -s s -l stats -d 'Display system package statistics' -f
complete -c $progname -n "$show" -s w -l news -d 'Print arch news' -f
complete -c $progname -n "$show" -s q -l quiet -d 'Do not print news description' -f
# Getpkgbuild options
complete -c $progname -n "$getpkgbuild" -s f -l force -d 'Force download for existing ABS packages' -f
complete -c $progname -n "$getpkgbuild" -xa "$listall"
complete -c $progname -n "$getpkgbuild" -s p -l print -d 'Print pkgbuild of packages' -f
# Permanent configuration settings
complete -c $progname -n "not $noopt" -l save -d 'Save current arguments to yay permanent configuration' -f
complete -c $progname -n "not $noopt" -l aururl -d 'Set an alternative AUR URL' -f
complete -c $progname -n "not $noopt" -l aurrpcurl -d 'Set an alternative URL for the AUR /rpc endpoint' -f
complete -c $progname -n "not $noopt" -l builddir -d 'Directory to use for Building AUR Packages' -r
complete -c $progname -n "not $noopt" -l editor -d 'Editor to use' -f
complete -c $progname -n "not $noopt" -l editorflags -d 'Editor flags to use' -f
complete -c $progname -n "not $noopt" -l makepkg -d 'Makepkg command to use' -f
complete -c $progname -n "not $noopt" -l pacman -d 'Pacman command to use' -f
complete -c $progname -n "not $noopt" -l tar -d 'Tar command to use' -f
complete -c $progname -n "not $noopt" -l git -d 'Git command to use' -f
complete -c $progname -n "not $noopt" -l gpg -d 'Gpg command to use' -f
complete -c $progname -n "not $noopt" -l config -d 'The pacman config file to use' -r
complete -c $progname -n "not $noopt" -l makepkgconf -d 'Use custom makepkg.conf location' -r
complete -c $progname -n "not $noopt" -l nomakepkgconf -d 'Use default makepkg.conf' -f
complete -c $progname -n "not $noopt" -l requestsplitn -d 'Max amount of packages to query per AUR request' -f
complete -c $progname -n "not $noopt" -l completioninterval -d 'Refresh interval for completion cache' -f
complete -c $progname -n "not $noopt" -l sortby -d 'Sort AUR results by a specific field during search' -xa "{votes,popularity,id,baseid,name,base,submitted,modified}"
complete -c $progname -n "not $noopt" -l searchby -d 'Search for AUR packages by querying the specified field' -xa "{name,name-desc,maintainer,depends,checkdepends,makedepends,optdepends}"
complete -c $progname -n "not $noopt" -l answerclean -d 'Set a predetermined answer for the clean build menu' -xa "{All,None,Installed,NotInstalled}"
complete -c $progname -n "not $noopt" -l answerdiff -d 'Set a predetermined answer for the edit diff menu' -xa "{All,None,Installed,NotInstalled}"
complete -c $progname -n "not $noopt" -l answeredit -d 'Set a predetermined answer for the edit pkgbuild menu' -xa "{All,None,Installed,NotInstalled}"
complete -c $progname -n "not $noopt" -l answerupgrade -d 'Set a predetermined answer for the upgrade menu' -f
complete -c $progname -n "not $noopt" -l noanswerclean -d 'Unset the answer for the clean build menu' -f
complete -c $progname -n "not $noopt" -l noanswerdiff -d 'Unset the answer for the diff menu' -f
complete -c $progname -n "not $noopt" -l noansweredit -d 'Unset the answer for the edit pkgbuild menu' -f
complete -c $progname -n "not $noopt" -l noanswerupgrade -d 'Unset the answer for the upgrade menu' -f
complete -c $progname -n "not $noopt" -l cleanmenu -d 'Give the option to clean build PKGBUILDS' -f
complete -c $progname -n "not $noopt" -l diffmenu -d 'Give the option to show diffs for build files' -f
complete -c $progname -n "not $noopt" -l editmenu -d 'Give the option to edit/view PKGBUILDS' -f
complete -c $progname -n "not $noopt" -l askremovemake -d 'Ask to remove make deps after install' -f
complete -c $progname -n "not $noopt" -l askyesremovemake -d 'Ask to remove make deps after install(with "Y" as default)' -f
complete -c $progname -n "not $noopt" -l removemake -d 'Remove make deps after install' -f
complete -c $progname -n "not $noopt" -l noremovemake -d 'Do not remove make deps after install' -f
complete -c $progname -n "not $noopt" -l topdown -d 'Shows repository packages first and then aur' -f
complete -c $progname -n "not $noopt" -l bottomup -d 'Shows aur packages first and then repository' -f
complete -c $progname -n "not $noopt" -l singlelineresults -d 'List each search result on its own line' -f
complete -c $progname -n "not $noopt" -l doublelineresults -d 'List each search result on two lines, like pacman' -f
complete -c $progname -n "not $noopt" -l devel -d 'Check -git/-svn/-hg development version' -f
complete -c $progname -n "not $noopt" -l cleanafter -d 'Clean package sources after successful build' -f
complete -c $progname -n "not $noopt" -l keepsrc -d 'Keep pkg/ and src/ after building packages' -f
complete -c $progname -n "not $noopt" -l timeupdate -d 'Check package modification date and version' -f
complete -c $progname -n "not $noopt" -l redownload -d 'Redownload PKGBUILD of package even if up-to-date' -f
complete -c $progname -n "not $noopt" -l redownloadall -d 'Redownload PKGBUILD of package and deps even if up-to-date' -f
complete -c $progname -n "not $noopt" -l noredownload -d 'Do not redownload up-to-date PKGBUILDs' -f
complete -c $progname -n "not $noopt" -l provides -d 'Look for matching providers when searching for packages' -f
complete -c $progname -n "not $noopt" -l pgpfetch -d 'Prompt to import PGP keys from PKGBUILDs' -f
complete -c $progname -n "not $noopt" -l useask -d 'Automatically resolve conflicts using pacmans ask flag' -f
complete -c $progname -n "not $noopt" -l combinedupgrade -d 'Refresh then perform the repo and AUR upgrade together' -f
complete -c $progname -n "not $noopt" -l batchinstall -d 'Build multiple AUR packages then install them together' -f
complete -c $progname -n "not $noopt" -l rebuild -d 'Always build target packages' -f
complete -c $progname -n "not $noopt" -l rebuildall -d 'Always build all AUR packages' -f
complete -c $progname -n "not $noopt" -l rebuildtree -d 'Always build all AUR packages even if installed' -f
complete -c $progname -n "not $noopt" -l norebuild -d 'Skip package build if in cache and up to date' -f
complete -c $progname -n "not $noopt" -l mflags -d 'Pass the following options to makepkg' -f
complete -c $progname -n "not $noopt" -l gpgflags -d 'Pass the following options to gpg' -f
complete -c $progname -n "not $noopt" -l sudoloop -d 'Loop sudo calls in the background to avoid timeout' -f

617
completions/zsh Normal file
View File

@ -0,0 +1,617 @@
#compdef yay
# vim:tabstop=2 shiftwidth=2 filetype=zsh
typeset -A opt_args
setopt extendedglob
# options for passing to _arguments: main pacman commands
_pacman_opts_commands=(
{-D,--database}'[Modify database]'
{-F,--files}'[Query the files database]'
{-G,--getpkgbuild}'[Get PKGBUILD from ABS or AUR]'
{-Q,--query}'[Query the package database]'
{-R,--remove}'[Remove a package from the system]'
{-P,--show}'[Print yay information]'
{-S,--sync}'[Synchronize packages]'
{-T,--deptest}'[Check if dependencies are installed]'
{-U,--upgrade}'[Upgrade a package]'
{-Y,--yay}'[Yay specific options]'
{-W,--web}'[web options]'
{-V,--version}'[Display version and exit]'
'(-h --help)'{-h,--help}'[Display usage]'
)
# options for passing to _arguments: options common to all commands
_pacman_opts_common=(
{-N,--repo}'[Assume targets are from the repositories]'
{-a,--aur}'[Assume targets are from the AUR]'
'--aururl[Set an alternative AUR URL]:url'
'--aurrpcurl[Set an alternative URL for the AUR /rpc endpoint]:url'
'--arch[Set an alternate architecture]'
{-b,--dbpath}'[Alternate database location]:database_location:_files -/'
'--color[colorize the output]:color options:(always never auto)'
{-h,--help}'[Display syntax for the given operation]'
{-r,--root}'[Set alternate installation root]:installation root:_files -/'
{-v,--verbose}'[Be more verbose]'
'--cachedir[Alternate package cache location]:cache_location:_files -/'
'--config[An alternate configuration file]:config file:_files'
'--makepkgconf[makepkg.conf file to use]:config file:_files'
'--nomakepkgconf[Use the default makepkg.conf]'
'--requestsplitn[Max amount of packages to query per AUR request]:number'
'--completioninterval[Time in days to refresh completion cache]:number'
'--confirm[Always ask for confirmation]'
'--debug[Display debug messages]'
'--gpgdir[Set an alternate directory for GnuPG (instead of /etc/pacman.d/gnupg)]: :_files -/'
'--hookdir[Set an alternate hook location]: :_files -/'
'--logfile[An alternate log file]:config file:_files'
'--noconfirm[Do not ask for confirmation]'
'--noprogressbar[Do not show a progress bar when downloading files]'
'--noscriptlet[Do not execute the install scriptlet if one exists]'
'--save[Causes config options to be saved back to the config file]'
'--builddir[Directory to use for building AUR Packages]:build dir:_files -/'
'--editor[Editor to use when editing PKGBUILDs]:editor:_files'
'--editorflags[Flags to pass to editor]'
'--makepkg[makepkg command to use]:makepkg:_files'
'--pacman[pacman command to use]:pacman:_files'
'--git[git command to use]:git:_files'
'--gpg[gpg command to use]:gpg:_files'
'--sortby[Sort AUR results by a specific field during search]:sortby options:(votes popularity id baseid name base submitted modified)'
'--answerclean[Set a predetermined answer for the clean build menu]:answer'
'--answerdiff[Set a predetermined answer for the diff menu]:answer'
'--answeredit[Set a predetermined answer for the edit pkgbuild menu]:answer'
'--answerupgrade[Set a predetermined answer for the upgrade menu]:answer'
'--noanswerclean[Unset the answer for the clean build menu]'
'--noanswerdiff[Unset the answer for the diff menu]'
'--noansweredit[Unset the answer for the edit pkgbuild menu]'
'--noanswerupgrade[Unset the answer for the upgrade menu]'
'--cleanmenu[Give the option to clean build PKGBUILDS]'
'--diffmenu[Give the option to show diffs for build files]'
'--editmenu[Give the option to edit/view PKGBUILDS]'
"--askremovemake[Ask to remove makedepends after install]"
"--askyesremovemake[Ask to remove makedepends after install(with "Y" as default)]"
"--removemake[Remove makedepends after install]"
"--noremovemake[Don't remove makedepends after install]"
'--bottomup[Show AUR packages first]'
'--topdown[Show repository packages first]'
'--singlelineresults[List each search result on its own line]'
'--doublelineresults[List each search result on two lines, like pacman]'
'--devel[Check -git/-svn/-hg development version]'
'--cleanafter[Clean package sources after successful build]'
'--keepsrc[Keep pkg/ and src/ after building packages]'
'--timeupdate[Check packages modification date and version]'
'--redownload[Always download pkgbuilds of targets]'
'--redownloadall[Always download pkgbuilds of all AUR packages]'
'--noredownload[Skip pkgbuild download if in cache and up to date]'
'--rebuild[Always build target packages]'
'--rebuildall[Always build all AUR packages]'
'--provides[Look for matching providers when searching for packages]'
'--pgpfetch[Prompt to import PGP keys from PKGBUILDs]'
"--useask[Automatically resolve conflicts using pacman's ask flag]"
'--combinedupgrade[Refresh then perform the repo and AUR upgrade together]'
'--rebuildtree[Always build all AUR packages even if installed]'
'--norebuild[Skip package build if in cache and up to date]'
'--mflags[Pass arguments to makepkg]:mflags'
'--gpgflags[Pass arguments to gpg]:gpgflags'
'--sudoloop[Loop sudo calls in the background to avoid timeout]'
'--searchby[Search for packages using a specified field]'
'--sortby[Sort AUR results by a specific field during search]'
'--batchinstall[Build multiple AUR packages then install them together]'
)
# options for passing to _arguments: options for --upgrade commands
_pacman_opts_pkgfile=(
'*-d[Skip dependency checks]'
'*--nodeps[Skip dependency checks]'
'*--assume-installed[Add virtual package to satisfy dependencies]'
'--dbonly[Only remove database entry, do not remove files]'
'--overwrite[Overwrite conflicting files]:file:_files -g "*"'
'--needed[Do not reinstall up to date packages]'
'--asdeps[mark packages as non-explicitly installed]'
'--asexplicit[mark packages as explicitly installed]'
{-p,--print}'[Only print the targets instead of performing the operation]'
'*--ignore[Ignore a package upgrade]:package: _pacman_completions_all_packages'
'*--ignoregroup[Ignore a group upgrade]:package group:_pacman_completions_all_groups'
'--print-format[Specify how the targets should be printed]'
'*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
)
# options for passing to _arguments: subactions for --query command
_pacman_opts_query_actions=(
'(-Q --query)'{-Q,--query}
{-g,--groups}'[View all members of a package group]:*:package groups:->query_group'
{-o,--owns}'[Query the package that owns a file]:file:_files'
{-p,--file}'[Package file to query]:*:package file:->query_file'
{-s,--search}'[Search package names and descriptions]:*:search text:->query_search'
)
# options for passing to _arguments: options for --query and subcommands
_pacman_opts_query_modifiers=(
{-c,--changelog}'[List package changelog]'
{-d,--deps}'[List packages installed as dependencies]'
{-e,--explicit}'[List packages explicitly installed]'
{\*-i,\*--info}'[View package information]'
{\*-k,\*--check}'[Check package files]'
{-l,--list}'[List package contents]'
{-m,--foreign}'[List installed packages not found in sync db(s)]'
{-n,--native}'[List installed packages found in sync db(s)]'
{-q,--quiet}'[Show less information for query and search]'
{-t,--unrequired}'[List packages not required by any package]'
{-u,--upgrades}'[List packages that can be upgraded]'
)
# -Y
_pacman_opts_yay_modifiers=(
{-c,--clean}'[Remove unneeded dependencies]'
'--gendb[Generates development package DB used for updating]'
)
# -G
_pacman_opts_getpkgbuild_modifiers=(
{-f,--force}'[Force download for existing ABS packages]'
{-p,--print}'[Print PKGBUILDs]:package:_pacman_completions_all_packages'
)
# -W
_pacman_opts_web_modifiers=(
{-u,--unvote}'[Unvote AUR package]:package:_pacman_completions_all_packages'
{-v,--vote}'[Vote AUR package]:package:_pacman_completions_all_packages'
)
# -P
_pacman_opts_print_modifiers=(
{-c,--complete}'[Used for completions]'
{-d,--defaultconfig}'[Print default yay configuration]'
{-g,--config}'[Print current yay configuration]'
{-n,--numberupgrades}'[Print number of updates]'
{-s,--stats}'[Display system package statistics]'
{-u,--upgrades}'[Print update list]'
{-w,--news}'[Print arch news]'
)
# options for passing to _arguments: options for --remove command
_pacman_opts_remove=(
{-c,--cascade}'[Remove all dependent packages]'
{-d,--nodeps}'[Skip dependency checks]'
'*--assume-installed[Add virtual package to satisfy dependencies]'
{-n,--nosave}'[Remove protected configuration files]'
{-p,--print}'[Only print the targets instead of performing the operation]'
{\*-s,\*--recursive}'[Remove dependencies not required by other packages]'
{-u,--unneeded}'[Remove unneeded packages]'
'--dbonly[Only remove database entry, do not remove files]'
'--print-format[Specify how the targets should be printed]'
'*:installed package:_pacman_completions_installed_packages'
)
_pacman_opts_database=(
'--asdeps[mark packages as non-explicitly installed]'
'--asexplicit[mark packages as explicitly installed]'
'*:installed package:_pacman_completions_installed_packages'
)
_pacman_opts_files=(
{-l,--list}'[List the files owned by the queried package]:package:_pacman_completions_all_packages'
{-x,--regex}'[Enable searching using regular expressions]:regex:'
{-y,--refresh}'[Download fresh files databases from the server]'
'--machinereadable[Produce machine-readable output]'
{-q,--quiet}'[Show less information for query and search]'
)
# options for passing to _arguments: options for --sync command
_pacman_opts_sync_actions=(
'(-S --sync)'{-S,--sync}
{\*-c,\*--clean}'[Remove old packages from cache]:\*:clean:->sync_clean'
{-g,--groups}'[View all members of a package group]:*:package groups:->sync_group'
{-s,--search}'[Search package names and descriptions]:*:search text:->sync_search'
'--dbonly[Only remove database entry, do not remove files]'
'--needed[Do not reinstall up to date packages]'
'--recursive[Reinstall all dependencies of target packages]'
)
# options for passing to _arguments: options for --sync command
_pacman_opts_sync_modifiers=(
{\*-d,\*--nodeps}'[Skip dependency checks]'
'*--assume-installed[Add virtual package to satisfy dependencies]'
{\*-i,\*--info}'[View package information]'
{-l,--list}'[List all packages in a repository]'
{-p,--print}'[Print download URIs for each package to be installed]'
{-q,--quiet}'[Show less information for query and search]'
{\*-u,\*--sysupgrade}'[Upgrade all out-of-date packages]'
{-w,--downloadonly}'[Download packages only]'
{\*-y,\*--refresh}'[Download fresh package databases]'
'*--ignore[Ignore a package upgrade]:package: _pacman_completions_all_packages'
'*--ignoregroup[Ignore a group upgrade]:package group:_pacman_completions_all_groups'
'--asdeps[Install packages as non-explicitly installed]'
'--asexplicit[Install packages as explicitly installed]'
'--overwrite[Overwrite conflicting files]:files:_files'
'--print-format[Specify how the targets should be printed]'
)
# handles --help subcommand
_pacman_action_help() {
_arguments -s : \
"$_pacman_opts_commands[@]"
}
# handles cases where no subcommand has yet been given
_pacman_action_none() {
_arguments -s : \
"$_pacman_opts_commands[@]"
}
# handles --query subcommand
_pacman_action_query() {
local context state line
typeset -A opt_args
case $state in
query_file)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
;;
query_group)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:groups:_pacman_completions_installed_groups'
;;
query_owner)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:file:_files'
;;
query_search)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:search text: '
;;
*)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_actions[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package:_pacman_completions_installed_packages'
;;
esac
}
# handles --remove subcommand
_pacman_action_remove() {
_arguments -s : \
'(--remove -R)'{-R,--remove} \
"$_pacman_opts_common[@]" \
"$_pacman_opts_remove[@]"
}
# handles --database subcommand
_pacman_action_database() {
_arguments -s : \
'(--database -D)'{-D,--database} \
"$_pacman_opts_common[@]" \
"$_pacman_opts_database[@]"
}
# handles --files subcommand
_pacman_action_files() {
_arguments -s : \
'(--files -F)'{-F,--files} \
"$_pacman_opts_common[@]" \
"$_pacman_opts_files[@]"
}
_pacman_action_deptest () {
_arguments -s : \
'(--deptest)-T' \
"$_pacman_opts_common[@]" \
":packages:_pacman_all_packages"
}
# handles --sync subcommand
_pacman_action_sync() {
local context state line
typeset -A opt_args
if (( $+words[(r)--clean] )); then
state=sync_clean
elif (( $+words[(r)--groups] )); then
state=sync_group
elif (( $+words[(r)--search] )); then
state=sync_search
fi
case $state in
sync_clean)
_arguments -s : \
{\*-c,\*--clean}'[Remove old packages from cache]' \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]"
;;
sync_group)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'(-g --group)'{-g,--groups} \
'*:package group:_pacman_completions_all_groups'
;;
sync_search)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:search text: '
;;
*)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_actions[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:package:_pacman_completions_all_packages'
;;
esac
}
# handles --upgrade subcommand
_pacman_action_upgrade() {
_arguments -s : \
'(-U --upgrade)'{-U,--upgrade} \
"$_pacman_opts_common[@]" \
"$_pacman_opts_pkgfile[@]"
}
# handles --version subcommand
_pacman_action_version() {
# no further arguments
return 0
}
# provides completions for package groups
_pacman_completions_all_groups() {
local -a cmd groups
_pacman_get_command
groups=( $(_call_program groups $cmd[@] -Sg) )
typeset -U groups
if [[ ${words[CURRENT-1]} == '--ignoregroup' ]]; then
_sequence compadd -S ',' "$@" -a groups
else
compadd "$@" -a groups
fi
}
# provides completions for packages available from repositories
# these can be specified as either 'package' or 'repository/package'
_pacman_completions_all_packages() {
local -a seq sep cmd packages repositories packages_long
if [[ ${words[CURRENT-1]} == '--ignore' ]]; then
seq='_sequence'
sep=(-S ',')
else
seq=
sep=()
fi
if compset -P1 '*/*'; then
packages=( $(_call_program packages yay -Pc ${words[CURRENT]%/*}) )
typeset -U packages
${seq} _wanted repo_packages expl "repository/package" compadd ${sep[@]} ${(@)packages}
else
packages=( $(_call_program packages yay -Pc ) )
typeset -U packages
${seq} _wanted packages expl "packages" compadd ${sep[@]} - "${(@)packages}"
repositories=($(pacman-conf --repo-list))
typeset -U repositories
_wanted repo_packages expl "repository/package" compadd -S "/" $repositories
fi
}
# provides completions for package groups
_pacman_completions_installed_groups() {
local -a cmd groups
_pacman_get_command
groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *})
typeset -U groups
compadd "$@" -a groups
}
# provides completions for installed packages
_pacman_completions_installed_packages() {
local -a cmd packages packages_long
packages_long=(/var/lib/pacman/local/*(/))
packages=( ${${packages_long#/var/lib/pacman/local/}%-*-*} )
compadd "$@" -a packages
}
_pacman_all_packages() {
_alternative : \
'localpkgs:local packages:_pacman_completions_installed_packages' \
'repopkgs:repository packages:_pacman_completions_all_packages'
}
# provides completions for repository names
_pacman_completions_repositories() {
local -a cmd repositories
repositories=($(pacman-conf --repo-list))
# Uniq the array
typeset -U repositories
compadd "$@" -a repositories
}
# builds command for invoking pacman in a _call_program command - extracts
# relevant options already specified (config file, etc)
# $cmd must be declared by calling function
_pacman_get_command() {
# this is mostly nicked from _perforce
cmd=( "pacman" "2>/dev/null")
integer i
for (( i = 2; i < CURRENT - 1; i++ )); do
if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then
cmd+=( ${words[i,i+1]} )
fi
done
}
# main dispatcher
_pacman_zsh_comp() {
local -a args cmds;
local tmp
args=( ${${${(M)words:#-*}#-}:#-*} )
for tmp in $words; do
cmds+=("${${_pacman_opts_commands[(r)*$tmp\[*]%%\[*}#*\)}")
done
case $args in #$words[2] in
h*)
if (( ${(c)#args} <= 1 && ${(w)#cmds} <= 1 )); then
_pacman_action_help
else
_message "no more arguments"
fi
;;
*h*)
_message "no more arguments"
;;
D*)
_pacman_action_database
;;
F*)
_pacman_action_files
;;
Q*g*) # ipkg groups
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:groups:_pacman_completions_installed_groups'
;;
Q*o*) # file
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files'
;;
Q*p*) # file *.pkg.tar*
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_query_modifiers[@]" \
'*:package file:_files -g "*.pkg.tar*~*.sig(.,@)"'
;;
Q*)
_pacman_action_query
;;
P*)
_arguments -s : \
'-P' \
"$_pacman_opts_print_modifiers[@]"
;;
W*)
_arguments -s : \
'-W' \
"$_pacman_opts_web_modifiers[@]"
;;
R*)
_pacman_action_remove
;;
S*c*) # no completion
_arguments -s : \
'(-c --clean)'{\*-c,\*--clean}'[Remove all files from the cache]' \
"$_pacman_opts_common[@]"
;;
S*l*) # repos
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:package repo:_pacman_completions_repositories' \
;;
S*g*) # pkg groups
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:package group:_pacman_completions_all_groups'
;;
S*s*)
_arguments -s : \
"$_pacman_opts_common[@]" \
"$_pacman_opts_sync_modifiers[@]" \
'*:search text: '
;;
S*)
_pacman_action_sync
;;
T*)
_pacman_action_deptest
;;
U*)
_pacman_action_upgrade
;;
V*)
_pacman_action_version
;;
Y*)
_arguments -s : \
'-Y' \
"$_pacman_opts_yay_modifiers[@]"
;;
G*)
_arguments -s : \
'-G' \
"$_pacman_opts_getpkgbuild_modifiers[@]"
;;
*)
case ${(M)words:#--*} in
*--help*)
if (( ${(w)#cmds} == 1 )); then
_pacman_action_help
else
return 0;
fi
;;
*--sync*)
_pacman_action_sync
;;
*--query*)
_pacman_action_query
;;
*--remove*)
_pacman_action_remove
;;
*--deptest*)
_pacman_action_deptest
;;
*--database*)
_pacman_action_database
;;
*--files*)
_pacman_action_files
;;
*--version*)
_pacman_action_version
;;
*--upgrade*)
_pacman_action_upgrade
;;
*)
_pacman_action_none
;;
esac
;;
esac
}
_pacman_comp() {
case "$service" in
yay)
_pacman_zsh_comp "$@"
;;
*)
_message "Error"
;;
esac
}
_pacman_comp "$@"

225
config.go
View File

@ -1,225 +0,0 @@
package main
import (
"bytes"
"encoding/json"
"fmt"
"os"
"os/exec"
alpm "github.com/jguer/go-alpm"
)
// Verbosity settings for search
const (
NumberMenu = iota
Detailed
Minimal
)
// Describes Sorting method for numberdisplay
const (
BottomUp = iota
TopDown
)
// Configuration stores yay's config.
type Configuration struct {
BuildDir string `json:"buildDir"`
Editor string `json:"editor"`
MakepkgBin string `json:"makepkgbin"`
PacmanBin string `json:"pacmanbin"`
PacmanConf string `json:"pacmanconf"`
TarBin string `json:"tarbin"`
ReDownload string `json:"redownload"`
GitBin string `json:"gitbin"`
MFlags string `json:"mflags"`
RequestSplitN int `json:"requestsplitn"`
SearchMode int `json:"-"`
SortMode int `json:"sortmode"`
SudoLoop bool `json:"sudoloop"`
TimeUpdate bool `json:"timeupdate"`
NoConfirm bool `json:"-"`
Devel bool `json:"devel"`
CleanAfter bool `json:"cleanAfter"`
}
var version = "3.373"
// configFileName holds the name of the config file.
const configFileName string = "config.json"
// vcsFileName holds the name of the vcs file.
const vcsFileName string = "vcs.json"
// completionFilePrefix holds the prefix used for storing shell completion files.
const completionFilePrefix string = "aur_"
// baseURL givers the AUR default address.
const baseURL string = "https://aur.archlinux.org"
// configHome handles config directory home
var configHome string
// cacheHome handles cache home
var cacheHome string
// savedInfo holds the current vcs info
var savedInfo vcsInfo
// configfile holds yay config file path.
var configFile string
// vcsfile holds yay vcs info file path.
var vcsFile string
// completion file
var completionFile string
// shouldSaveConfig holds whether or not the config should be saved
var shouldSaveConfig bool
// YayConf holds the current config values for yay.
var config Configuration
// AlpmConf holds the current config values for pacman.
var alpmConf alpm.PacmanConfig
// AlpmHandle is the alpm handle used by yay.
var alpmHandle *alpm.Handle
func readAlpmConfig(pacmanconf string) (conf alpm.PacmanConfig, err error) {
file, err := os.Open(pacmanconf)
if err != nil {
return
}
conf, err = alpm.ParseConfig(file)
if err != nil {
return
}
return
}
// SaveConfig writes yay config to file.
func (config *Configuration) saveConfig() error {
marshalledinfo, _ := json.MarshalIndent(config, "", "\t")
in, err := os.OpenFile(configFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
return err
}
defer in.Close()
_, err = in.Write(marshalledinfo)
if err != nil {
return err
}
err = in.Sync()
return err
}
func defaultSettings(config *Configuration) {
config.BuildDir = cacheHome + "/"
config.CleanAfter = false
config.Editor = ""
config.Devel = false
config.MakepkgBin = "makepkg"
config.NoConfirm = false
config.PacmanBin = "pacman"
config.PacmanConf = "/etc/pacman.conf"
config.MFlags = ""
config.SortMode = BottomUp
config.SudoLoop = false
config.TarBin = "bsdtar"
config.GitBin = "git"
config.TimeUpdate = false
config.RequestSplitN = 150
config.ReDownload = "no"
}
// Editor returns the preferred system editor.
func editor() string {
switch {
case config.Editor != "":
editor, err := exec.LookPath(config.Editor)
if err != nil {
fmt.Println(err)
} else {
return editor
}
fallthrough
case os.Getenv("EDITOR") != "":
editor, err := exec.LookPath(os.Getenv("EDITOR"))
if err != nil {
fmt.Println(err)
} else {
return editor
}
fallthrough
case os.Getenv("VISUAL") != "":
editor, err := exec.LookPath(os.Getenv("VISUAL"))
if err != nil {
fmt.Println(err)
} else {
return editor
}
fallthrough
default:
fmt.Println(bold(red("Warning:")),
bold(magenta("$EDITOR")), "is not set")
fmt.Println("Please add $EDITOR or to your environment variables.")
editorLoop:
fmt.Print(green("Edit PKGBUILD with:"))
var editorInput string
_, err := fmt.Scanln(&editorInput)
if err != nil {
fmt.Println(err)
goto editorLoop
}
editor, err := exec.LookPath(editorInput)
if err != nil {
fmt.Println(err)
goto editorLoop
}
return editor
}
}
// ContinueTask prompts if user wants to continue task.
//If NoConfirm is set the action will continue without user input.
func continueTask(s string, def string) (cont bool) {
if config.NoConfirm {
return true
}
var postFix string
if def == "nN" {
postFix = " [Y/n] "
} else {
postFix = " [y/N] "
}
var response string
fmt.Print(bold(green(arrow+" "+s+" ")), bold(postFix))
n, err := fmt.Scanln(&response)
if err != nil || n == 0 {
return true
}
if response == string(def[0]) || response == string(def[1]) {
return false
}
return true
}
func (config Configuration) String() string {
var buf bytes.Buffer
enc := json.NewEncoder(&buf)
enc.SetIndent("", "\t")
if err := enc.Encode(config); err != nil {
fmt.Println(err)
}
return buf.String()
}

View File

@ -1,411 +0,0 @@
package main
import (
"strings"
alpm "github.com/jguer/go-alpm"
rpc "github.com/mikkeloscar/aur"
)
type depTree struct {
ToProcess stringSet
Repo map[string]*alpm.Package
Aur map[string]*rpc.Pkg
Missing stringSet
}
type depCatagories struct {
Repo []*alpm.Package
Aur []*rpc.Pkg
MakeOnly stringSet
Bases map[string][]*rpc.Pkg
}
func makeDepTree() *depTree {
dt := depTree{
make(stringSet),
make(map[string]*alpm.Package),
make(map[string]*rpc.Pkg),
make(stringSet),
}
return &dt
}
func makeDependCatagories() *depCatagories {
dc := depCatagories{
make([]*alpm.Package, 0),
make([]*rpc.Pkg, 0),
make(stringSet),
make(map[string][]*rpc.Pkg),
}
return &dc
}
// Cut the version requirement from a dependency leaving just the name.
func getNameFromDep(dep string) string {
return strings.FieldsFunc(dep, func(c rune) bool {
return c == '>' || c == '<' || c == '='
})[0]
}
// Step two of dependency resolving. We already have all the information on the
// packages we need, now it's just about ordering them correctly.
// pkgs is a list of targets, the packages we want to install. Dependencies are
// not included.
// For each package we want we iterate down the tree until we hit the bottom.
// This is done recursively for each branch.
// The start of the tree is defined as the package we want.
// When we hit the bottom of the branch we know thats the first package
// we need to install so we add it to the start of the to install
// list (dc.Aur and dc.Repo).
// We work our way up until there is another branch to go down and do it all
// again.
//
// Here is a visual example:
//
// a
// / \
// b c
// / \
// d e
//
// We see a and it needs b and c
// We see b and it needs d and e
// We see d - it needs nothing so we add d to our list and move up
// We see e - it needs nothing so we add e to our list and move up
// We see c - it needs nothing so we add c to our list and move up
//
// The final install order would come out as debca
//
// There is a little more to this, handling provides, multiple packages wanting the
// same dependencies, etc. This is just the basic premise.
func getDepCatagories(pkgs []string, dt *depTree) (*depCatagories, error) {
dc := makeDependCatagories()
seen := make(stringSet)
for _, pkg := range dt.Aur {
_, ok := dc.Bases[pkg.PackageBase]
if !ok {
dc.Bases[pkg.PackageBase] = make([]*rpc.Pkg, 0)
}
dc.Bases[pkg.PackageBase] = append(dc.Bases[pkg.PackageBase], pkg)
}
for _, pkg := range pkgs {
dep := getNameFromDep(pkg)
alpmpkg, exists := dt.Repo[dep]
if exists {
repoDepCatagoriesRecursive(alpmpkg, dc, dt, false)
dc.Repo = append(dc.Repo, alpmpkg)
delete(dt.Repo, dep)
}
aurpkg, exists := dt.Aur[dep]
if exists {
depCatagoriesRecursive(aurpkg, dc, dt, false, seen)
if !seen.get(aurpkg.PackageBase) {
dc.Aur = append(dc.Aur, aurpkg)
seen.set(aurpkg.PackageBase)
}
delete(dt.Aur, dep)
}
}
for _, base := range dc.Bases {
for _, pkg := range base {
for _, dep := range pkg.Depends {
dc.MakeOnly.remove(dep)
}
}
}
for _, pkg := range dc.Repo {
pkg.Depends().ForEach(func(_dep alpm.Depend) error {
dep := _dep.Name
dc.MakeOnly.remove(dep)
return nil
})
}
for _, pkg := range pkgs {
dc.MakeOnly.remove(pkg)
}
dupes := make(map[*alpm.Package]struct{})
filteredRepo := make([]*alpm.Package, 0)
for _, pkg := range dc.Repo {
_, ok := dupes[pkg]
if ok {
continue
}
dupes[pkg] = struct{}{}
filteredRepo = append(filteredRepo, pkg)
}
dc.Repo = filteredRepo
return dc, nil
}
func repoDepCatagoriesRecursive(pkg *alpm.Package, dc *depCatagories, dt *depTree, isMake bool) {
pkg.Depends().ForEach(func(_dep alpm.Depend) error {
dep := _dep.Name
alpmpkg, exists := dt.Repo[dep]
if exists {
delete(dt.Repo, dep)
repoDepCatagoriesRecursive(alpmpkg, dc, dt, isMake)
if isMake {
dc.MakeOnly.set(alpmpkg.Name())
}
dc.Repo = append(dc.Repo, alpmpkg)
}
return nil
})
}
func depCatagoriesRecursive(_pkg *rpc.Pkg, dc *depCatagories, dt *depTree, isMake bool, seen stringSet) {
for _, pkg := range dc.Bases[_pkg.PackageBase] {
for _, deps := range [3][]string{pkg.Depends, pkg.MakeDepends, pkg.CheckDepends} {
for _, _dep := range deps {
dep := getNameFromDep(_dep)
aurpkg, exists := dt.Aur[dep]
if exists {
delete(dt.Aur, dep)
depCatagoriesRecursive(aurpkg, dc, dt, isMake, seen)
if !seen.get(aurpkg.PackageBase) {
dc.Aur = append(dc.Aur, aurpkg)
seen.set(aurpkg.PackageBase)
}
if isMake {
dc.MakeOnly.set(aurpkg.Name)
}
}
alpmpkg, exists := dt.Repo[dep]
if exists {
delete(dt.Repo, dep)
repoDepCatagoriesRecursive(alpmpkg, dc, dt, isMake)
if isMake {
dc.MakeOnly.set(alpmpkg.Name())
}
dc.Repo = append(dc.Repo, alpmpkg)
}
}
isMake = true
}
}
}
// This is step one for dependency resolving. pkgs is a slice of the packages you
// want to resolve the dependencies for. They can be a mix of aur and repo
// dependencies. All unmet dependencies will be resolved.
//
// For Aur dependencies depends, makedepends and checkdepends are resolved but
// for repo packages only depends are resolved as they are prebuilt.
// The return will be split into three catagories: Repo, Aur and Missing.
// The return is in no way ordered. This step is is just aimed at gathering the
// packages we need.
//
// This has been designed to make the least amount of rpc requests as possible.
// Web requests are probably going to be the bottleneck here so minimizing them
// provides a nice speed boost.
//
// Here is a visual expample of the request system.
// Remember only unsatisfied packages are requested, if a package is already
// installed we dont bother.
//
// a
// / \
// b c
// / \
// d e
//
// We see a so we send a request for a
// We see a wants b and c so we send a request for b and c
// We see d and e so we send a request for d and e
//
// Thats 5 packages in 3 requests. The amount of requests needed should always be
// the same as the height of the tree.
// The example does not really do this justice, In the real world where packages
// have 10+ dependencies each this is a very nice optimization.
func getDepTree(pkgs []string) (*depTree, error) {
dt := makeDepTree()
localDb, err := alpmHandle.LocalDb()
if err != nil {
return dt, err
}
syncDb, err := alpmHandle.SyncDbs()
if err != nil {
return dt, err
}
for _, pkg := range pkgs {
// If they explicitly asked for it still look for installed pkgs
/*installedPkg, isInstalled := localDb.PkgCache().FindSatisfier(pkg)
if isInstalled == nil {
dt.Repo[installedPkg.Name()] = installedPkg
continue
}//*/
// Check the repos for a matching dep
repoPkg, inRepos := syncDb.FindSatisfier(pkg)
if inRepos == nil {
repoTreeRecursive(repoPkg, dt, localDb, syncDb)
continue
}
_, isGroup := syncDb.PkgCachebyGroup(pkg)
if isGroup == nil {
continue
}
dt.ToProcess.set(pkg)
}
err = depTreeRecursive(dt, localDb, syncDb, false)
return dt, err
}
// Takes a repo package,
// gives all of the non installed deps,
// repeats on each sub dep.
func repoTreeRecursive(pkg *alpm.Package, dt *depTree, localDb *alpm.Db, syncDb alpm.DbList) (err error) {
_, exists := dt.Repo[pkg.Name()]
if exists {
return
}
dt.Repo[pkg.Name()] = pkg
(*pkg).Provides().ForEach(func(dep alpm.Depend) (err error) {
dt.Repo[dep.Name] = pkg
return nil
})
(*pkg).Depends().ForEach(func(dep alpm.Depend) (err error) {
_, exists := dt.Repo[dep.Name]
if exists {
return
}
_, isInstalled := localDb.PkgCache().FindSatisfier(dep.String())
if isInstalled == nil {
return
}
repoPkg, inRepos := syncDb.FindSatisfier(dep.String())
if inRepos == nil {
repoTreeRecursive(repoPkg, dt, localDb, syncDb)
return
}
dt.Missing.set(dep.String())
return
})
return
}
func depTreeRecursive(dt *depTree, localDb *alpm.Db, syncDb alpm.DbList, isMake bool) (err error) {
if len(dt.ToProcess) == 0 {
return
}
nextProcess := make(stringSet)
currentProcess := make(stringSet)
// Strip version conditions
for dep := range dt.ToProcess {
currentProcess.set(getNameFromDep(dep))
}
// Assume toprocess only contains aur stuff we have not seen
info, err := aurInfo(currentProcess.toSlice())
if err != nil {
return
}
// Cache the results
for _, pkg := range info {
// Copying to p fixes a bug.
// Would rather not copy but cant find another way to fix.
p := pkg
dt.Aur[pkg.Name] = &p
}
// Loop through to process and check if we now have
// each packaged cached.
// If not cached, we assume it is missing.
for pkgName := range currentProcess {
pkg, exists := dt.Aur[pkgName]
// Did not get it in the request.
if !exists {
dt.Missing.set(pkgName)
continue
}
// for each dep and makedep
for _, deps := range [3][]string{pkg.Depends, pkg.MakeDepends, pkg.CheckDepends} {
for _, versionedDep := range deps {
dep := getNameFromDep(versionedDep)
_, exists = dt.Aur[dep]
// We have it cached so skip.
if exists {
continue
}
_, exists = dt.Repo[dep]
// We have it cached so skip.
if exists {
continue
}
_, exists = dt.Missing[dep]
// We know it does not resolve so skip.
if exists {
continue
}
// Check if already installed.
_, isInstalled := localDb.PkgCache().FindSatisfier(versionedDep)
if isInstalled == nil {
continue
}
// Check the repos for a matching dep.
repoPkg, inRepos := syncDb.FindSatisfier(versionedDep)
if inRepos == nil {
repoTreeRecursive(repoPkg, dt, localDb, syncDb)
continue
}
// If all else fails add it to next search.
nextProcess.set(versionedDep)
}
}
}
dt.ToProcess = nextProcess
depTreeRecursive(dt, localDb, syncDb, true)
return
}

599
doc/yay.8 Normal file
View File

@ -0,0 +1,599 @@
.TH "YAY" "8" "2019\-10\-21" "Yay v12.0+" "Yay Manual"
.nh
.ad l
.SH NAME
yay \- AUR Helper written in go
.SH SYNOPSIS
\fIyay\fR <operation> [options] [targets]
.sp
\fIyay\fR <search terms>
.sp
\fIyay\fR
.SH DESCRIPTION
Yay is a Pacman wrapper with AUR support. It passes options to Makepkg and
Pacman after resolving packages to install/upgrade.
This manpage only covers options unique to Yay. For other options see
\fBpacman(8)\fR.
.SH YAY OPERATIONS
.TP
.B \-Y, \-\-yay
Perform yay specific operations. This is the default if no other operation is
selected and targets are defined.
.TP
.B \-B, \-\-build
Build a PKGBUILD in a given directory.
.TP
.B \-P, \-\-show
Perform yay specific print operations.
.TP
.B \-G, \-\-getpkgbuild
Downloads PKGBUILD from ABS or AUR. The ABS can only be used for Arch Linux repositories.
.TP
.B \-W, \-\-web
Web related operations such as voting for AUR packages.
.RE
If no operation is specified 'yay \-Syu' will be performed
If no operation is specified and targets are provided \-Y will be assumed
.SH EXTENDED PACMAN OPERATIONS
.TP
.B \-S, \-Si, \-Sl, \-Ss, \-Su, \-Sc, \-Qu
These operations are extended to support both AUR and repo packages.
.TP
.B \-Sc
Yay will also clean cached AUR package and any untracked Files in the
cache. Cleaning untracked files will wipe any downloaded sources or
built packages but will keep already downloaded vcs sources.
.TP
.B \-R
Yay will also remove cached data about devel packages.
.SH NEW OPTIONS
.TP
.B \-N, \-\-repo
Assume all targets are from the repositories. Additionally Actions such as
sysupgrade will only act on repository packages.
.TP
.B \-a, \-\-aur
Assume all targets are from the AUR. Additionally Actions such as
sysupgrade will only act on AUR packages.
Note that dependency resolving will still act normally and include repository
packages.
.SH YAY OPTIONS (APPLY TO \-Y AND \-\-YAY)
.TP
.B <NO OPTION>
Displays a list of packages matching the search terms and prompts the user on
which packages to install (yogurt mode).
The first search term is used to query the different sources and
the following search terms are used to narrow the search results
through exact matching.
.TP
.B \-\-gendb
Generate development package database. Tracks the latest commit for each
development package, when there is a new commit Yay will know to update. This
is done per package whenever a package is synced. This option should only be
used when migrating to Yay from another AUR helper.
.TP
.B \-c, \-\-clean
Remove unneeded dependencies.
.TP
.B \-cc
Remove unneeded dependencies, including packages optionally required by any other package.
.SH SHOW OPTIONS (APPLY TO \-P AND \-\-show)
.TP
.B \-c, \-\-complete
Print a list of all AUR and repo packages. This allows shell completion
and is not intended to be used directly by the user.
.TP
.B \-d, \-\-defaultconfig
Print default yay configuration.
.TP
.B \-g, \-\-currentconfig
Print current yay configuration.
.TP
.B \-s, \-\-stats
Displays information about installed packages and system health. If there are
orphaned, or out\-of\-date packages, or packages that no longer exist on the
AUR; warnings will be displayed.
.TP
.B \-w, \-\-news
Print new news from the Archlinux homepage. News is considered new if it is
newer than the build date of all native packages. Pass this twice to show all
available news.
.TP
.B \-q, \-\-quiet
Only show titles when printing news.
.SH BUILD OPTIONS (APPLY TO \-B AND \-\-build)
.TP
.B \-i, \-\-install
Build and install a PKGBUILD in a given directory
.SH GETPKGBUILD OPTIONS (APPLY TO \-G AND \-\-getpkgbuild)
.TP
.B \-f, \-\-force
Force download for ABS packages that already exist in the current directory. This
ensures directories are not accidentally overwritten.
.TP
.B \-p, \-\-print
Prints the PKGBUILD of the given packages to stdout.
.SH WEB OPTIONS (APPLY TO \-W AND \-\-web)
.TP
Web related operations such as voting for AUR packages.
Requires setting AUR_USERNAME and AUR_PASSWORD environment variables.
.TP
.B \-u, \-\-unvote
Remove vote from AUR package(s)
.TP
.B \-v, \-\-vote
Vote for AUR package(s)
.SH PERMANENT CONFIGURATION SETTINGS
.TP
.B \-\-save
Causes the following options to be saved back to the config file. This
provides an easy way to change config options without directly editing the
file.
.TP
.B \-\-aururl
Set an alternative AUR URL.
.TP
.B \-\-aurrpcurl
Set an alternative URL for the AUR /rpc endpoint.
.TP
.B \-\-builddir <dir>
Directory to use for Building AUR Packages. This directory is also used as
the AUR cache when deciding if Yay should skip builds.
.TP
.B \-\-editor <command>
Editor to use when editing PKGBUILDs. If this is not set the \fBVISUAL\fR
environment variable will be checked, followed by \fBEDITOR\fR. If none of
these are set Yay will prompt the user for an editor.
.TP
.B \-\-editorflags <flags>
Passes arguments to the editor. These flags get passed to every instance where
the editor is called by Yay. Arguments are split on whitespace before being
passed to the editor. Multiple arguments may be passed by supplying a space
separated list that is quoted by the shell.
.TP
.B \-\-makepkg <command>
The command to use for \fBmakepkg\fR calls. This can be a command in
\fBPATH\fR or an absolute path to the file.
.TP
.B \-\-pacman <command>
The command to use for \fBpacman\fR calls. This can be a command in
\fBPATH\fR or an absolute path to the file.
.TP
.B \-\-tar <command>
The command to use for \fBbsdtar\fR calls. This can be a command in
\fBPATH\fR or an absolute path to the file.
.TP
.B \-\-git <command>
The command to use for \fBgit\fR calls. This can be a command in
\fBPATH\fR or an absolute path to the file.
.TP
.B \-\-gpg <command>
The command to use for \fBgpg\fR calls. This can be a command in
\fBPATH\fR or an absolute path to the file.
.TP
.B \-\-config <file>
The pacman config file to use.
.TP
.B \-\-makepkgconf <file>
The config file for makepkg to use\%. If this is not set then the default
config file will be used.
.TP
.B \-\-nomakepkgconf
Reset the makepkg config file back to its default.
.TP
.B \-\-requestsplitn <number>
The maximum amount of packages to request per AUR query. The higher the
number the faster AUR requests will be. Requesting too many packages in one
AUR query will cause an error. This should only make a noticeable difference
with very large requests (>500) packages.
.TP
.B \-\-completioninterval <days>
Time in days to refresh the completion cache. Setting this to 0 will cause
the cache to be refreshed every time, while setting this to -1 will cause the
cache to never be refreshed.
.TP
.B \-\-sortby <votes|popularity|id|baseid|name|base|submitted|modified>
Sort AUR results by a specific field during search.
.TP
.B \-\-searchby <name|name-desc|maintainer|depends|checkdepends|makedepends|optdepends|provides|conflicts|replaces|groups|keywords|comaintainers>
Search for AUR packages by querying the specified field.
.TP
.B \-\-answerclean <All|None|Installed|NotInstalled|...>
Set a predetermined answer for the clean build menu question. This answer
will be used instead of reading from standard input but will be parsed exactly
the same.
.TP
.B \-\-answerdiff <All|None|Installed|NotInstalled|...>
Set a predetermined answer for the edit diff menu question. This answer
will be used instead of reading from standard input but will be parsed exactly
the same.
.TP
.B \-\-answeredit <All|None|Installed|NotInstalled|...>
Set a predetermined answer for the edit pkgbuild menu question. This answer
will be used instead of reading from standard input but will be parsed exactly
the same.
.TP
.B \-\-answerupgrade <Repo|^Repo|None|...>
Set a predetermined answer for the upgrade menu question. Selects which package
ranges or repos to omit for updates. This answer will be used instead of
reading from standard input but will be treated exactly the same.
.TP
.B \-\-noanswerclean
Unset the answer for the clean build menu.
.TP
.B \-\-noanswerdiff
Unset the answer for the diff menu.
.TP
.B \-\-noansweredit
Unset the answer for the edit pkgbuild menu.
.TP
.B \-\-noanswerupgrade
Unset the answer for the upgrade menu.
.TP
.B \-\-cleanmenu
Show the clean menu. This menu gives you the chance to fully delete the
downloaded build files from Yay's cache before redownloading a fresh copy.
If 'cleanmenu' is enabled in the configuration file, you can temporarily disable it by
using '--cleanmenu=false' on the command line
.TP
.B \-\-diffmenu
Show the diff menu. This menu gives you the option to view diffs from
build files before building.
Diffs are shown via \fBgit diff\fR which uses
less by default. This behaviour can be changed via git's config, the
\fB$GIT_PAGER\fR or \fB$PAGER\fR environment variables.
.TP
.B \-\-editmenu
Show the edit menu. This menu gives you the option to edit or view PKGBUILDs
before building.
\fBWarning\fR: Yay resolves dependencies ahead of time via the RPC. It is not
recommended to edit pkgbuild variables unless you know what you are doing.
.TP
.B \-\-askremovemake
Ask to remove makedepends after installing packages.
.TP
.B \-\-askyesremovemake
Ask to remove makedepends after installing packages(with "Y" as default).
.TP
.B \-\-removemake
Remove makedepends after installing packages.
.TP
.B \-\-noremovemake
Do not remove makedepends after installing packages.
.TP
.B \-\-topdown
Display repository packages first and then AUR packages.
.TP
.B \-\-bottomup
Show AUR packages first and then repository packages.
.TP
.B \-\-singlelineresults
Override pacman's usual double-line search result format and list each result
on its own line.
.TP
.B \-\-doublelineresults
Follow pacman's double-line search result format and list each result using
two lines.
.TP
.B \-\-devel
During sysupgrade also check AUR development packages for updates. Currently
only Git packages are supported.
Devel checking is done using \fBgit ls-remote\fR. The newest commit hash is
compared against the hash at install time. This allows devel updates to be
checked almost instantly and not require the original pkgbuild to be downloaded.
The slower pacaur-like devel checks can be implemented manually by piping
a list of packages into yay (see \fBexamples\fR).
If 'devel' is enabled in the configuration file, you can temporarily disable it by
using '--devel=false' on the command line
.TP
.B \-\-cleanafter
Remove untracked files after installation.
Untracked files are removed with the exception of directories.
This allows VCS packages to easily pull an update
instead of having to reclone the entire repo.
.TP
.B \-\-keepsrc
Keep pkg/ and src/ after building packages
.TP
.B \-\-timeupdate
During sysupgrade also compare the build time of installed packages against
the last modification time of each package's AUR page.
.TP
.B \-\-separatesources
Separate query results by source, AUR and sync
.TP
.B \-\-redownload
Always download pkgbuilds of targets even when a copy is available in cache.
.TP
.B \-\-redownloadall
Always download pkgbuilds of all AUR packages even when a copy is available
in cache.
.TP
.B \-\-noredownload
When downloading pkgbuilds if the pkgbuild is found in cache and is equal or
newer than the AUR's version use that instead of downloading a new one.
.TP
.B \-\-provides
Look for matching providers when searching for AUR packages. When multiple
providers are found a menu will appear prompting you to pick one. This
increases dependency resolve time although this should not be noticeable.
.TP
.B \-\-pgpfetch
Prompt to import unknown PGP keys from the \fBvalidpgpkeys\fR field of each
PKGBUILD.
.TP
.B \-\-useask
Use pacman's --ask flag to automatically confirm package conflicts. Yay lists
conflicts ahead of time. It is possible that Yay does not detect
a conflict, causing a package to be removed without the user's confirmation.
However, this is very unlikely.
.TP
.B \-\-combinedupgrade
During sysupgrade, Yay will first perform a refresh, then show
its combined menu of repo and AUR packages that will be upgraded. Then after
reviewing the pkgbuilds, the repo and AUR upgrade will start with no need
for manual intervention.
If Yay exits for any reason After the refresh without upgrading. It is then
the user's responsibility to either resolve the reason Yay exited or run
a sysupgrade through pacman directly.
.TP
.B \-\-batchinstall
When building and installing AUR packages instead of installing each package
after building, queue each package for install. Then once either all packages
are built or a package in the build queue is needed as a dependency to build
another package, install all the packages in the install queue.
.TP
.B \-\-rebuild
Always build target packages even when a copy is available in cache.
.TP
.B \-\-rebuildall
Always build all AUR packages even when a copy is available
in cache.
.TP
.B \-\-rebuildtree
When installing an AUR package rebuild and reinstall all of its AUR
dependencies recursively, even the ones already installed. This flag allows
you to easily rebuild packages against your current system's libraries if they
have become incompatible.
.TP
.B \-\-norebuild
When building packages if the package is found in cache and is an equal version
to the one wanted skip the package build and use the existing package.
.TP
.B \-\-mflags <flags>
Passes arguments to makepkg. These flags get passed to every instance where
makepkg is called by Yay. Arguments are split on whitespace before being
passed to makepkg. Multiple arguments may be passed by supplying a space
separated list that is quoted by the shell.
.TP
.B \-\-gpgflags <flags>
Passes arguments to gpg. These flags get passed to every instance where
gpg is called by Yay. Arguments are split on whitespace before being
passed to gpg. Multiple arguments may be passed by supplying a space
separated list that is quoted by the shell.
.TP
.B \-\-sudo <command>
The command to use for \fBsudo\fR calls. This can be a command in
\fBPATH\fR or an absolute path to the file.
The sudoloop is not guaranteed to work with a custom \fBsudo\fR command.
.TP
.B \-\-sudoflags <flags>
Passes arguments to sudo. These flags get passed to every instance where
sudo is called by Yay. Arguments are split on whitespace before being
passed to sudo. Multiple arguments may be passed by supplying a space
separated list that is quoted by the shell.
.TP
.B \-\-sudoloop
Loop sudo calls in the background to prevent sudo from timing out during long
builds.
.SH EXAMPLES
.TP
yay \fIfoo\fR
Search and install from the repos and the \fBAUR\fR\ using yogurt mode.
.TP
yay \-Syu
Update package list and upgrade all currently installed repo and \fBAUR\fR.
.TP
yay \-Sua
Update all currently installed \fBAUR\fR packages.
.TP
yay \-S \fIfoo\fR
Installs package \fIfoo\fR from the repos or the \fBAUR\fR.
.TP
yay \-Ss \fIfoo\fR
Searches for package \fIfoo\fR on the repos or the \fBAUR\fR.
.TP
yay \-Si \fIfoo\fR
Gets information about package \fIfoo\fR from the repos or the \fBAUR\fR.
.TP
yay \-S \fIfoo\fR \-\-mflags "\-\-skipchecksums \-\-skippgpcheck"
Installs \fIfoo\fR while skipping checksums and pgp checks.
.TP
yay \-\-devel \-\-save
Sets devel to true in the config.
.TP
yay \-P \-\-stats
Shows statistics for installed packages and system health.
.TP
pacman -Qmq | grep -Ee '-(cvs|svn|git|hg|bzr|darcs)$' | yay -S --needed -
pacaur-like devel check.
.SH ENVIRONMENT VARIABLES
.TP
.B AURDEST
Can be set to configure the build directory.
Overridden by \-\-builddir.
.TP
.B VISUAL, EDITOR
When editor is not configured, use these variables to pick what editor
to use when editing PKGBUILDS.
.SH FILES
.TP
.B CONFIG DIRECTORY
The config directory is \fI$XDG_CONFIG_HOME/yay/\fR. If
\fB$XDG_CONFIG_HOME\fR is unset, the config directory will fall back to
\fI$HOME/.config/yay\fR.
\fIconfig.json\fR Is used to store all of Yay's config options. Editing
this file should be done through Yay, using the options
mentioned in \fBPERMANENT CONFIGURATION SETTINGS\fR.
.TP
.B CACHE DIRECTORY
The cache directory is \fI$XDG_CACHE_HOME/yay/\fR. If
\fB$XDG_CACHE_HOME\fR is unset, the cache directory will fall back to
\fI$HOME/.cache/yay\fR.
\fIcompletion.cache\fR holds a list of of all packages, including the AUR,
for shell completion. By default the completion files are refreshed every
7 days.
\fIvcs.json\fR tracks VCS packages and the latest commit of each source. If
any of these commits change the package will be upgraded during a devel update.
.TP
.B BUILD DIRECTORY
Unless otherwise set this should be the same as \fBCACHE DIRECTORY\fR. This
directory is used to store downloaded AUR Packages as well as any source files
and built packages from those packages.
.TP
.B PACMAN.CONF
Yay uses Pacman's config file to set certain pacman options either through
go\-alpm or Yay itself. Options inherited include most libalpm options and
pacman options.
Notably: \fBDatabases\fR, \fBColor\fR and \fB*Path/*Dir\fR options are used.
.SH SEE ALSO
.BR makepkg (8),
.BR makepkg.conf (5),
.BR PKGBUILD (5),
.BR pacman (8),
.BR pacman.conf (5)
See the arch wiki at https://wiki.archlinux.org/index.php/Arch_User_Repository for more info on the \fBAUR\fR.
.SH BUGS
Please report bugs to our GitHub page https://github.com/Jguer/yay
.SH AUTHORS
Jguer <joguer@proton.me>
.br
Morgan <morganamilo@archlinux.org>

View File

@ -1,137 +0,0 @@
package main
import (
"fmt"
"io"
"net/http"
"os"
"os/exec"
"strings"
)
func downloadFile(path string, url string) (err error) {
// Create the file
out, err := os.Create(path)
if err != nil {
return err
}
defer out.Close()
// Get the data
resp, err := http.Get(url)
if err != nil {
return err
}
defer resp.Body.Close()
// Writer the body to file
_, err = io.Copy(out, resp.Body)
return err
}
// DownloadAndUnpack downloads url tgz and extracts to path.
func downloadAndUnpack(url string, path string, trim bool) (err error) {
err = os.MkdirAll(path, 0755)
if err != nil {
return
}
tokens := strings.Split(url, "/")
fileName := tokens[len(tokens)-1]
tarLocation := path + fileName
defer os.Remove(tarLocation)
err = downloadFile(tarLocation, url)
if err != nil {
return
}
if trim {
err = exec.Command("/bin/sh", "-c",
config.TarBin+" --strip-components 2 --include='*/"+fileName[:len(fileName)-7]+"/trunk/' -xf "+tarLocation+" -C "+path).Run()
os.Rename(path+"trunk", path+fileName[:len(fileName)-7]) // kurwa
} else {
err = exec.Command(config.TarBin, "-xf", tarLocation, "-C", path).Run()
}
if err != nil {
return
}
return
}
func getPkgbuilds(pkgs []string) error {
//possibleAurs := make([]string, 0, 0)
wd, err := os.Getwd()
if err != nil {
return err
}
wd = wd + "/"
missing, err := getPkgbuildsfromABS(pkgs, wd)
if err != nil {
return err
}
err = getPkgbuildsfromAUR(missing, wd)
return err
}
// GetPkgbuild downloads pkgbuild from the ABS.
func getPkgbuildsfromABS(pkgs []string, path string) (missing []string, err error) {
dbList, err := alpmHandle.SyncDbs()
if err != nil {
return
}
nextPkg:
for _, pkgN := range pkgs {
for _, db := range dbList.Slice() {
pkg, err := db.PkgByName(pkgN)
if err == nil {
var url string
name := pkg.Base()
if name == "" {
name = pkg.Name()
}
if db.Name() == "core" || db.Name() == "extra" {
url = "https://projects.archlinux.org/svntogit/packages.git/snapshot/packages/" + name + ".tar.gz"
} else if db.Name() == "community" || db.Name() == "multilib" {
url = "https://projects.archlinux.org/svntogit/community.git/snapshot/community-packages/" + name + ".tar.gz"
} else {
fmt.Println(pkgN + " not in standard repositories")
continue nextPkg
}
errD := downloadAndUnpack(url, path, true)
if errD != nil {
fmt.Println(bold(magenta(pkg.Name())), bold(green(errD.Error())))
}
fmt.Println(bold(green(arrow)), bold(green("Downloaded")), bold(magenta(pkg.Name())), bold(green("from ABS")))
continue nextPkg
}
}
missing = append(missing, pkgN)
}
return
}
// GetPkgbuild downloads pkgbuild from the AUR.
func getPkgbuildsfromAUR(pkgs []string, dir string) (err error) {
aq, err := aurInfo(pkgs)
if err != nil {
return err
}
for _, pkg := range aq {
downloadAndUnpack(baseURL+aq[0].URLPath, dir, false)
fmt.Println(bold(green(arrow)), bold(green("Downloaded")), bold(magenta(pkg.Name)), bold(green("from AUR")))
}
return
}

9
errors.go Normal file
View File

@ -0,0 +1,9 @@
package main
import (
"errors"
"github.com/leonelquinteros/gotext"
)
var ErrPackagesNotFound = errors.New(gotext.Get("could not find all required packages"))

80
get.go Normal file
View File

@ -0,0 +1,80 @@
package main
import (
"context"
"fmt"
"net/http"
"os"
"strings"
"github.com/Jguer/aur"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/download"
"github.com/Jguer/yay/v12/pkg/runtime"
"github.com/Jguer/yay/v12/pkg/settings/parser"
"github.com/Jguer/yay/v12/pkg/text"
)
// yay -Gp.
func printPkgbuilds(dbExecutor download.DBSearcher, aurClient aur.QueryClient,
httpClient *http.Client, logger *text.Logger, targets []string,
mode parser.TargetMode, aurURL string,
) error {
pkgbuilds, err := download.PKGBUILDs(dbExecutor, aurClient, httpClient, logger, targets, aurURL, mode)
if err != nil {
logger.Errorln(err)
}
for target, pkgbuild := range pkgbuilds {
logger.Printf("\n\n# %s\n\n%s", target, string(pkgbuild))
}
if len(pkgbuilds) != len(targets) {
missing := []string{}
for _, target := range targets {
if _, ok := pkgbuilds[target]; !ok {
missing = append(missing, target)
}
}
logger.Warnln(gotext.Get("Unable to find the following packages:"), " ", strings.Join(missing, ", "))
return fmt.Errorf("")
}
return nil
}
// yay -G.
func getPkgbuilds(ctx context.Context, dbExecutor download.DBSearcher, aurClient aur.QueryClient,
run *runtime.Runtime, targets []string, force bool,
) error {
wd, err := os.Getwd()
if err != nil {
return err
}
cloned, errD := download.PKGBUILDRepos(ctx, dbExecutor, aurClient,
run.CmdBuilder, run.Logger, targets, run.Cfg.Mode, run.Cfg.AURURL, wd, force)
if errD != nil {
run.Logger.Errorln(errD)
}
if len(targets) != len(cloned) {
missing := []string{}
for _, target := range targets {
if _, ok := cloned[target]; !ok {
missing = append(missing, target)
}
}
run.Logger.Warnln(gotext.Get("Unable to find the following packages:"), " ", strings.Join(missing, ", "))
err = fmt.Errorf("")
}
return err
}

35
go.mod Normal file
View File

@ -0,0 +1,35 @@
module github.com/Jguer/yay/v12
require (
github.com/Jguer/aur v1.2.3
github.com/Jguer/go-alpm/v2 v2.2.2
github.com/Jguer/votar v1.0.0
github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5
github.com/Morganamilo/go-srcinfo v1.0.0
github.com/adrg/strutil v0.3.1
github.com/bradleyjkemp/cupaloy v2.3.0+incompatible
github.com/deckarep/golang-set/v2 v2.8.0
github.com/hashicorp/go-multierror v1.1.1
github.com/leonelquinteros/gotext v1.7.2
github.com/stretchr/testify v1.10.0
golang.org/x/net v0.41.0
golang.org/x/sys v0.33.0
golang.org/x/term v0.32.0
gopkg.in/h2non/gock.v1 v1.1.2
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/itchyny/gojq v0.12.17 // indirect
github.com/itchyny/timefmt-go v0.1.6 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/ohler55/ojg v1.26.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
go 1.23.5
toolchain go1.24.0

68
go.sum Normal file
View File

@ -0,0 +1,68 @@
github.com/Jguer/aur v1.2.3 h1:D+OGgLxnAnZnw88DsRvnRQsn0Poxsy9ng7pBcsA0krM=
github.com/Jguer/aur v1.2.3/go.mod h1:Dahvb6L1yr0rR7svyYSDwaRJoQMeyvJblwJ3QH/7CUs=
github.com/Jguer/go-alpm/v2 v2.2.2 h1:sPwUoZp1X5Tw6K6Ba1lWvVJfcgVNEGVcxARLBttZnC0=
github.com/Jguer/go-alpm/v2 v2.2.2/go.mod h1:lfe8gSe83F/KERaQvEfrSqQ4n+8bES+ZIyKWR/gm3MI=
github.com/Jguer/votar v1.0.0 h1:drPYpV5Py5BeAQS8xezmT6uCEfLzotNjLf5yfmlHKTg=
github.com/Jguer/votar v1.0.0/go.mod h1:rc6vgVlTqNjI4nAnPbDTbdxw/N7kXkbB8BcUDjeFbYQ=
github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5 h1:TMscPjkb1ThXN32LuFY5bEYIcXZx3YlwzhS1GxNpn/c=
github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5/go.mod h1:Hk55m330jNiwxRodIlMCvw5iEyoRUCIY64W1p9D+tHc=
github.com/Morganamilo/go-srcinfo v1.0.0 h1:Wh4nEF+HJWo+29hnxM18Q2hi+DUf0GejS13+Wg+dzmI=
github.com/Morganamilo/go-srcinfo v1.0.0/go.mod h1:MP6VGY1NNpVUmYIEgoM9acix95KQqIRyqQ0hCLsyYUY=
github.com/adrg/strutil v0.3.1 h1:OLvSS7CSJO8lBii4YmBt8jiK9QOtB9CzCzwl4Ic/Fz4=
github.com/adrg/strutil v0.3.1/go.mod h1:8h90y18QLrs11IBffcGX3NW/GFBXCMcNg4M7H6MspPA=
github.com/alexflint/go-arg v1.4.3/go.mod h1:3PZ/wp/8HuqRZMUUgu7I+e1qcpUbvmS258mRXkFH4IA=
github.com/alexflint/go-scalar v1.1.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
github.com/bradleyjkemp/cupaloy v2.3.0+incompatible h1:UafIjBvWQmS9i/xRg+CamMrnLTKNzo+bdmT/oH34c2Y=
github.com/bradleyjkemp/cupaloy v2.3.0+incompatible/go.mod h1:Au1Xw1sgaJ5iSFktEhYsS0dbQiS1B0/XMXl+42y9Ilk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckarep/golang-set/v2 v2.8.0 h1:swm0rlPCmdWn9mESxKOjWk8hXSqoxOp+ZlfuyaAdFlQ=
github.com/deckarep/golang-set/v2 v2.8.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/itchyny/gojq v0.12.17 h1:8av8eGduDb5+rvEdaOO+zQUjA04MS0m3Ps8HiD+fceg=
github.com/itchyny/gojq v0.12.17/go.mod h1:WBrEMkgAfAGO1LUcGOckBl5O726KPp+OlkKug0I/FEY=
github.com/itchyny/timefmt-go v0.1.6 h1:ia3s54iciXDdzWzwaVKXZPbiXzxxnv1SPGFfM/myJ5Q=
github.com/itchyny/timefmt-go v0.1.6/go.mod h1:RRDZYC5s9ErkjQvTvvU7keJjxUYzIISJGxm9/mAERQg=
github.com/leonelquinteros/gotext v1.7.2 h1:bDPndU8nt+/kRo1m4l/1OXiiy2v7Z7dfPQ9+YP7G1Mc=
github.com/leonelquinteros/gotext v1.7.2/go.mod h1:9/haCkm5P7Jay1sxKDGJ5WIg4zkz8oZKw4ekNpALob8=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
github.com/ohler55/ojg v1.26.1 h1:J5TaLmVEuvnpVH7JMdT1QdbpJU545Yp6cKiCO4aQILc=
github.com/ohler55/ojg v1.26.1/go.mod h1:gQhDVpQLqrmnd2eqGAvJtn+NfKoYJbe/A4Sj3/Vro4o=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -1,723 +0,0 @@
package main
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"os/exec"
"strconv"
"strings"
alpm "github.com/jguer/go-alpm"
rpc "github.com/mikkeloscar/aur"
gopkg "github.com/mikkeloscar/gopkgbuild"
)
// Install handles package installs
func install(parser *arguments) error {
removeMake := false
aurTargets, repoTargets, err := packageSlices(parser.targets.toSlice())
if err != nil {
return err
}
srcinfos := make(map[string]*gopkg.PKGBUILD)
var dc *depCatagories
//fmt.Println(green(arrow), green("Resolving Dependencies"))
requestTargets := append(aurTargets, repoTargets...)
//remotenames: names of all non repo packages on the system
_, _, _, remoteNames, err := filterPackages()
if err != nil {
return err
}
//cache as a stringset. maybe make it return a string set in the first
//place
remoteNamesCache := make(stringSet)
for _, name := range remoteNames {
remoteNamesCache.set(name)
}
//if we are doing -u also request every non repo package on the system
if parser.existsArg("u", "sysupgrade") {
requestTargets = append(requestTargets, remoteNames...)
}
if len(aurTargets) > 0 || parser.existsArg("u", "sysupgrade") && len(remoteNames) > 0 {
fmt.Println(bold(cyan("::") + " Querying AUR..."))
}
dt, err := getDepTree(requestTargets)
if err != nil {
return err
}
//only error if direct targets or deps are missing
for missingName := range dt.Missing {
if !remoteNamesCache.get(missingName) {
return fmt.Errorf(bold(red(arrow+" Error: ")) +
"Could not find all required package")
}
}
//create the arguments to pass for the repo install
arguments := parser.copy()
arguments.delArg("u", "sysupgrade")
arguments.delArg("y", "refresh")
arguments.op = "S"
arguments.targets = make(stringSet)
if parser.existsArg("u", "sysupgrade") {
repoUp, aurUp, err := upgradePkgs(dt)
if err != nil {
return err
}
fmt.Println()
for pkg := range aurUp {
parser.addTarget(pkg)
}
for pkg := range repoUp {
arguments.addTarget(pkg)
}
//discard stuff thats
//not a target and
//not an upgrade and
//is installed
for pkg := range dt.Aur {
if !parser.targets.get(pkg) && remoteNamesCache.get(pkg) {
delete(dt.Aur, pkg)
}
}
}
hasAur := len(dt.Aur) != 0
dc, err = getDepCatagories(parser.formatTargets(), dt)
if err != nil {
return err
}
for _, pkg := range dc.Repo {
arguments.addTarget(pkg.Name())
}
for _, pkg := range repoTargets {
arguments.addTarget(pkg)
}
if len(dc.Aur) == 0 && len(arguments.targets) == 0 {
fmt.Println("There is nothing to do")
return nil
}
if hasAur {
printDepCatagories(dc)
hasAur = len(dc.Aur) != 0
fmt.Println()
if !parser.existsArg("gendb") {
err = checkForConflicts(dc)
if err != nil {
return err
}
}
}
if !parser.existsArg("gendb") && len(arguments.targets) > 0 {
err := passToPacman(arguments)
if err != nil {
return fmt.Errorf("Error installing repo packages.")
}
depArguments := makeArguments()
depArguments.addArg("D", "asdeps")
for _, pkg := range dc.Repo {
depArguments.addTarget(pkg.Name())
}
for _, pkg := range repoTargets {
depArguments.delTarget(pkg)
}
if len(depArguments.targets) > 0 {
_, stderr, err := passToPacmanCapture(depArguments)
if err != nil {
return fmt.Errorf("%s%s", stderr, err)
}
}
}
if hasAur {
if len(dc.MakeOnly) > 0 {
if !continueTask("Remove make dependencies after install?", "yY") {
removeMake = true
}
}
toClean, toEdit, err := cleanEditNumberMenu(dc.Aur, dc.Bases, remoteNamesCache)
if err != nil {
return err
}
cleanBuilds(toClean)
err = downloadPkgBuilds(dc.Aur, parser.targets, dc.Bases)
if err != nil {
return err
}
if len(toEdit) > 0 {
err = editPkgBuilds(toEdit)
if err != nil {
return err
}
}
if len(toEdit) > 0 && !continueTask("Proceed with install?", "nN") {
return fmt.Errorf("Aborting due to user")
}
//conflicts have been checked so answer y for them
ask, _ := strconv.Atoi(cmdArgs.globals["ask"])
uask := alpm.Question(ask) | alpm.QuestionConflictPkg
cmdArgs.globals["ask"] = fmt.Sprint(uask)
//this downloads the package build sources but also causes
//a version bumb for vsc packages
//that should not edit the sources so we should be safe to skip
//it and parse the srcinfo at the current version
if arguments.existsArg("gendb") {
err = parsesrcinfosFile(dc.Aur, srcinfos, dc.Bases)
if err != nil {
return err
}
fmt.Println(bold(green(arrow + " GenDB finished. No packages were installed")))
return nil
}
err = downloadPkgBuildsSources(dc.Aur, dc.Bases)
if err != nil {
return err
}
err = parsesrcinfosGenerate(dc.Aur, srcinfos, dc.Bases)
if err != nil {
return err
}
err = buildInstallPkgBuilds(dc.Aur, srcinfos, parser.targets, parser, dc.Bases)
if err != nil {
return err
}
if len(dc.MakeOnly) > 0 {
if !removeMake {
return nil
}
removeArguments := makeArguments()
removeArguments.addArg("R", "u")
for pkg := range dc.MakeOnly {
removeArguments.addTarget(pkg)
}
oldValue := config.NoConfirm
config.NoConfirm = true
err = passToPacman(removeArguments)
config.NoConfirm = oldValue
if err != nil {
return err
}
}
if config.CleanAfter {
clean(dc.Aur)
}
return nil
}
return nil
}
func cleanEditNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed stringSet) ([]*rpc.Pkg, []*rpc.Pkg, error) {
toPrint := ""
askClean := false
toClean := make([]*rpc.Pkg, 0)
toEdit := make([]*rpc.Pkg, 0)
if config.NoConfirm {
return toClean, toEdit, nil
}
for n, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase + "/"
toPrint += fmt.Sprintf("%s %-40s", magenta(strconv.Itoa(len(pkgs)-n)),
bold(formatPkgbase(pkg, bases)))
if installed.get(pkg.Name) {
toPrint += bold(green(" (Installed)"))
}
if _, err := os.Stat(dir); !os.IsNotExist(err) {
toPrint += bold(green(" (Build Files Exist)"))
askClean = true
}
toPrint += "\n"
}
fmt.Print(toPrint)
if askClean {
fmt.Println(bold(green(arrow + " Packages to cleanBuild?")))
fmt.Println(bold(green(arrow) + cyan(" [N]one ") + green("[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)")))
fmt.Print(bold(green(arrow + " ")))
reader := bufio.NewReader(os.Stdin)
numberBuf, overflow, err := reader.ReadLine()
if err != nil {
return nil, nil, err
}
if overflow {
return nil, nil, fmt.Errorf("Input too long")
}
cleanInput := string(numberBuf)
cInclude, cExclude, cOtherInclude, cOtherExclude := parseNumberMenu(cleanInput)
cIsInclude := len(cExclude) == 0 && len(cOtherExclude) == 0
if cOtherInclude.get("abort") || cOtherInclude.get("ab") {
return nil, nil, fmt.Errorf("Aborting due to user")
}
if !cOtherInclude.get("n") && !cOtherInclude.get("none") {
for i, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase + "/"
if _, err := os.Stat(dir); os.IsNotExist(err) {
continue
}
if !cIsInclude && cExclude.get(len(pkgs)-i) {
continue
}
if installed.get(pkg.Name) && (cOtherInclude.get("i") || cOtherInclude.get("installed")) {
toClean = append(toClean, pkg)
continue
}
if !installed.get(pkg.Name) && (cOtherInclude.get("no") || cOtherInclude.get("notinstalled")) {
toClean = append(toClean, pkg)
continue
}
if cOtherInclude.get("a") || cOtherInclude.get("all") {
toClean = append(toClean, pkg)
continue
}
if cIsInclude && cInclude.get(len(pkgs)-i) {
toClean = append(toClean, pkg)
}
if !cIsInclude && !cExclude.get(len(pkgs)-i) {
toClean = append(toClean, pkg)
}
}
}
}
fmt.Println(bold(green(arrow + " PKGBUILDs to edit?")))
fmt.Println(bold(green(arrow) + cyan(" [N]one ") + green("[A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)")))
fmt.Print(bold(green(arrow + " ")))
reader := bufio.NewReader(os.Stdin)
numberBuf, overflow, err := reader.ReadLine()
if err != nil {
return nil, nil, err
}
if overflow {
return nil, nil, fmt.Errorf("Input too long")
}
editInput := string(numberBuf)
eInclude, eExclude, eOtherInclude, eOtherExclude := parseNumberMenu(editInput)
eIsInclude := len(eExclude) == 0 && len(eOtherExclude) == 0
if eOtherInclude.get("abort") || eOtherInclude.get("ab") {
return nil, nil, fmt.Errorf("Aborting due to user")
}
if !eOtherInclude.get("n") && !eOtherInclude.get("none") {
for i, pkg := range pkgs {
if !eIsInclude && eExclude.get(len(pkgs)-i) {
continue
}
if installed.get(pkg.Name) && (eOtherInclude.get("i") || eOtherInclude.get("installed")) {
toEdit = append(toEdit, pkg)
continue
}
if !installed.get(pkg.Name) && (eOtherInclude.get("no") || eOtherInclude.get("notinstalled")) {
toEdit = append(toEdit, pkg)
continue
}
if eOtherInclude.get("a") || eOtherInclude.get("all") {
toEdit = append(toEdit, pkg)
continue
}
if eIsInclude && eInclude.get(len(pkgs)-i) {
toEdit = append(toEdit, pkg)
}
if !eIsInclude && !eExclude.get(len(pkgs)-i) {
toEdit = append(toEdit, pkg)
}
}
}
return toClean, toEdit, nil
}
func askCleanBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) {
for _, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase + "/"
if _, err := os.Stat(dir); !os.IsNotExist(err) {
str := pkg.Name
if len(bases[pkg.PackageBase]) > 1 || pkg.PackageBase != pkg.Name {
str += " ("
for _, split := range bases[pkg.PackageBase] {
str += split.Name + " "
}
str = str[:len(str)-1] + ")"
}
if !continueTask(str+" Directory exists. Clean Build?", "yY") {
_ = os.RemoveAll(config.BuildDir + pkg.PackageBase)
}
}
}
}
func cleanBuilds(pkgs []*rpc.Pkg) {
for i, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase
fmt.Printf(bold(cyan("::")+" Deleting (%d/%d): %s\n"), i+1, len(pkgs), dir)
os.RemoveAll(dir)
}
}
func checkForConflicts(dc *depCatagories) error {
localDb, err := alpmHandle.LocalDb()
if err != nil {
return err
}
toRemove := make(map[string]stringSet)
for _, pkg := range dc.Aur {
for _, cpkg := range pkg.Conflicts {
if _, err := localDb.PkgByName(cpkg); err == nil {
_, ok := toRemove[pkg.Name]
if !ok {
toRemove[pkg.Name] = make(stringSet)
}
toRemove[pkg.Name].set(cpkg)
}
}
}
for _, pkg := range dc.Repo {
pkg.Conflicts().ForEach(func(conf alpm.Depend) error {
if _, err := localDb.PkgByName(conf.Name); err == nil {
_, ok := toRemove[pkg.Name()]
if !ok {
toRemove[pkg.Name()] = make(stringSet)
}
toRemove[pkg.Name()].set(conf.Name)
}
return nil
})
}
if len(toRemove) != 0 {
fmt.Println(
red("Package conflicts found:"))
for name, pkgs := range toRemove {
str := "\tInstalling " + magenta(name) + " will remove"
for pkg := range pkgs {
str += " " + magenta(pkg)
}
fmt.Println(str)
}
fmt.Println()
}
return nil
}
func askEditPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) error {
for _, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase + "/"
str := "Edit PKGBUILD? " + pkg.PackageBase
if len(bases[pkg.PackageBase]) > 1 || pkg.PackageBase != pkg.Name {
str += " ("
for _, split := range bases[pkg.PackageBase] {
str += split.Name + " "
}
str = str[:len(str)-1] + ")"
}
if !continueTask(str, "yY") {
editcmd := exec.Command(editor(), dir+"PKGBUILD")
editcmd.Stdin, editcmd.Stdout, editcmd.Stderr = os.Stdin, os.Stdout, os.Stderr
err := editcmd.Run()
if err != nil {
return fmt.Errorf("Editor did not exit successfully, Abotring: %s", err)
}
}
}
return nil
}
func editPkgBuilds(pkgs []*rpc.Pkg) error {
pkgbuilds := make([]string, 0, len(pkgs))
for _, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase + "/"
pkgbuilds = append(pkgbuilds, dir+"PKGBUILD")
}
editcmd := exec.Command(editor(), pkgbuilds...)
editcmd.Stdin, editcmd.Stdout, editcmd.Stderr = os.Stdin, os.Stdout, os.Stderr
err := editcmd.Run()
if err != nil {
return fmt.Errorf("Editor did not exit successfully, Abotring: %s", err)
}
return nil
}
func parsesrcinfosFile(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, bases map[string][]*rpc.Pkg) error {
for k, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase + "/"
str := bold(cyan("::") + " Parsing SRCINFO (%d/%d): %s\n")
fmt.Printf(str, k+1, len(pkgs), formatPkgbase(pkg, bases))
pkgbuild, err := gopkg.ParseSRCINFO(dir + ".SRCINFO")
if err != nil {
return fmt.Errorf("%s: %s", pkg.Name, err)
}
srcinfos[pkg.PackageBase] = pkgbuild
for _, pkg := range bases[pkg.PackageBase] {
updateVCSData(pkg.Name, pkgbuild.Source)
}
}
return nil
}
func parsesrcinfosGenerate(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, bases map[string][]*rpc.Pkg) error {
for k, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase + "/"
str := bold(cyan("::") + " Parsing SRCINFO (%d/%d): %s\n")
fmt.Printf(str, k+1, len(pkgs), formatPkgbase(pkg, bases))
cmd := exec.Command(config.MakepkgBin, "--printsrcinfo")
cmd.Stderr = os.Stderr
cmd.Dir = dir
srcinfo, err := cmd.Output()
if err != nil {
return err
}
pkgbuild, err := gopkg.ParseSRCINFOContent(srcinfo)
if err != nil {
return fmt.Errorf("%s: %s", pkg.Name, err)
}
srcinfos[pkg.PackageBase] = pkgbuild
}
return nil
}
func downloadPkgBuilds(pkgs []*rpc.Pkg, targets stringSet, bases map[string][]*rpc.Pkg) error {
for k, pkg := range pkgs {
if config.ReDownload == "no" || (config.ReDownload == "yes" && !targets.get(pkg.Name)) {
dir := config.BuildDir + pkg.PackageBase + "/.SRCINFO"
pkgbuild, err := gopkg.ParseSRCINFO(dir)
if err == nil {
version, err := gopkg.NewCompleteVersion(pkg.Version)
if err == nil {
if !version.Newer(pkgbuild.Version()) {
str := bold(cyan("::") + " PKGBUILD up to date, Skipping (%d/%d): %s\n")
fmt.Printf(str, k+1, len(pkgs), formatPkgbase(pkg, bases))
continue
}
}
}
}
str := bold(cyan("::") + " Downloading PKGBUILD (%d/%d): %s\n")
fmt.Printf(str, k+1, len(pkgs), formatPkgbase(pkg, bases))
err := downloadAndUnpack(baseURL+pkg.URLPath, config.BuildDir, false)
if err != nil {
return err
}
}
return nil
}
func downloadPkgBuildsSources(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) (err error) {
for _, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase + "/"
err = passToMakepkg(dir, "--nobuild", "--nocheck", "--noprepare", "--nodeps")
if err != nil {
return fmt.Errorf("Error downloading sources: %s", formatPkgbase(pkg, bases))
}
}
return
}
func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, targets stringSet, parser *arguments, bases map[string][]*rpc.Pkg) error {
for _, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase + "/"
built := true
srcinfo := srcinfos[pkg.PackageBase]
version := srcinfo.CompleteVersion()
for _, split := range bases[pkg.PackageBase] {
file, err := completeFileName(dir, split.Name+"-"+version.String())
if err != nil {
return err
}
if file == "" {
built = false
}
}
if built {
fmt.Println(bold(red(arrow+" Warning:")),
pkg.Name+"-"+pkg.Version+" Already made -- skipping build")
} else {
err := passToMakepkg(dir, "-Ccf", "--noconfirm")
if err != nil {
return fmt.Errorf("Error making: %s", pkg.Name)
}
}
arguments := parser.copy()
arguments.targets = make(stringSet)
arguments.op = "U"
arguments.delArg("confirm")
arguments.delArg("c", "clean")
arguments.delArg("q", "quiet")
arguments.delArg("q", "quiet")
arguments.delArg("y", "refresh")
arguments.delArg("u", "sysupgrade")
arguments.delArg("w", "downloadonly")
depArguments := makeArguments()
depArguments.addArg("D", "asdeps")
for _, split := range bases[pkg.PackageBase] {
file, err := completeFileName(dir, split.Name+"-"+version.String())
if err != nil {
return err
}
if file == "" {
return fmt.Errorf("Could not find built package " + split.Name + "-" + version.String())
}
arguments.addTarget(file)
if !targets.get(split.Name) {
depArguments.addTarget(split.Name)
}
}
oldConfirm := config.NoConfirm
config.NoConfirm = true
err := passToPacman(arguments)
if err != nil {
return err
}
for _, pkg := range bases[pkg.PackageBase] {
updateVCSData(pkg.Name, srcinfo.Source)
}
if len(depArguments.targets) > 0 {
_, stderr, err := passToPacmanCapture(depArguments)
if err != nil {
return fmt.Errorf("%s%s", stderr, err)
}
}
config.NoConfirm = oldConfirm
}
return nil
}
func clean(pkgs []*rpc.Pkg) {
for _, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase + "/"
fmt.Println(bold(green(arrow +
" CleanAfter enabled. Deleting " + pkg.Name + " source folder.")))
os.RemoveAll(dir)
}
}
func completeFileName(dir, name string) (string, error) {
files, err := ioutil.ReadDir(dir)
if err != nil {
return "", err
}
for _, file := range files {
if file.IsDir() {
continue
}
if strings.HasPrefix(file.Name(), name) {
return dir + file.Name(), nil
}
}
return "", nil
}

108
local_install.go Normal file
View File

@ -0,0 +1,108 @@
// Experimental code for install local with dependency refactoring
// Not at feature parity with install.go
package main
import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/Jguer/yay/v12/pkg/db"
"github.com/Jguer/yay/v12/pkg/dep"
"github.com/Jguer/yay/v12/pkg/multierror"
"github.com/Jguer/yay/v12/pkg/runtime"
"github.com/Jguer/yay/v12/pkg/settings"
"github.com/Jguer/yay/v12/pkg/settings/exe"
"github.com/Jguer/yay/v12/pkg/settings/parser"
"github.com/Jguer/yay/v12/pkg/sync"
gosrc "github.com/Morganamilo/go-srcinfo"
"github.com/leonelquinteros/gotext"
)
var ErrNoBuildFiles = errors.New(gotext.Get("cannot find PKGBUILD and .SRCINFO in directory"))
func srcinfoExists(ctx context.Context,
cmdBuilder exe.ICmdBuilder, targetDir string,
) error {
srcInfoDir := filepath.Join(targetDir, ".SRCINFO")
pkgbuildDir := filepath.Join(targetDir, "PKGBUILD")
if _, err := os.Stat(srcInfoDir); err == nil {
if _, err := os.Stat(pkgbuildDir); err == nil {
return nil
}
}
if _, err := os.Stat(pkgbuildDir); err == nil {
// run makepkg to generate .SRCINFO
srcinfo, stderr, err := cmdBuilder.Capture(cmdBuilder.BuildMakepkgCmd(ctx, targetDir, "--printsrcinfo"))
if err != nil {
return fmt.Errorf("unable to generate .SRCINFO: %w - %s", err, stderr)
}
if srcinfo == "" {
return fmt.Errorf("generated .SRCINFO is empty, check your PKGBUILD for errors")
}
if err := os.WriteFile(srcInfoDir, []byte(srcinfo), 0o600); err != nil {
return fmt.Errorf("unable to write .SRCINFO: %w", err)
}
return nil
}
return fmt.Errorf("%w: %s", ErrNoBuildFiles, targetDir)
}
func installLocalPKGBUILD(
ctx context.Context,
run *runtime.Runtime,
cmdArgs *parser.Arguments,
dbExecutor db.Executor,
) error {
aurCache := run.AURClient
noCheck := strings.Contains(run.Cfg.MFlags, "--nocheck")
if len(cmdArgs.Targets) < 1 {
return errors.New(gotext.Get("no target directories specified"))
}
srcInfos := map[string]*gosrc.Srcinfo{}
for _, targetDir := range cmdArgs.Targets {
if err := srcinfoExists(ctx, run.CmdBuilder, targetDir); err != nil {
return err
}
pkgbuild, err := gosrc.ParseFile(filepath.Join(targetDir, ".SRCINFO"))
if err != nil {
return fmt.Errorf("%s: %w", gotext.Get("failed to parse .SRCINFO"), err)
}
srcInfos[targetDir] = pkgbuild
}
grapher := dep.NewGrapher(dbExecutor, aurCache, false, settings.NoConfirm,
cmdArgs.ExistsDouble("d", "nodeps"), noCheck, cmdArgs.ExistsArg("needed"),
run.Logger.Child("grapher"))
graph, err := grapher.GraphFromSrcInfos(ctx, nil, srcInfos)
if err != nil {
return err
}
opService := sync.NewOperationService(ctx, dbExecutor, run)
multiErr := &multierror.MultiError{}
targets := graph.TopoSortedLayerMap(func(name string, ii *dep.InstallInfo) error {
if ii.Source == dep.Missing {
multiErr.Add(fmt.Errorf("%w: %s %s", ErrPackagesNotFound, name, ii.Version))
}
return nil
})
if err := multiErr.Return(); err != nil {
return err
}
return opService.Run(ctx, run, cmdArgs, targets, []string{})
}

1019
local_install_test.go Normal file

File diff suppressed because it is too large Load Diff

154
main.go Normal file
View File

@ -0,0 +1,154 @@
package main // import "github.com/Jguer/yay"
import (
"context"
"errors"
"os"
"os/exec"
"runtime/debug"
"strings"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/db/ialpm"
"github.com/Jguer/yay/v12/pkg/runtime"
"github.com/Jguer/yay/v12/pkg/settings"
"github.com/Jguer/yay/v12/pkg/settings/parser"
"github.com/Jguer/yay/v12/pkg/text"
)
var (
yayVersion = "12.0.4" // To be set by compiler.
localePath = "/usr/share/locale" // To be set by compiler.
)
func initGotext() {
if envLocalePath := os.Getenv("LOCALE_PATH"); envLocalePath != "" {
localePath = envLocalePath
}
if lc := os.Getenv("LANGUAGE"); lc != "" {
// Split LANGUAGE by ':' and prioritize the first locale
// Should fix in gotext to support this
locales := strings.Split(lc, ":")
if len(locales) > 0 && locales[0] != "" {
gotext.Configure(localePath, locales[0], "yay")
}
} else if lc := os.Getenv("LC_ALL"); lc != "" {
gotext.Configure(localePath, lc, "yay")
} else if lc := os.Getenv("LC_MESSAGES"); lc != "" {
gotext.Configure(localePath, lc, "yay")
} else {
gotext.Configure(localePath, os.Getenv("LANG"), "yay")
}
}
func main() {
fallbackLog := text.NewLogger(os.Stdout, os.Stderr, os.Stdin, false, "fallback")
var (
err error
ctx = context.Background()
ret = 0
)
defer func() {
if rec := recover(); rec != nil {
fallbackLog.Errorln("Panic occurred:", rec)
fallbackLog.Errorln("Stack trace:", string(debug.Stack()))
ret = 1
}
os.Exit(ret)
}()
initGotext()
if os.Geteuid() == 0 {
fallbackLog.Warnln(gotext.Get("Avoid running yay as root/sudo."))
}
configPath := settings.GetConfigPath()
// Parse config
cfg, err := settings.NewConfig(fallbackLog, configPath, yayVersion)
if err != nil {
if str := err.Error(); str != "" {
fallbackLog.Errorln(str)
}
ret = 1
return
}
if errS := cfg.RunMigrations(fallbackLog,
settings.DefaultMigrations(), configPath, yayVersion); errS != nil {
fallbackLog.Errorln(errS)
}
cmdArgs := parser.MakeArguments()
// Parse command line
if err = cfg.ParseCommandLine(cmdArgs); err != nil {
if str := err.Error(); str != "" {
fallbackLog.Errorln(str)
}
ret = 1
return
}
if cfg.SaveConfig {
if errS := cfg.Save(configPath, yayVersion); errS != nil {
fallbackLog.Errorln(errS)
}
}
// Build run
run, err := runtime.NewRuntime(cfg, cmdArgs, yayVersion)
if err != nil {
if str := err.Error(); str != "" {
fallbackLog.Errorln(str)
}
ret = 1
return
}
dbExecutor, err := ialpm.NewExecutor(run.PacmanConf, run.Logger.Child("db"))
if err != nil {
if str := err.Error(); str != "" {
fallbackLog.Errorln(str)
}
ret = 1
return
}
defer func() {
if rec := recover(); rec != nil {
fallbackLog.Errorln("Panic occurred in DB operation:", rec)
fallbackLog.Errorln("Stack trace:", string(debug.Stack()))
}
dbExecutor.Cleanup()
}()
if err = handleCmd(ctx, run, cmdArgs, dbExecutor); err != nil {
if str := err.Error(); str != "" {
fallbackLog.Errorln(str)
}
exitError := &exec.ExitError{}
if errors.As(err, &exitError) {
// mirror pacman exit code when applicable
ret = exitError.ExitCode()
return
}
// fallback
ret = 1
}
}

671
parser.go
View File

@ -1,671 +0,0 @@
package main
import (
"fmt"
"io"
"os"
"strconv"
"strings"
)
// A basic set implementation for strings.
// This is used a lot so it deserves its own type.
// Other types of sets are used throughout the code but do not have
// their own typedef.
// String sets and <type>sets should be used throughout the code when applicable,
// they are a lot more flexable than slices and provide easy lookup.
type stringSet map[string]struct{}
func (set stringSet) set(v string) {
set[v] = struct{}{}
}
func (set stringSet) get(v string) bool {
_, exists := set[v]
return exists
}
func (set stringSet) remove(v string) {
delete(set, v)
}
func (set stringSet) toSlice() []string {
slice := make([]string, 0, len(set))
for v := range set {
slice = append(slice, v)
}
return slice
}
func SliceToStringSet(in []string) stringSet {
set := make(stringSet)
for _, v := range in {
set.set(v)
}
return set
}
func makeStringSet(in ...string) stringSet {
return SliceToStringSet(in)
}
// Parses command line arguments in a way we can interact with programmatically but
// also in a way that can easily be passed to pacman later on.
type arguments struct {
op string
options map[string]string
globals map[string]string
doubles stringSet // Tracks args passed twice such as -yy and -dd
targets stringSet
}
func makeArguments() *arguments {
return &arguments{
"",
make(map[string]string),
make(map[string]string),
make(stringSet),
make(stringSet),
}
}
func (parser *arguments) copy() (cp *arguments) {
cp = makeArguments()
cp.op = parser.op
for k, v := range parser.options {
cp.options[k] = v
}
for k, v := range parser.globals {
cp.globals[k] = v
}
for k, v := range parser.targets {
cp.targets[k] = v
}
for k, v := range parser.doubles {
cp.doubles[k] = v
}
return
}
func (parser *arguments) delArg(options ...string) {
for _, option := range options {
delete(parser.options, option)
delete(parser.globals, option)
delete(parser.doubles, option)
}
}
func (parser *arguments) needRoot() bool {
if parser.existsArg("h", "help") {
return false
}
if parser.existsArg("p", "print") {
return false
}
switch parser.op {
case "V", "version":
return false
case "D", "database":
return true
case "F", "files":
if parser.existsArg("y", "refresh") {
return true
}
return false
case "Q", "query":
return false
case "R", "remove":
return true
case "S", "sync":
if parser.existsArg("y", "refresh") {
return true
}
if parser.existsArg("u", "sysupgrade") {
return true
}
if parser.existsArg("s", "search") {
return false
}
if parser.existsArg("l", "list") {
return false
}
if parser.existsArg("i", "info") {
return false
}
return true
case "T", "deptest":
return false
case "U", "upgrade":
return true
// yay specific
case "Y", "yay":
return false
case "P", "print":
return false
case "G", "getpkgbuild":
return false
default:
return false
}
}
func (parser *arguments) addOP(op string) (err error) {
if parser.op != "" {
err = fmt.Errorf("only one operation may be used at a time")
return
}
parser.op = op
return
}
func (parser *arguments) addParam(option string, arg string) (err error) {
if isOp(option) {
err = parser.addOP(option)
return
}
if parser.existsArg(option) {
parser.doubles[option] = struct{}{}
} else if isGlobal(option) {
parser.globals[option] = arg
} else {
parser.options[option] = arg
}
return
}
func (parser *arguments) addArg(options ...string) (err error) {
for _, option := range options {
err = parser.addParam(option, "")
if err != nil {
return
}
}
return
}
// Multiple args acts as an OR operator
func (parser *arguments) existsArg(options ...string) bool {
for _, option := range options {
_, exists := parser.options[option]
if exists {
return true
}
_, exists = parser.globals[option]
if exists {
return true
}
}
return false
}
func (parser *arguments) getArg(options ...string) (arg string, double bool, exists bool) {
for _, option := range options {
arg, exists = parser.options[option]
if exists {
_, double = parser.doubles[option]
return
}
arg, exists = parser.globals[option]
if exists {
_, double = parser.doubles[option]
return
}
}
return
}
func (parser *arguments) addTarget(targets ...string) {
for _, target := range targets {
parser.targets[target] = struct{}{}
}
}
func (parser *arguments) delTarget(targets ...string) {
for _, target := range targets {
delete(parser.targets, target)
}
}
// Multiple args acts as an OR operator
func (parser *arguments) existsDouble(options ...string) bool {
for _, option := range options {
_, exists := parser.doubles[option]
if exists {
return true
}
}
return false
}
func (parser *arguments) formatTargets() (args []string) {
for target := range parser.targets {
args = append(args, target)
}
return
}
func (parser *arguments) formatArgs() (args []string) {
var op string
if parser.op != "" {
op = formatArg(parser.op)
}
args = append(args, op)
for option, arg := range parser.options {
if option == "--" {
continue
}
formatedOption := formatArg(option)
args = append(args, formatedOption)
if hasParam(option) {
args = append(args, arg)
}
if parser.existsDouble(option) {
args = append(args, formatedOption)
}
}
return
}
func (parser *arguments) formatGlobals() (args []string) {
for option, arg := range parser.globals {
formatedOption := formatArg(option)
args = append(args, formatedOption)
if hasParam(option) {
args = append(args, arg)
}
if parser.existsDouble(option) {
args = append(args, formatedOption)
}
}
return
}
func formatArg(arg string) string {
if len(arg) > 1 {
arg = "--" + arg
} else {
arg = "-" + arg
}
return arg
}
func isOp(op string) bool {
switch op {
case "V", "version":
return true
case "D", "database":
return true
case "F", "files":
return true
case "Q", "query":
return true
case "R", "remove":
return true
case "S", "sync":
return true
case "T", "deptest":
return true
case "U", "upgrade":
return true
// yay specific
case "Y", "yay":
return true
case "P", "print":
return true
case "G", "getpkgbuild":
return true
default:
return false
}
}
func isGlobal(op string) bool {
switch op {
case "b", "dbpath":
return true
case "r", "root":
return true
case "v", "verbose":
return true
case "arch":
return true
case "cachedir":
return true
case "color":
return true
case "config":
return true
case "debug":
return true
case "gpgdir":
return true
case "hookdir":
return true
case "logfile":
return true
case "noconfirm":
return true
case "confirm":
return true
default:
return false
}
}
func hasParam(arg string) bool {
switch arg {
case "dbpath", "b":
return true
case "root", "r":
return true
case "sysroot":
return true
case "config":
return true
case "ignore":
return true
case "assume-installed":
return true
case "overwrite":
return true
case "ask":
return true
case "cachedir":
return true
case "hookdir":
return true
case "logfile":
return true
case "ignoregroup":
return true
case "arch":
return true
case "print-format":
return true
case "gpgdir":
return true
case "color":
return true
//yay params
case "mflags":
return true
case "builddir":
return true
case "editor":
return true
case "makepkg":
return true
case "pacman":
return true
case "tar":
return true
case "git":
return true
case "requestsplitn":
return true
default:
return false
}
}
// Parses short hand options such as:
// -Syu -b/some/path -
func (parser *arguments) parseShortOption(arg string, param string) (usedNext bool, err error) {
if arg == "-" {
err = parser.addArg("-")
return
}
arg = arg[1:]
for k, _char := range arg {
char := string(_char)
if hasParam(char) {
if k < len(arg)-2 {
err = parser.addParam(char, arg[k+2:])
} else {
usedNext = true
err = parser.addParam(char, param)
}
break
} else {
err = parser.addArg(char)
if err != nil {
return
}
}
}
return
}
// Parses full length options such as:
// --sync --refresh --sysupgrade --dbpath /some/path --
func (parser *arguments) parseLongOption(arg string, param string) (usedNext bool, err error) {
if arg == "--" {
err = parser.addArg(arg)
return
}
arg = arg[2:]
if hasParam(arg) {
err = parser.addParam(arg, param)
usedNext = true
} else {
err = parser.addArg(arg)
}
return
}
func (parser *arguments) parseStdin() (err error) {
for {
var target string
_, err = fmt.Scan(&target)
if err != nil {
if err == io.EOF {
err = nil
}
return
}
parser.addTarget(target)
}
return
}
func (parser *arguments) parseCommandLine() (err error) {
args := os.Args[1:]
usedNext := false
if len(args) < 1 {
err = fmt.Errorf("no operation specified (use -h for help)")
return
}
for k, arg := range args {
var nextArg string
if usedNext {
usedNext = false
continue
}
if k+1 < len(args) {
nextArg = args[k+1]
}
if parser.existsArg("--") {
parser.addTarget(arg)
} else if strings.HasPrefix(arg, "--") {
usedNext, err = parser.parseLongOption(arg, nextArg)
} else if strings.HasPrefix(arg, "-") {
usedNext, err = parser.parseShortOption(arg, nextArg)
} else {
parser.addTarget(arg)
}
if err != nil {
return
}
}
if parser.op == "" {
parser.op = "Y"
}
if cmdArgs.existsArg("-") {
var file *os.File
err = cmdArgs.parseStdin()
cmdArgs.delArg("-")
if err != nil {
return
}
file, err = os.Open("/dev/tty")
if err != nil {
return
}
os.Stdin = file
}
return
}
type intRange struct {
min int
max int
}
func makeIntRange(min, max int) intRange {
return intRange{
min,
max,
}
}
func (r intRange) get(n int) bool {
return n >= r.min && n <= r.max
}
type intRanges []intRange
func (rs intRanges) get(n int) bool {
for _, r := range rs {
if r.get(n) {
return true
}
}
return false
}
//parses input for number menus
//supports individual selection: 1 2 3 4
//supports range selections: 1-4 10-20
//supports negation: ^1 ^1-4
//
//include and excule holds numbers that should be added and should not be added
//respectively. other holds anythign that can't be parsed as an int. This is
//intended to allow words inside of number menus. e.g. 'all' 'none' 'abort'
//of course the implementation is up to the caller, this function mearley parses
//the input and organizes it
func parseNumberMenu(input string) (intRanges, intRanges, stringSet, stringSet) {
include := make(intRanges, 0, 0)
exclude := make(intRanges, 0, 0)
otherInclude := make(stringSet)
otherExclude := make(stringSet)
words := strings.Fields(input)
for _, word := range words {
var num1 int
var num2 int
var err error
invert := false
other := otherInclude
if word[0] == '^' {
invert = true
other = otherExclude
word = word[1:]
}
ranges := strings.SplitN(word, "-", 2)
num1, err = strconv.Atoi(ranges[0])
if err != nil {
other.set(strings.ToLower(word))
continue
}
if len(ranges) == 2 {
num2, err = strconv.Atoi(ranges[1])
if err != nil {
other.set(strings.ToLower(word))
continue
}
} else {
num2 = num1
}
mi := min(num1, num2)
ma := max(num1, num2)
if !invert {
include = append(include, makeIntRange(mi, ma))
} else {
exclude = append(exclude, makeIntRange(mi, ma))
}
}
return include, exclude, otherInclude, otherExclude
}

View File

@ -1,99 +0,0 @@
package main
import "testing"
func intRangesEqual(a, b intRanges) bool {
if a == nil && b == nil {
return true
}
if a == nil || b == nil {
return false
}
if len(a) != len(b) {
return false
}
for n := range a {
r1 := a[n]
r2 := b[n]
if r1.min != r1.min || r1.max != r2.max {
return false
}
}
return true
}
func stringSetEqual(a, b stringSet) bool {
if a == nil && b == nil {
return true
}
if a == nil || b == nil {
return false
}
if len(a) != len(b) {
return false
}
for n := range a {
if !b.get(n) {
return false
}
}
return true
}
func TestParseNumberMenu(t *testing.T) {
type result struct {
Include intRanges
Exclude intRanges
OtherInclude stringSet
OtherExclude stringSet
}
inputs := []string{
"1 2 3 4 5",
"1-10 5-15",
"10-5 90-85",
"1 ^2 ^10-5 99 ^40-38 ^123 60-62",
"abort all none",
"a-b ^a-b ^abort",
"1\t2 3 4\t\t \t 5",
"",
" \t ",
"A B C D E",
}
expected := []result{
{intRanges{makeIntRange(1, 1), makeIntRange(2, 2), makeIntRange(3, 3), makeIntRange(4, 4), makeIntRange(5, 5)}, intRanges{}, make(stringSet), make(stringSet)},
{intRanges{makeIntRange(1, 10), makeIntRange(5, 15)}, intRanges{}, make(stringSet), make(stringSet)},
{intRanges{makeIntRange(5, 10), makeIntRange(85, 90)}, intRanges{}, make(stringSet), make(stringSet)},
{intRanges{makeIntRange(1, 1), makeIntRange(99, 99), makeIntRange(60, 62)}, intRanges{makeIntRange(2, 2), makeIntRange(5, 10), makeIntRange(38, 40), makeIntRange(123, 123)}, make(stringSet), make(stringSet)},
{intRanges{}, intRanges{}, makeStringSet("abort", "all", "none"), make(stringSet)},
{intRanges{}, intRanges{}, makeStringSet("a-b"), makeStringSet("abort", "a-b")},
{intRanges{makeIntRange(1, 1), makeIntRange(2, 2), makeIntRange(3, 3), makeIntRange(4, 4), makeIntRange(5, 5)}, intRanges{}, make(stringSet), make(stringSet)},
{intRanges{}, intRanges{}, make(stringSet), make(stringSet)},
{intRanges{}, intRanges{}, make(stringSet), make(stringSet)},
{intRanges{}, intRanges{}, makeStringSet("a", "b", "c", "d", "e"), make(stringSet)},
}
for n, in := range inputs {
res := expected[n]
include, exclude, otherInclude, otherExclude := parseNumberMenu(in)
if !intRangesEqual(include, res.Include) ||
!intRangesEqual(exclude, res.Exclude) ||
!stringSetEqual(otherInclude, res.OtherInclude) ||
!stringSetEqual(otherExclude, res.OtherExclude) {
t.Fatalf("Test %d Failed: Expected: include=%+v exclude=%+v otherInclude=%+v otherExclude=%+v got include=%+v excluive=%+v otherInclude=%+v otherExclude=%+v",
n+1, res.Include, res.Exclude, res.OtherInclude, res.OtherExclude, include, exclude, otherInclude, otherExclude)
}
}
}

82
pkg/cmd/graph/main.go Normal file
View File

@ -0,0 +1,82 @@
package main
import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
"github.com/Jguer/yay/v12/pkg/db/ialpm"
"github.com/Jguer/yay/v12/pkg/dep"
"github.com/Jguer/yay/v12/pkg/runtime"
"github.com/Jguer/yay/v12/pkg/settings"
"github.com/Jguer/yay/v12/pkg/settings/parser"
"github.com/Jguer/yay/v12/pkg/text"
"github.com/Jguer/aur/metadata"
"github.com/leonelquinteros/gotext"
)
func handleCmd(logger *text.Logger) error {
cfg, err := settings.NewConfig(logger, settings.GetConfigPath(), "")
if err != nil {
return err
}
cmdArgs := parser.MakeArguments()
if errP := cfg.ParseCommandLine(cmdArgs); errP != nil {
return errP
}
run, err := runtime.NewRuntime(cfg, cmdArgs, "1.0.0")
if err != nil {
return err
}
dbExecutor, err := ialpm.NewExecutor(run.PacmanConf, logger)
if err != nil {
return err
}
aurCache, err := metadata.New(
metadata.WithCacheFilePath(
filepath.Join(cfg.BuildDir, "aur.json")))
if err != nil {
return fmt.Errorf("%s: %w", gotext.Get("failed to retrieve aur Cache"), err)
}
grapher := dep.NewGrapher(dbExecutor, aurCache, true, settings.NoConfirm,
cmdArgs.ExistsDouble("d", "nodeps"), false, false,
run.Logger.Child("grapher"))
return graphPackage(context.Background(), grapher, cmdArgs.Targets)
}
func main() {
fallbackLog := text.NewLogger(os.Stdout, os.Stderr, os.Stdin, false, "fallback")
if err := handleCmd(fallbackLog); err != nil {
fallbackLog.Errorln(err)
os.Exit(1)
}
}
func graphPackage(
ctx context.Context,
grapher *dep.Grapher,
targets []string,
) error {
if len(targets) != 1 {
return errors.New(gotext.Get("only one target is allowed"))
}
graph, err := grapher.GraphFromAUR(ctx, nil, []string{targets[0]})
if err != nil {
return err
}
fmt.Fprintln(os.Stdout, graph.String())
fmt.Fprintln(os.Stdout, "\nlayers map\n", graph.TopoSortedLayerMap(nil))
return nil
}

View File

@ -0,0 +1,130 @@
package completion
import (
"bufio"
"context"
"fmt"
"io"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"strings"
"time"
"github.com/Jguer/yay/v12/pkg/db"
)
type PkgSynchronizer interface {
SyncPackages(...string) []db.IPackage
}
type httpRequestDoer interface {
Do(req *http.Request) (*http.Response, error)
}
// Show provides completion info for shells.
func Show(ctx context.Context, httpClient httpRequestDoer,
dbExecutor PkgSynchronizer, aurURL, completionPath string, interval int, force bool,
) error {
err := Update(ctx, httpClient, dbExecutor, aurURL, completionPath, interval, force)
if err != nil {
return err
}
in, err := os.OpenFile(completionPath, os.O_RDWR|os.O_CREATE, 0o644)
if err != nil {
return err
}
defer in.Close()
_, err = io.Copy(os.Stdout, in)
return err
}
// Update updates completion cache to be used by Complete.
func Update(ctx context.Context, httpClient httpRequestDoer,
dbExecutor PkgSynchronizer, aurURL, completionPath string, interval int, force bool,
) error {
info, err := os.Stat(completionPath)
if os.IsNotExist(err) || (interval != -1 && time.Since(info.ModTime()).Hours() >= float64(interval*24)) || force {
errd := os.MkdirAll(filepath.Dir(completionPath), 0o755)
if errd != nil {
return errd
}
out, errf := os.Create(completionPath)
if errf != nil {
return errf
}
if createAURList(ctx, httpClient, aurURL, out) != nil {
defer os.Remove(completionPath)
}
erra := createRepoList(dbExecutor, out)
out.Close()
return erra
}
return nil
}
// CreateAURList creates a new completion file.
func createAURList(ctx context.Context, client httpRequestDoer, aurURL string, out io.Writer) error {
u, err := url.Parse(aurURL)
if err != nil {
return err
}
u.Path = path.Join(u.Path, "packages.gz")
req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), http.NoBody)
if err != nil {
return err
}
resp, err := client.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("invalid status code: %d", resp.StatusCode)
}
scanner := bufio.NewScanner(resp.Body)
scanner.Scan()
for scanner.Scan() {
text := scanner.Text()
if strings.HasPrefix(text, "#") {
continue
}
if _, err := io.WriteString(out, text+"\tAUR\n"); err != nil {
return err
}
}
return nil
}
// createRepoList appends Repo packages to completion cache.
func createRepoList(dbExecutor PkgSynchronizer, out io.Writer) error {
for _, pkg := range dbExecutor.SyncPackages() {
_, err := io.WriteString(out, pkg.Name()+"\t"+pkg.DB().Name()+"\n")
if err != nil {
return err
}
}
return nil
}

View File

@ -0,0 +1,99 @@
//go:build !integration
// +build !integration
package completion
import (
"bytes"
"context"
"errors"
"io"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
const samplePackageResp = `
# AUR package list, generated on Fri, 24 Jul 2020 22:05:22 GMT
cytadela
bitefusion
globs-svn
ri-li
globs-benchmarks-svn
dunelegacy
lumina
eternallands-sound
`
const expectPackageCompletion = `cytadela AUR
bitefusion AUR
globs-svn AUR
ri-li AUR
globs-benchmarks-svn AUR
dunelegacy AUR
lumina AUR
eternallands-sound AUR
`
type mockDoer struct {
t *testing.T
returnBody string
returnStatusCode int
returnErr error
wantUrl string
}
func (m *mockDoer) Do(req *http.Request) (*http.Response, error) {
assert.Equal(m.t, m.wantUrl, req.URL.String())
return &http.Response{
StatusCode: m.returnStatusCode,
Body: io.NopCloser(bytes.NewBufferString(m.returnBody)),
}, m.returnErr
}
func Test_createAURList(t *testing.T) {
t.Parallel()
doer := &mockDoer{
t: t,
wantUrl: "https://aur.archlinux.org/packages.gz",
returnStatusCode: 200,
returnBody: samplePackageResp,
returnErr: nil,
}
out := &bytes.Buffer{}
err := createAURList(context.Background(), doer, "https://aur.archlinux.org", out)
assert.NoError(t, err)
gotOut := out.String()
assert.Equal(t, expectPackageCompletion, gotOut)
}
func Test_createAURListHTTPError(t *testing.T) {
t.Parallel()
doer := &mockDoer{
t: t,
wantUrl: "https://aur.archlinux.org/packages.gz",
returnStatusCode: 200,
returnBody: samplePackageResp,
returnErr: errors.New("Not available"),
}
out := &bytes.Buffer{}
err := createAURList(context.Background(), doer, "https://aur.archlinux.org", out)
assert.EqualError(t, err, "Not available")
}
func Test_createAURListStatusError(t *testing.T) {
t.Parallel()
doer := &mockDoer{
t: t,
wantUrl: "https://aur.archlinux.org/packages.gz",
returnStatusCode: 503,
returnBody: samplePackageResp,
returnErr: nil,
}
out := &bytes.Buffer{}
err := createAURList(context.Background(), doer, "https://aur.archlinux.org", out)
assert.EqualError(t, err, "invalid status code: 503")
}

68
pkg/db/executor.go Normal file
View File

@ -0,0 +1,68 @@
package db
import (
"time"
alpm "github.com/Jguer/go-alpm/v2"
"github.com/Jguer/yay/v12/pkg/text"
)
type (
IPackage = alpm.IPackage
Depend = alpm.Depend
)
// VerCmp performs version comparison according to Pacman conventions. Return
// value is <0 if and only if v1 is older than v2.
func VerCmp(v1, v2 string) int {
return alpm.VerCmp(v1, v2)
}
type Upgrade struct {
Name string
Base string
Repository string
LocalVersion string
RemoteVersion string
Reason alpm.PkgReason
Extra string // Extra information to be displayed
}
type SyncUpgrade struct {
Package alpm.IPackage
LocalVersion string
Reason alpm.PkgReason
}
type Executor interface {
AlpmArchitectures() ([]string, error)
BiggestPackages() []IPackage
Cleanup()
InstalledRemotePackageNames() []string
InstalledRemotePackages() map[string]IPackage
InstalledSyncPackageNames() []string
IsCorrectVersionInstalled(string, string) bool
LastBuildTime() time.Time
LocalPackage(string) IPackage
LocalPackages() []IPackage
LocalSatisfierExists(string) bool
PackageDepends(IPackage) []Depend
PackageGroups(IPackage) []string
PackageOptionalDepends(IPackage) []Depend
PackageProvides(IPackage) []Depend
PackagesFromGroup(string) []IPackage
PackagesFromGroupAndDB(string, string) ([]IPackage, error)
RefreshHandle() error
SyncUpgrades(enableDowngrade bool) (
map[string]SyncUpgrade, error)
Repos() []string
SatisfierFromDB(string, string) (IPackage, error)
SyncPackage(string) IPackage
SyncPackageFromDB(string, string) IPackage
SyncPackages(...string) []IPackage
SyncSatisfier(string) IPackage
SyncSatisfierExists(string) bool
SetLogger(logger *text.Logger)
}

543
pkg/db/ialpm/alpm.go Normal file
View File

@ -0,0 +1,543 @@
package ialpm
import (
"errors"
"fmt"
"os"
"strconv"
"time"
alpm "github.com/Jguer/go-alpm/v2"
pacmanconf "github.com/Morganamilo/go-pacmanconf"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/db"
"github.com/Jguer/yay/v12/pkg/settings"
"github.com/Jguer/yay/v12/pkg/text"
)
type AlpmExecutor struct {
handle *alpm.Handle
localDB alpm.IDB
syncDB alpm.IDBList
syncDBsCache []alpm.IDB
conf *pacmanconf.Config
log *text.Logger
installedRemotePkgNames []string
installedRemotePkgMap map[string]alpm.IPackage
installedSyncPkgNames []string
}
func NewExecutor(pacmanConf *pacmanconf.Config, logger *text.Logger) (*AlpmExecutor, error) {
ae := &AlpmExecutor{
handle: nil,
localDB: nil,
syncDB: nil,
syncDBsCache: []alpm.IDB{},
conf: pacmanConf,
log: logger,
installedRemotePkgNames: nil,
installedRemotePkgMap: nil,
installedSyncPkgNames: nil,
}
if err := ae.RefreshHandle(); err != nil {
return nil, err
}
var err error
ae.localDB, err = ae.handle.LocalDB()
if err != nil {
return nil, err
}
ae.syncDB, err = ae.handle.SyncDBs()
if err != nil {
return nil, err
}
return ae, nil
}
func toUsage(usages []string) alpm.Usage {
if len(usages) == 0 {
return alpm.UsageAll
}
var ret alpm.Usage
for _, usage := range usages {
switch usage {
case "Sync":
ret |= alpm.UsageSync
case "Search":
ret |= alpm.UsageSearch
case "Install":
ret |= alpm.UsageInstall
case "Upgrade":
ret |= alpm.UsageUpgrade
case "All":
ret |= alpm.UsageAll
}
}
return ret
}
func configureAlpm(pacmanConf *pacmanconf.Config, alpmHandle *alpm.Handle) error {
for _, repo := range pacmanConf.Repos {
// TODO: set SigLevel
alpmDB, err := alpmHandle.RegisterSyncDB(repo.Name, 0)
if err != nil {
return err
}
alpmDB.SetServers(repo.Servers)
alpmDB.SetUsage(toUsage(repo.Usage))
}
if err := alpmHandle.SetCacheDirs(pacmanConf.CacheDir); err != nil {
return err
}
// add hook directories 1-by-1 to avoid overwriting the system directory
for _, dir := range pacmanConf.HookDir {
if err := alpmHandle.AddHookDir(dir); err != nil {
return err
}
}
if err := alpmHandle.SetGPGDir(pacmanConf.GPGDir); err != nil {
return err
}
if err := alpmHandle.SetLogFile(pacmanConf.LogFile); err != nil {
return err
}
if err := alpmHandle.SetIgnorePkgs(pacmanConf.IgnorePkg); err != nil {
return err
}
if err := alpmHandle.SetIgnoreGroups(pacmanConf.IgnoreGroup); err != nil {
return err
}
if err := alpmSetArchitecture(alpmHandle, pacmanConf.Architecture); err != nil {
return err
}
if err := alpmHandle.SetNoUpgrades(pacmanConf.NoUpgrade); err != nil {
return err
}
if err := alpmHandle.SetNoExtracts(pacmanConf.NoExtract); err != nil {
return err
}
if err := alpmHandle.SetUseSyslog(pacmanConf.UseSyslog); err != nil {
return err
}
return alpmHandle.SetCheckSpace(pacmanConf.CheckSpace)
}
func (ae *AlpmExecutor) logCallback() func(level alpm.LogLevel, str string) {
return func(level alpm.LogLevel, str string) {
switch level {
case alpm.LogWarning:
ae.log.Warn(str)
case alpm.LogError:
ae.log.Error(str)
}
}
}
func (ae *AlpmExecutor) questionCallback() func(question alpm.QuestionAny) {
return func(question alpm.QuestionAny) {
if qi, err := question.QuestionInstallIgnorepkg(); err == nil {
qi.SetInstall(true)
}
qp, err := question.QuestionSelectProvider()
if err != nil {
return
}
if settings.HideMenus {
return
}
size := 0
_ = qp.Providers(ae.handle).ForEach(func(pkg alpm.IPackage) error {
size++
return nil
})
str := text.Bold(gotext.Get("There are %[1]d providers available for %[2]s:", size, qp.Dep()))
size = 1
var dbName string
_ = qp.Providers(ae.handle).ForEach(func(pkg alpm.IPackage) error {
thisDB := pkg.DB().Name()
if dbName != thisDB {
dbName = thisDB
str += "\n"
str += ae.log.SprintOperationInfo(gotext.Get("Repository"), " ", dbName, "\n ")
}
str += fmt.Sprintf("%d) %s ", size, pkg.Name())
size++
return nil
})
ae.log.OperationInfoln(str)
for {
ae.log.Println(gotext.Get("\nEnter a number (default=1): "))
// TODO: reenable noconfirm
if settings.NoConfirm {
ae.log.Println()
break
}
numberBuf, err := ae.log.GetInput("", false)
if err != nil {
ae.log.Errorln(err)
break
}
if numberBuf == "" {
break
}
num, err := strconv.Atoi(numberBuf)
if err != nil {
ae.log.Errorln(gotext.Get("invalid number: %s", numberBuf))
continue
}
if num < 1 || num > size {
ae.log.Errorln(gotext.Get("invalid value: %d is not between %d and %d", num, 1, size))
continue
}
qp.SetUseIndex(num - 1)
break
}
}
}
func (ae *AlpmExecutor) RefreshHandle() error {
if ae.handle != nil {
if errRelease := ae.handle.Release(); errRelease != nil {
return errRelease
}
}
alpmHandle, err := alpm.Initialize(ae.conf.RootDir, ae.conf.DBPath)
if err != nil {
return errors.New(gotext.Get("unable to CreateHandle: %s", err))
}
if errConf := configureAlpm(ae.conf, alpmHandle); errConf != nil {
return errConf
}
alpmSetQuestionCallback(alpmHandle, ae.questionCallback())
alpmSetLogCallback(alpmHandle, ae.logCallback())
ae.handle = alpmHandle
ae.syncDBsCache = nil
ae.syncDB, err = alpmHandle.SyncDBs()
if err != nil {
return err
}
ae.localDB, err = alpmHandle.LocalDB()
return err
}
func (ae *AlpmExecutor) LocalSatisfierExists(pkgName string) bool {
if _, err := ae.localDB.PkgCache().FindSatisfier(pkgName); err != nil {
return false
}
return true
}
func (ae *AlpmExecutor) SyncSatisfierExists(pkgName string) bool {
if _, err := ae.syncDB.FindSatisfier(pkgName); err != nil {
return false
}
return true
}
func (ae *AlpmExecutor) IsCorrectVersionInstalled(pkgName, versionRequired string) bool {
alpmPackage := ae.localDB.Pkg(pkgName)
if alpmPackage == nil {
return false
}
return alpmPackage.Version() == versionRequired
}
func (ae *AlpmExecutor) SyncSatisfier(pkgName string) alpm.IPackage {
foundPkg, err := ae.syncDB.FindSatisfier(pkgName)
if err != nil {
return nil
}
return foundPkg
}
func (ae *AlpmExecutor) PackagesFromGroup(groupName string) []alpm.IPackage {
groupPackages := []alpm.IPackage{}
_ = ae.syncDB.FindGroupPkgs(groupName).ForEach(func(pkg alpm.IPackage) error {
groupPackages = append(groupPackages, pkg)
return nil
})
return groupPackages
}
func (ae *AlpmExecutor) PackagesFromGroupAndDB(groupName, dbName string) ([]alpm.IPackage, error) {
singleDBList, err := ae.handle.SyncDBListByDBName(dbName)
if err != nil {
return nil, err
}
groupPackages := []alpm.IPackage{}
_ = singleDBList.FindGroupPkgs(groupName).ForEach(func(pkg alpm.IPackage) error {
groupPackages = append(groupPackages, pkg)
return nil
})
return groupPackages, nil
}
func (ae *AlpmExecutor) LocalPackages() []alpm.IPackage {
localPackages := []alpm.IPackage{}
_ = ae.localDB.PkgCache().ForEach(func(pkg alpm.IPackage) error {
localPackages = append(localPackages, pkg)
return nil
})
return localPackages
}
// SyncPackages searches SyncDB for packages or returns all packages if no search param is given.
func (ae *AlpmExecutor) SyncPackages(pkgNames ...string) []alpm.IPackage {
repoPackages := []alpm.IPackage{}
_ = ae.syncDB.ForEach(func(alpmDB alpm.IDB) error {
if len(pkgNames) == 0 {
_ = alpmDB.PkgCache().ForEach(func(pkg alpm.IPackage) error {
repoPackages = append(repoPackages, pkg)
return nil
})
} else {
_ = alpmDB.Search(pkgNames).ForEach(func(pkg alpm.IPackage) error {
repoPackages = append(repoPackages, pkg)
return nil
})
}
return nil
})
return repoPackages
}
func (ae *AlpmExecutor) LocalPackage(pkgName string) alpm.IPackage {
pkg := ae.localDB.Pkg(pkgName)
if pkg == nil {
return nil
}
return pkg
}
func (ae *AlpmExecutor) syncDBs() []alpm.IDB {
if ae.syncDBsCache == nil {
ae.syncDBsCache = ae.syncDB.Slice()
}
return ae.syncDBsCache
}
func (ae *AlpmExecutor) SyncPackage(pkgName string) alpm.IPackage {
for _, db := range ae.syncDBs() {
if dbPkg := db.Pkg(pkgName); dbPkg != nil {
return dbPkg
}
}
return nil
}
func (ae *AlpmExecutor) SyncPackageFromDB(pkgName, dbName string) alpm.IPackage {
singleDB, err := ae.handle.SyncDBByName(dbName)
if err != nil {
return nil
}
return singleDB.Pkg(pkgName)
}
func (ae *AlpmExecutor) SatisfierFromDB(pkgName, dbName string) (alpm.IPackage, error) {
singleDBList, err := ae.handle.SyncDBListByDBName(dbName)
if err != nil {
return nil, err
}
foundPkg, err := singleDBList.FindSatisfier(pkgName)
if err != nil {
return nil, nil
}
return foundPkg, nil
}
func (ae *AlpmExecutor) PackageDepends(pkg alpm.IPackage) []alpm.Depend {
alpmPackage := pkg.(*alpm.Package)
return alpmPackage.Depends().Slice()
}
func (ae *AlpmExecutor) PackageOptionalDepends(pkg alpm.IPackage) []alpm.Depend {
alpmPackage := pkg.(*alpm.Package)
return alpmPackage.OptionalDepends().Slice()
}
func (ae *AlpmExecutor) PackageProvides(pkg alpm.IPackage) []alpm.Depend {
alpmPackage := pkg.(*alpm.Package)
return alpmPackage.Provides().Slice()
}
func (ae *AlpmExecutor) PackageGroups(pkg alpm.IPackage) []string {
alpmPackage := pkg.(*alpm.Package)
return alpmPackage.Groups().Slice()
}
// upRepo gathers local packages and checks if they have new versions.
// Output: Upgrade type package list.
func (ae *AlpmExecutor) SyncUpgrades(enableDowngrade bool) (
map[string]db.SyncUpgrade, error,
) {
ups := map[string]db.SyncUpgrade{}
var errReturn error
localDB, errDB := ae.handle.LocalDB()
if errDB != nil {
return ups, errDB
}
if err := ae.handle.TransInit(alpm.TransFlagNoLock); err != nil {
return ups, err
}
defer func() {
errReturn = ae.handle.TransRelease()
}()
if err := ae.handle.SyncSysupgrade(enableDowngrade); err != nil {
return ups, err
}
_ = ae.handle.TransGetAdd().ForEach(func(pkg alpm.IPackage) error {
localVer := "-"
reason := alpm.PkgReasonExplicit
if localPkg := localDB.Pkg(pkg.Name()); localPkg != nil {
localVer = localPkg.Version()
reason = localPkg.Reason()
}
ups[pkg.Name()] = db.SyncUpgrade{
Package: pkg,
Reason: reason,
LocalVersion: localVer,
}
return nil
})
return ups, errReturn
}
func (ae *AlpmExecutor) BiggestPackages() []alpm.IPackage {
localPackages := []alpm.IPackage{}
_ = ae.localDB.PkgCache().SortBySize().ForEach(func(pkg alpm.IPackage) error {
localPackages = append(localPackages, pkg)
return nil
})
return localPackages
}
func (ae *AlpmExecutor) LastBuildTime() time.Time {
var lastTime time.Time
_ = ae.syncDB.ForEach(func(db alpm.IDB) error {
_ = db.PkgCache().ForEach(func(pkg alpm.IPackage) error {
thisTime := pkg.BuildDate()
if thisTime.After(lastTime) {
lastTime = thisTime
}
return nil
})
return nil
})
return lastTime
}
func (ae *AlpmExecutor) Cleanup() {
if ae.handle != nil {
if err := ae.handle.Release(); err != nil {
fmt.Fprintln(os.Stderr, err)
}
}
}
func (ae *AlpmExecutor) Repos() (repos []string) {
_ = ae.syncDB.ForEach(func(db alpm.IDB) error {
repos = append(repos, db.Name())
return nil
})
return
}
func alpmSetArchitecture(alpmHandle *alpm.Handle, arch []string) error {
return alpmHandle.SetArchitectures(arch)
}
func (ae *AlpmExecutor) AlpmArchitectures() ([]string, error) {
architectures, err := ae.handle.GetArchitectures()
return architectures.Slice(), err
}
func alpmSetLogCallback(alpmHandle *alpm.Handle, cb func(alpm.LogLevel, string)) {
alpmHandle.SetLogCallback(func(ctx interface{}, lvl alpm.LogLevel, msg string) {
cbo := ctx.(func(alpm.LogLevel, string))
cbo(lvl, msg)
}, cb)
}
func alpmSetQuestionCallback(alpmHandle *alpm.Handle, cb func(alpm.QuestionAny)) {
alpmHandle.SetQuestionCallback(func(ctx interface{}, q alpm.QuestionAny) {
cbo := ctx.(func(alpm.QuestionAny))
cbo(q)
}, cb)
}

116
pkg/db/ialpm/alpm_test.go Normal file
View File

@ -0,0 +1,116 @@
//go:build !integration
// +build !integration
package ialpm
import (
"io"
"strings"
"testing"
alpm "github.com/Jguer/go-alpm/v2"
"github.com/Morganamilo/go-pacmanconf"
"github.com/stretchr/testify/assert"
"github.com/Jguer/yay/v12/pkg/text"
)
func TestAlpmExecutor(t *testing.T) {
t.Parallel()
pacmanConf := &pacmanconf.Config{
RootDir: "/",
DBPath: "/var/lib/pacman/",
CacheDir: []string{"/cachedir/", "/another/"},
HookDir: []string{"/hookdir/"},
GPGDir: "/gpgdir/",
LogFile: "/logfile",
HoldPkg: []string(nil),
IgnorePkg: []string{"ignore", "this", "package"},
IgnoreGroup: []string{"ignore", "this", "group"},
Architecture: []string{"8086"},
XferCommand: "",
NoUpgrade: []string{"noupgrade"},
NoExtract: []string{"noextract"},
CleanMethod: []string{"KeepInstalled"},
SigLevel: []string{"PackageOptional", "PackageTrustedOnly", "DatabaseOptional", "DatabaseTrustedOnly"},
LocalFileSigLevel: []string(nil),
RemoteFileSigLevel: []string(nil),
UseSyslog: false,
Color: false,
UseDelta: 0,
TotalDownload: true,
CheckSpace: true,
VerbosePkgLists: true,
DisableDownloadTimeout: false,
Repos: []pacmanconf.Repository{
{Name: "repo1", Servers: []string{"repo1"}, SigLevel: []string(nil), Usage: []string{"All"}},
{Name: "repo2", Servers: []string{"repo2"}, SigLevel: []string(nil), Usage: []string{"All"}},
},
}
aExec, err := NewExecutor(pacmanConf, text.NewLogger(io.Discard, io.Discard, strings.NewReader(""), false, "test"))
assert.NoError(t, err)
assert.NotNil(t, aExec.conf)
assert.EqualValues(t, pacmanConf, aExec.conf)
assert.NotNil(t, aExec.localDB)
assert.NotNil(t, aExec.syncDB)
assert.NotNil(t, aExec.questionCallback)
h := aExec.handle
assert.NotNil(t, h)
root, err := h.Root()
assert.Nil(t, err)
assert.Equal(t, "/", root)
dbPath, err := h.DBPath()
assert.Nil(t, err)
assert.Equal(t, "/var/lib/pacman/", dbPath)
cache, err := h.CacheDirs()
assert.Nil(t, err)
assert.Equal(t, []string{"/cachedir/", "/another/"}, cache.Slice())
log, err := h.LogFile()
assert.Nil(t, err)
assert.Equal(t, "/logfile", log)
gpg, err := h.GPGDir()
assert.Nil(t, err)
assert.Equal(t, "/gpgdir/", gpg)
hook, err := h.HookDirs()
assert.Nil(t, err)
assert.Equal(t, []string{"/usr/share/libalpm/hooks/", "/hookdir/"}, hook.Slice())
arch, err := alpmTestGetArch(h)
assert.Nil(t, err)
assert.Equal(t, []string{"8086"}, arch)
ignorePkg, err := h.IgnorePkgs()
assert.Nil(t, err)
assert.Equal(t, []string{"ignore", "this", "package"}, ignorePkg.Slice())
ignoreGroup, err := h.IgnoreGroups()
assert.Nil(t, err)
assert.Equal(t, []string{"ignore", "this", "group"}, ignoreGroup.Slice())
noUp, err := h.NoUpgrades()
assert.Nil(t, err)
assert.Equal(t, []string{"noupgrade"}, noUp.Slice())
noEx, err := h.NoExtracts()
assert.Nil(t, err)
assert.Equal(t, []string{"noextract"}, noEx.Slice())
check, err := h.CheckSpace()
assert.Nil(t, err)
assert.Equal(t, true, check)
}
func alpmTestGetArch(h *alpm.Handle) ([]string, error) {
architectures, err := h.GetArchitectures()
return architectures.Slice(), err
}

View File

@ -0,0 +1,54 @@
package ialpm
import (
alpm "github.com/Jguer/go-alpm/v2"
"github.com/Jguer/yay/v12/pkg/text"
)
// GetPackageNamesBySource returns package names with and without correspondence in SyncDBS respectively.
func (ae *AlpmExecutor) getPackageNamesBySource() {
if ae.installedRemotePkgMap == nil {
ae.installedRemotePkgMap = map[string]alpm.IPackage{}
}
for _, localpkg := range ae.LocalPackages() {
pkgName := localpkg.Name()
if ae.SyncPackage(pkgName) != nil {
ae.installedSyncPkgNames = append(ae.installedSyncPkgNames, pkgName)
} else {
ae.installedRemotePkgNames = append(ae.installedRemotePkgNames, pkgName)
ae.installedRemotePkgMap[pkgName] = localpkg
}
}
ae.log.Debugln("populating db executor package caches.",
"sync_len", len(ae.installedSyncPkgNames), "remote_len", len(ae.installedRemotePkgNames))
}
func (ae *AlpmExecutor) InstalledRemotePackages() map[string]alpm.IPackage {
if ae.installedRemotePkgMap == nil {
ae.getPackageNamesBySource()
}
return ae.installedRemotePkgMap
}
func (ae *AlpmExecutor) InstalledRemotePackageNames() []string {
if ae.installedRemotePkgNames == nil {
ae.getPackageNamesBySource()
}
return ae.installedRemotePkgNames
}
func (ae *AlpmExecutor) InstalledSyncPackageNames() []string {
if ae.installedSyncPkgNames == nil {
ae.getPackageNamesBySource()
}
return ae.installedSyncPkgNames
}
func (ae *AlpmExecutor) SetLogger(logger *text.Logger) {
ae.log = logger
}

214
pkg/db/mock/executor.go Normal file
View File

@ -0,0 +1,214 @@
package mock
import (
"time"
"github.com/Jguer/yay/v12/pkg/db"
"github.com/Jguer/yay/v12/pkg/text"
"github.com/Jguer/go-alpm/v2"
)
type (
IPackage = alpm.IPackage
Depend = alpm.Depend
Upgrade = db.Upgrade
)
type DBExecutor struct {
db.Executor
AlpmArchitecturesFn func() ([]string, error)
InstalledRemotePackageNamesFn func() []string
InstalledRemotePackagesFn func() map[string]IPackage
IsCorrectVersionInstalledFn func(string, string) bool
LocalPackageFn func(string) IPackage
LocalPackagesFn func() []IPackage
LocalSatisfierExistsFn func(string) bool
PackageDependsFn func(IPackage) []Depend
PackageOptionalDependsFn func(alpm.IPackage) []alpm.Depend
PackageProvidesFn func(IPackage) []Depend
PackagesFromGroupFn func(string) []IPackage
PackagesFromGroupAndDBFn func(string, string) ([]IPackage, error)
RefreshHandleFn func() error
ReposFn func() []string
SyncPackageFn func(string) IPackage
SyncPackagesFn func(...string) []IPackage
SyncSatisfierFn func(string) IPackage
SatisfierFromDBFn func(string, string) (IPackage, error)
SyncUpgradesFn func(bool) (map[string]db.SyncUpgrade, error)
SetLoggerFn func(*text.Logger)
}
func (t *DBExecutor) InstalledRemotePackageNames() []string {
if t.InstalledRemotePackageNamesFn != nil {
return t.InstalledRemotePackageNamesFn()
}
panic("implement me")
}
func (t *DBExecutor) InstalledRemotePackages() map[string]IPackage {
if t.InstalledRemotePackagesFn != nil {
return t.InstalledRemotePackagesFn()
}
panic("implement me")
}
func (t *DBExecutor) AlpmArchitectures() ([]string, error) {
if t.AlpmArchitecturesFn != nil {
return t.AlpmArchitecturesFn()
}
panic("implement me")
}
func (t *DBExecutor) BiggestPackages() []IPackage {
panic("implement me")
}
func (t *DBExecutor) Cleanup() {
panic("implement me")
}
func (t *DBExecutor) IsCorrectVersionInstalled(s, s2 string) bool {
if t.IsCorrectVersionInstalledFn != nil {
return t.IsCorrectVersionInstalledFn(s, s2)
}
panic("implement me")
}
func (t *DBExecutor) LastBuildTime() time.Time {
panic("implement me")
}
func (t *DBExecutor) LocalPackage(s string) IPackage {
if t.LocalPackageFn != nil {
return t.LocalPackageFn(s)
}
panic("implement me")
}
func (t *DBExecutor) LocalPackages() []IPackage {
if t.LocalPackagesFn != nil {
return t.LocalPackagesFn()
}
panic("implement me")
}
func (t *DBExecutor) LocalSatisfierExists(s string) bool {
if t.LocalSatisfierExistsFn != nil {
return t.LocalSatisfierExistsFn(s)
}
panic("implement me")
}
func (t *DBExecutor) PackageConflicts(iPackage IPackage) []Depend {
panic("implement me")
}
func (t *DBExecutor) PackageDepends(iPackage IPackage) []Depend {
if t.PackageDependsFn != nil {
return t.PackageDependsFn(iPackage)
}
panic("implement me")
}
func (t *DBExecutor) PackageGroups(iPackage IPackage) []string {
return []string{}
}
func (t *DBExecutor) PackageOptionalDepends(iPackage IPackage) []Depend {
if t.PackageOptionalDependsFn != nil {
return t.PackageOptionalDependsFn(iPackage)
}
panic("implement me")
}
func (t *DBExecutor) PackageProvides(iPackage IPackage) []Depend {
if t.PackageProvidesFn != nil {
return t.PackageProvidesFn(iPackage)
}
panic("implement me")
}
func (t *DBExecutor) PackagesFromGroup(s string) []IPackage {
if t.PackagesFromGroupFn != nil {
return t.PackagesFromGroupFn(s)
}
panic("implement me")
}
func (t *DBExecutor) PackagesFromGroupAndDB(s, s2 string) ([]IPackage, error) {
if t.PackagesFromGroupAndDBFn != nil {
return t.PackagesFromGroupAndDBFn(s, s2)
}
panic("implement me")
}
func (t *DBExecutor) RefreshHandle() error {
if t.RefreshHandleFn != nil {
return t.RefreshHandleFn()
}
panic("implement me")
}
func (t *DBExecutor) SyncUpgrades(b bool) (map[string]db.SyncUpgrade, error) {
if t.SyncUpgradesFn != nil {
return t.SyncUpgradesFn(b)
}
panic("implement me")
}
func (t *DBExecutor) Repos() []string {
if t.ReposFn != nil {
return t.ReposFn()
}
panic("implement me")
}
func (t *DBExecutor) SatisfierFromDB(s, s2 string) (IPackage, error) {
if t.SatisfierFromDBFn != nil {
return t.SatisfierFromDBFn(s, s2)
}
panic("implement me")
}
func (t *DBExecutor) SyncPackage(s string) IPackage {
if t.SyncPackageFn != nil {
return t.SyncPackageFn(s)
}
panic("implement me")
}
func (t *DBExecutor) SyncPackages(s ...string) []IPackage {
if t.SyncPackagesFn != nil {
return t.SyncPackagesFn(s...)
}
panic("implement me")
}
func (t *DBExecutor) SyncSatisfier(s string) IPackage {
if t.SyncSatisfierFn != nil {
return t.SyncSatisfierFn(s)
}
panic("implement me")
}
func (t *DBExecutor) SyncSatisfierExists(s string) bool {
if t.SyncSatisfierFn != nil {
return t.SyncSatisfierFn(s) != nil
}
panic("implement me")
}
func (t *DBExecutor) SetLogger(logger *text.Logger) {
if t.SetLoggerFn != nil {
t.SetLoggerFn(logger)
return
}
panic("implement me")
}

229
pkg/db/mock/repo.go Normal file
View File

@ -0,0 +1,229 @@
package mock
import (
"time"
alpm "github.com/Jguer/go-alpm/v2"
)
type DependList struct {
Depends []Depend
}
func (d DependList) Slice() []alpm.Depend {
return d.Depends
}
func (d DependList) ForEach(f func(*alpm.Depend) error) error {
for i := range d.Depends {
dep := &d.Depends[i]
err := f(dep)
if err != nil {
return err
}
}
return nil
}
type Package struct {
PBase string
PBuildDate time.Time
PDB *DB
PDescription string
PISize int64
PName string
PShouldIgnore bool
PSize int64
PVersion string
PReason alpm.PkgReason
PDepends alpm.IDependList
PProvides alpm.IDependList
}
func (p *Package) Base() string {
return p.PBase
}
func (p *Package) BuildDate() time.Time {
return p.PBuildDate
}
func (p *Package) DB() alpm.IDB {
return p.PDB
}
func (p *Package) Description() string {
return p.PDescription
}
func (p *Package) ISize() int64 {
return p.PISize
}
func (p *Package) Name() string {
return p.PName
}
func (p *Package) ShouldIgnore() bool {
return p.PShouldIgnore
}
func (p *Package) Size() int64 {
return p.PSize
}
func (p *Package) Version() string {
return p.PVersion
}
func (p *Package) Reason() alpm.PkgReason {
return p.PReason
}
func (p *Package) FileName() string {
panic("not implemented")
}
func (p *Package) Base64Signature() string {
panic("not implemented")
}
func (p *Package) Validation() alpm.Validation {
panic("not implemented")
}
// Architecture returns the package target Architecture.
func (p *Package) Architecture() string {
panic("not implemented")
}
// Backup returns a list of package backups.
func (p *Package) Backup() alpm.BackupList {
panic("not implemented")
}
// Conflicts returns the conflicts of the package as a DependList.
func (p *Package) Conflicts() alpm.IDependList {
panic("not implemented")
}
// Depends returns the package's dependency list.
func (p *Package) Depends() alpm.IDependList {
if p.PDepends != nil {
return p.PDepends
}
return alpm.DependList{}
}
// Depends returns the package's optional dependency list.
func (p *Package) OptionalDepends() alpm.IDependList {
panic("not implemented")
}
// Depends returns the package's check dependency list.
func (p *Package) CheckDepends() alpm.IDependList {
panic("not implemented")
}
// Depends returns the package's make dependency list.
func (p *Package) MakeDepends() alpm.IDependList {
panic("not implemented")
}
// Files returns the file list of the package.
func (p *Package) Files() []alpm.File {
panic("not implemented")
}
// ContainsFile checks if the path is in the package filelist.
func (p *Package) ContainsFile(path string) (alpm.File, error) {
panic("not implemented")
}
// Groups returns the groups the package belongs to.
func (p *Package) Groups() alpm.StringList {
panic("not implemented")
}
// InstallDate returns the package install date.
func (p *Package) InstallDate() time.Time {
panic("not implemented")
}
// Licenses returns the package license list.
func (p *Package) Licenses() alpm.StringList {
panic("not implemented")
}
// SHA256Sum returns package SHA256Sum.
func (p *Package) SHA256Sum() string {
panic("not implemented")
}
// MD5Sum returns package MD5Sum.
func (p *Package) MD5Sum() string {
panic("not implemented")
}
// Packager returns package packager name.
func (p *Package) Packager() string {
panic("not implemented")
}
// Provides returns DependList of packages provides by package.
func (p *Package) Provides() alpm.IDependList {
if p.PProvides == nil {
return alpm.DependList{}
}
return p.PProvides
}
// Origin returns package origin.
func (p *Package) Origin() alpm.PkgFrom {
panic("not implemented")
}
// Replaces returns a DependList with the packages this package replaces.
func (p *Package) Replaces() alpm.IDependList {
panic("not implemented")
}
// URL returns the upstream URL of the package.
func (p *Package) URL() string {
panic("not implemented")
}
// ComputeRequiredBy returns the names of reverse dependencies of a package.
func (p *Package) ComputeRequiredBy() []string {
panic("not implemented")
}
// ComputeOptionalFor returns the names of packages that optionally
// require the given package.
func (p *Package) ComputeOptionalFor() []string {
panic("not implemented")
}
// SyncNewVersion checks if there is a new version of the
// package in a given DBlist.
func (p *Package) SyncNewVersion(l alpm.IDBList) alpm.IPackage {
panic("not implemented")
}
func (p *Package) Type() string {
panic("not implemented")
}
type DB struct {
alpm.IDB
name string
}
func NewDB(name string) *DB {
return &DB{name: name}
}
func (d *DB) Name() string {
return d.name
}

15
pkg/db/types.go Normal file
View File

@ -0,0 +1,15 @@
package db
func ArchIsSupported(alpmArch []string, arch string) bool {
if arch == "any" {
return true
}
for _, a := range alpmArch {
if a == arch {
return true
}
}
return false
}

87
pkg/dep/dep.go Normal file
View File

@ -0,0 +1,87 @@
package dep
import (
"strings"
"github.com/Jguer/yay/v12/pkg/db"
aur "github.com/Jguer/yay/v12/pkg/query"
)
func splitDep(dep string) (pkg, mod, ver string) {
split := strings.FieldsFunc(dep, func(c rune) bool {
match := c == '>' || c == '<' || c == '='
if match {
mod += string(c)
}
return match
})
if len(split) == 0 {
return "", "", ""
}
if len(split) == 1 {
return split[0], "", ""
}
return split[0], mod, split[1]
}
func pkgSatisfies(name, version, dep string) bool {
depName, depMod, depVersion := splitDep(dep)
if depName != name {
return false
}
return verSatisfies(version, depMod, depVersion)
}
func provideSatisfies(provide, dep, pkgVersion string) bool {
depName, depMod, depVersion := splitDep(dep)
provideName, provideMod, provideVersion := splitDep(provide)
if provideName != depName {
return false
}
// Unversioned provides can not satisfy a versioned dep
if provideMod == "" && depMod != "" {
provideVersion = pkgVersion // Example package: pagure
}
return verSatisfies(provideVersion, depMod, depVersion)
}
func verSatisfies(ver1, mod, ver2 string) bool {
switch mod {
case "=":
return db.VerCmp(ver1, ver2) == 0
case "<":
return db.VerCmp(ver1, ver2) < 0
case "<=":
return db.VerCmp(ver1, ver2) <= 0
case ">":
return db.VerCmp(ver1, ver2) > 0
case ">=":
return db.VerCmp(ver1, ver2) >= 0
}
return true
}
func satisfiesAur(dep string, pkg *aur.Pkg) bool {
if pkgSatisfies(pkg.Name, pkg.Version, dep) {
return true
}
for _, provide := range pkg.Provides {
if provideSatisfies(provide, dep, pkg.Version) {
return true
}
}
return false
}

853
pkg/dep/dep_graph.go Normal file
View File

@ -0,0 +1,853 @@
package dep
import (
"context"
"fmt"
"strconv"
aurc "github.com/Jguer/aur"
alpm "github.com/Jguer/go-alpm/v2"
gosrc "github.com/Morganamilo/go-srcinfo"
mapset "github.com/deckarep/golang-set/v2"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/db"
"github.com/Jguer/yay/v12/pkg/dep/topo"
"github.com/Jguer/yay/v12/pkg/intrange"
aur "github.com/Jguer/yay/v12/pkg/query"
"github.com/Jguer/yay/v12/pkg/text"
)
type InstallInfo struct {
Source Source
Reason Reason
Version string
LocalVersion string
SrcinfoPath *string
AURBase *string
SyncDBName *string
IsGroup bool
Upgrade bool
Devel bool
}
func (i *InstallInfo) String() string {
return fmt.Sprintf("InstallInfo{Source: %v, Reason: %v}", i.Source, i.Reason)
}
type (
Reason uint
Source int
)
func (r Reason) String() string {
return ReasonNames[r]
}
func (s Source) String() string {
return SourceNames[s]
}
const (
Explicit Reason = iota // 0
Dep // 1
MakeDep // 2
CheckDep // 3
)
var ReasonNames = map[Reason]string{
Explicit: gotext.Get("Explicit"),
Dep: gotext.Get("Dependency"),
MakeDep: gotext.Get("Make Dependency"),
CheckDep: gotext.Get("Check Dependency"),
}
const (
AUR Source = iota
Sync
Local
SrcInfo
Missing
)
var SourceNames = map[Source]string{
AUR: gotext.Get("AUR"),
Sync: gotext.Get("Sync"),
Local: gotext.Get("Local"),
SrcInfo: gotext.Get("SRCINFO"),
Missing: gotext.Get("Missing"),
}
var bgColorMap = map[Source]string{
AUR: "lightblue",
Sync: "lemonchiffon",
Local: "darkolivegreen1",
Missing: "tomato",
}
var colorMap = map[Reason]string{
Explicit: "black",
Dep: "deeppink",
MakeDep: "navyblue",
CheckDep: "forestgreen",
}
type Grapher struct {
logger *text.Logger
providerCache map[string][]aur.Pkg
dbExecutor db.Executor
aurClient aurc.QueryClient
fullGraph bool // If true, the graph will include all dependencies including already installed ones or repo
noConfirm bool // If true, the graph will not prompt for confirmation
noDeps bool // If true, the graph will not include dependencies
noCheckDeps bool // If true, the graph will not include check dependencies
needed bool // If true, the graph will only include packages that are not installed
}
func NewGrapher(dbExecutor db.Executor, aurCache aurc.QueryClient,
fullGraph, noConfirm, noDeps, noCheckDeps, needed bool,
logger *text.Logger,
) *Grapher {
return &Grapher{
dbExecutor: dbExecutor,
aurClient: aurCache,
fullGraph: fullGraph,
noConfirm: noConfirm,
noDeps: noDeps,
noCheckDeps: noCheckDeps,
needed: needed,
providerCache: make(map[string][]aurc.Pkg, 5),
logger: logger,
}
}
func NewGraph() *topo.Graph[string, *InstallInfo] {
return topo.New[string, *InstallInfo]()
}
func (g *Grapher) GraphFromTargets(ctx context.Context,
graph *topo.Graph[string, *InstallInfo], targets []string,
) (*topo.Graph[string, *InstallInfo], error) {
if graph == nil {
graph = NewGraph()
}
aurTargets := make([]string, 0, len(targets))
for _, targetString := range targets {
target := ToTarget(targetString)
switch target.DB {
case "": // unspecified db
if pkg := g.dbExecutor.SyncSatisfier(target.Name); pkg != nil {
g.GraphSyncPkg(ctx, graph, pkg, nil)
continue
}
groupPackages := g.dbExecutor.PackagesFromGroup(target.Name)
if len(groupPackages) > 0 {
dbName := groupPackages[0].DB().Name()
g.GraphSyncGroup(ctx, graph, target.Name, dbName)
continue
}
fallthrough
case "aur":
aurTargets = append(aurTargets, target.Name)
default:
pkg, err := g.dbExecutor.SatisfierFromDB(target.Name, target.DB)
if err != nil {
return nil, err
}
if pkg != nil {
g.GraphSyncPkg(ctx, graph, pkg, nil)
continue
}
groupPackages, err := g.dbExecutor.PackagesFromGroupAndDB(target.Name, target.DB)
if err != nil {
return nil, err
}
if len(groupPackages) > 0 {
g.GraphSyncGroup(ctx, graph, target.Name, target.DB)
continue
}
g.logger.Errorln(gotext.Get("No package found for"), " ", target)
}
}
var errA error
graph, errA = g.GraphFromAUR(ctx, graph, aurTargets)
if errA != nil {
return nil, errA
}
return graph, nil
}
func (g *Grapher) pickSrcInfoPkgs(pkgs []*aurc.Pkg) ([]*aurc.Pkg, error) {
final := make([]*aurc.Pkg, 0, len(pkgs))
for i := range pkgs {
g.logger.Println(text.Magenta(strconv.Itoa(i+1)+" ") + text.Bold(pkgs[i].Name) +
" " + text.Cyan(pkgs[i].Version))
g.logger.Println(" " + pkgs[i].Description)
}
g.logger.Infoln(gotext.Get("Packages to exclude") + " (eg: \"1 2 3\", \"1-3\", \"^4\"):")
numberBuf, err := g.logger.GetInput("", g.noConfirm)
if err != nil {
return nil, err
}
include, exclude, _, otherExclude := intrange.ParseNumberMenu(numberBuf)
isInclude := len(exclude) == 0 && otherExclude.Cardinality() == 0
for i := 1; i <= len(pkgs); i++ {
target := i - 1
if isInclude && !include.Get(i) {
final = append(final, pkgs[target])
}
if !isInclude && (exclude.Get(i)) {
final = append(final, pkgs[target])
}
}
return final, nil
}
func (g *Grapher) addAurPkgProvides(pkg *aurc.Pkg, graph *topo.Graph[string, *InstallInfo]) {
for i := range pkg.Provides {
depName, mod, version := splitDep(pkg.Provides[i])
g.logger.Debugln(pkg.String() + " provides: " + depName)
graph.Provides(depName, &alpm.Depend{
Name: depName,
Version: version,
Mod: aurDepModToAlpmDep(mod),
}, pkg.Name)
}
}
func (g *Grapher) GraphFromSrcInfos(ctx context.Context, graph *topo.Graph[string, *InstallInfo],
srcInfos map[string]*gosrc.Srcinfo,
) (*topo.Graph[string, *InstallInfo], error) {
if graph == nil {
graph = NewGraph()
}
aurPkgsAdded := []*aurc.Pkg{}
for pkgBuildDir, pkgbuild := range srcInfos {
pkgBuildDir := pkgBuildDir
aurPkgs, err := makeAURPKGFromSrcinfo(g.dbExecutor, pkgbuild)
if err != nil {
return nil, err
}
if len(aurPkgs) > 1 {
var errPick error
aurPkgs, errPick = g.pickSrcInfoPkgs(aurPkgs)
if errPick != nil {
return nil, errPick
}
}
for _, pkg := range aurPkgs {
pkg := pkg
reason := Explicit
if pkg := g.dbExecutor.LocalPackage(pkg.Name); pkg != nil {
reason = Reason(pkg.Reason())
}
graph.AddNode(pkg.Name)
g.addAurPkgProvides(pkg, graph)
g.ValidateAndSetNodeInfo(graph, pkg.Name, &topo.NodeInfo[*InstallInfo]{
Color: colorMap[reason],
Background: bgColorMap[AUR],
Value: &InstallInfo{
Source: SrcInfo,
Reason: reason,
SrcinfoPath: &pkgBuildDir,
AURBase: &pkg.PackageBase,
Version: pkg.Version,
},
})
}
aurPkgsAdded = append(aurPkgsAdded, aurPkgs...)
}
g.AddDepsForPkgs(ctx, aurPkgsAdded, graph)
return graph, nil
}
func (g *Grapher) AddDepsForPkgs(ctx context.Context, pkgs []*aur.Pkg, graph *topo.Graph[string, *InstallInfo]) {
for _, pkg := range pkgs {
g.addDepNodes(ctx, pkg, graph)
}
}
func (g *Grapher) addDepNodes(ctx context.Context, pkg *aur.Pkg, graph *topo.Graph[string, *InstallInfo]) {
if len(pkg.MakeDepends) > 0 {
g.addNodes(ctx, graph, pkg.Name, pkg.MakeDepends, MakeDep)
}
if !g.noDeps && len(pkg.Depends) > 0 {
g.addNodes(ctx, graph, pkg.Name, pkg.Depends, Dep)
}
if !g.noCheckDeps && !g.noDeps && len(pkg.CheckDepends) > 0 {
g.addNodes(ctx, graph, pkg.Name, pkg.CheckDepends, CheckDep)
}
}
func (g *Grapher) GraphSyncPkg(ctx context.Context,
graph *topo.Graph[string, *InstallInfo],
pkg alpm.IPackage, upgradeInfo *db.SyncUpgrade,
) *topo.Graph[string, *InstallInfo] {
if graph == nil {
graph = NewGraph()
}
graph.AddNode(pkg.Name())
_ = pkg.Provides().ForEach(func(p *alpm.Depend) error {
g.logger.Debugln(pkg.Name() + " provides: " + p.String())
graph.Provides(p.Name, p, pkg.Name())
return nil
})
dbName := pkg.DB().Name()
info := &InstallInfo{
Source: Sync,
Reason: Explicit,
Version: pkg.Version(),
SyncDBName: &dbName,
}
if upgradeInfo == nil {
if localPkg := g.dbExecutor.LocalPackage(pkg.Name()); localPkg != nil {
info.Reason = Reason(localPkg.Reason())
}
} else {
info.Upgrade = true
info.Reason = Reason(upgradeInfo.Reason)
info.LocalVersion = upgradeInfo.LocalVersion
}
g.ValidateAndSetNodeInfo(graph, pkg.Name(), &topo.NodeInfo[*InstallInfo]{
Color: colorMap[info.Reason],
Background: bgColorMap[info.Source],
Value: info,
})
return graph
}
func (g *Grapher) GraphSyncGroup(ctx context.Context,
graph *topo.Graph[string, *InstallInfo],
groupName, dbName string,
) *topo.Graph[string, *InstallInfo] {
if graph == nil {
graph = NewGraph()
}
graph.AddNode(groupName)
g.ValidateAndSetNodeInfo(graph, groupName, &topo.NodeInfo[*InstallInfo]{
Color: colorMap[Explicit],
Background: bgColorMap[Sync],
Value: &InstallInfo{
Source: Sync,
Reason: Explicit,
Version: "",
SyncDBName: &dbName,
IsGroup: true,
},
})
return graph
}
func (g *Grapher) GraphAURTarget(ctx context.Context,
graph *topo.Graph[string, *InstallInfo],
pkg *aurc.Pkg, instalInfo *InstallInfo,
) *topo.Graph[string, *InstallInfo] {
if graph == nil {
graph = NewGraph()
}
graph.AddNode(pkg.Name)
g.addAurPkgProvides(pkg, graph)
g.ValidateAndSetNodeInfo(graph, pkg.Name, &topo.NodeInfo[*InstallInfo]{
Color: colorMap[instalInfo.Reason],
Background: bgColorMap[AUR],
Value: instalInfo,
})
return graph
}
func (g *Grapher) GraphFromAUR(ctx context.Context,
graph *topo.Graph[string, *InstallInfo],
targets []string,
) (*topo.Graph[string, *InstallInfo], error) {
if graph == nil {
graph = NewGraph()
}
if len(targets) == 0 {
return graph, nil
}
aurPkgs, errCache := g.aurClient.Get(ctx, &aurc.Query{By: aurc.Name, Needles: targets})
if errCache != nil {
g.logger.Errorln(errCache)
}
for i := range aurPkgs {
pkg := &aurPkgs[i]
if _, ok := g.providerCache[pkg.Name]; !ok {
g.providerCache[pkg.Name] = []aurc.Pkg{*pkg}
}
}
aurPkgsAdded := []*aurc.Pkg{}
for _, target := range targets {
if cachedProvidePkg, ok := g.providerCache[target]; ok {
aurPkgs = cachedProvidePkg
} else {
var errA error
aurPkgs, errA = g.aurClient.Get(ctx, &aurc.Query{By: aurc.Provides, Needles: []string{target}, Contains: true})
if errA != nil {
g.logger.Errorln(gotext.Get("Failed to find AUR package for"), " ", target, ":", errA)
}
}
if len(aurPkgs) == 0 {
g.logger.Errorln(gotext.Get("No AUR package found for"), " ", target)
continue
}
aurPkg := &aurPkgs[0]
if len(aurPkgs) > 1 {
chosen := g.provideMenu(target, aurPkgs)
aurPkg = chosen
g.providerCache[target] = []aurc.Pkg{*aurPkg}
}
reason := Explicit
if pkg := g.dbExecutor.LocalPackage(aurPkg.Name); pkg != nil {
reason = Reason(pkg.Reason())
if g.needed {
if db.VerCmp(pkg.Version(), aurPkg.Version) >= 0 {
g.logger.Warnln(gotext.Get("%s is up to date -- skipping", text.Cyan(pkg.Name()+"-"+pkg.Version())))
continue
}
}
}
graph = g.GraphAURTarget(ctx, graph, aurPkg, &InstallInfo{
AURBase: &aurPkg.PackageBase,
Reason: reason,
Source: AUR,
Version: aurPkg.Version,
})
aurPkgsAdded = append(aurPkgsAdded, aurPkg)
}
g.AddDepsForPkgs(ctx, aurPkgsAdded, graph)
return graph, nil
}
// Removes found deps from the deps mapset and returns the found deps.
func (g *Grapher) findDepsFromAUR(ctx context.Context,
deps mapset.Set[string],
) []aurc.Pkg {
pkgsToAdd := make([]aurc.Pkg, 0, deps.Cardinality())
if deps.Cardinality() == 0 {
return []aurc.Pkg{}
}
missingNeedles := make([]string, 0, deps.Cardinality())
for _, depString := range deps.ToSlice() {
if _, ok := g.providerCache[depString]; !ok {
depName, _, _ := splitDep(depString)
missingNeedles = append(missingNeedles, depName)
}
}
if len(missingNeedles) != 0 {
g.logger.Debugln("deps to find", missingNeedles)
// provider search is more demanding than a simple search
// try to find name match if possible and then try to find provides.
aurPkgs, errCache := g.aurClient.Get(ctx, &aurc.Query{
By: aurc.Name, Needles: missingNeedles, Contains: false,
})
if errCache != nil {
g.logger.Errorln(errCache)
}
for i := range aurPkgs {
pkg := &aurPkgs[i]
if deps.Contains(pkg.Name) {
g.providerCache[pkg.Name] = append(g.providerCache[pkg.Name], *pkg)
}
for _, val := range pkg.Provides {
if val == pkg.Name {
continue
}
if deps.Contains(val) {
g.providerCache[val] = append(g.providerCache[val], *pkg)
}
}
}
}
for _, depString := range deps.ToSlice() {
var aurPkgs []aurc.Pkg
depName, _, _ := splitDep(depString)
if cachedProvidePkg, ok := g.providerCache[depString]; ok {
aurPkgs = cachedProvidePkg
} else {
var errA error
aurPkgs, errA = g.aurClient.Get(ctx, &aurc.Query{By: aurc.Provides, Needles: []string{depName}, Contains: true})
if errA != nil {
g.logger.Errorln(gotext.Get("Failed to find AUR package for"), depString, ":", errA)
}
}
// remove packages that don't satisfy the dependency
satisfyingPkgs := make([]aurc.Pkg, 0, len(aurPkgs))
for i := range aurPkgs {
if satisfiesAur(depString, &aurPkgs[i]) {
satisfyingPkgs = append(satisfyingPkgs, aurPkgs[i])
}
}
aurPkgs = satisfyingPkgs
if len(aurPkgs) == 0 {
g.logger.Errorln(gotext.Get("No AUR package found for"), " ", depString)
continue
}
pkg := aurPkgs[0]
if len(aurPkgs) > 1 {
chosen := g.provideMenu(depString, aurPkgs)
pkg = *chosen
}
g.providerCache[depString] = []aurc.Pkg{pkg}
deps.Remove(depString)
pkgsToAdd = append(pkgsToAdd, pkg)
}
return pkgsToAdd
}
func (g *Grapher) ValidateAndSetNodeInfo(graph *topo.Graph[string, *InstallInfo],
node string, nodeInfo *topo.NodeInfo[*InstallInfo],
) {
info := graph.GetNodeInfo(node)
if info != nil && info.Value != nil {
if info.Value.Reason < nodeInfo.Value.Reason {
return // refuse to downgrade reason
}
if info.Value.Upgrade {
return // refuse to overwrite an upgrade
}
}
graph.SetNodeInfo(node, nodeInfo)
}
func (g *Grapher) addNodes(
ctx context.Context,
graph *topo.Graph[string, *InstallInfo],
parentPkgName string,
deps []string,
depType Reason,
) {
targetsToFind := mapset.NewThreadUnsafeSet(deps...)
// Check if in graph already
for _, depString := range targetsToFind.ToSlice() {
depName, _, _ := splitDep(depString)
if !graph.Exists(depName) && !graph.ProvidesExists(depName) {
continue
}
if graph.Exists(depName) {
if err := graph.DependOn(depName, parentPkgName); err != nil {
g.logger.Warnln(depString, parentPkgName, err)
}
targetsToFind.Remove(depString)
}
if p := graph.GetProviderNode(depName); p != nil {
if provideSatisfies(p.String(), depString, p.Version) {
if err := graph.DependOn(p.Provider, parentPkgName); err != nil {
g.logger.Warnln(p.Provider, parentPkgName, err)
}
targetsToFind.Remove(depString)
}
}
}
// Check installed
for _, depString := range targetsToFind.ToSlice() {
depName, _, _ := splitDep(depString)
if !g.dbExecutor.LocalSatisfierExists(depString) {
continue
}
if g.fullGraph {
g.ValidateAndSetNodeInfo(
graph,
depName,
&topo.NodeInfo[*InstallInfo]{Color: colorMap[depType], Background: bgColorMap[Local]})
if err := graph.DependOn(depName, parentPkgName); err != nil {
g.logger.Warnln(depName, parentPkgName, err)
}
}
targetsToFind.Remove(depString)
}
// Check Sync
for _, depString := range targetsToFind.ToSlice() {
alpmPkg := g.dbExecutor.SyncSatisfier(depString)
if alpmPkg == nil {
continue
}
if err := graph.DependOn(alpmPkg.Name(), parentPkgName); err != nil {
g.logger.Warnln("repo dep warn:", depString, parentPkgName, err)
}
dbName := alpmPkg.DB().Name()
g.ValidateAndSetNodeInfo(
graph,
alpmPkg.Name(),
&topo.NodeInfo[*InstallInfo]{
Color: colorMap[depType],
Background: bgColorMap[Sync],
Value: &InstallInfo{
Source: Sync,
Reason: depType,
Version: alpmPkg.Version(),
SyncDBName: &dbName,
},
})
if newDeps := alpmPkg.Depends().Slice(); len(newDeps) != 0 && g.fullGraph {
newDepsSlice := make([]string, 0, len(newDeps))
for _, newDep := range newDeps {
newDepsSlice = append(newDepsSlice, newDep.Name)
}
g.addNodes(ctx, graph, alpmPkg.Name(), newDepsSlice, Dep)
}
targetsToFind.Remove(depString)
}
// Check AUR
pkgsToAdd := g.findDepsFromAUR(ctx, targetsToFind)
for i := range pkgsToAdd {
aurPkg := &pkgsToAdd[i]
if err := graph.DependOn(aurPkg.Name, parentPkgName); err != nil {
g.logger.Warnln("aur dep warn:", aurPkg.Name, parentPkgName, err)
}
graph.SetNodeInfo(
aurPkg.Name,
&topo.NodeInfo[*InstallInfo]{
Color: colorMap[depType],
Background: bgColorMap[AUR],
Value: &InstallInfo{
Source: AUR,
Reason: depType,
AURBase: &aurPkg.PackageBase,
Version: aurPkg.Version,
},
})
g.addDepNodes(ctx, aurPkg, graph)
}
// Add missing to graph
for _, depString := range targetsToFind.ToSlice() {
depName, mod, ver := splitDep(depString)
// no dep found. add as missing
if err := graph.DependOn(depName, parentPkgName); err != nil {
g.logger.Warnln("missing dep warn:", depString, parentPkgName, err)
}
graph.SetNodeInfo(depName, &topo.NodeInfo[*InstallInfo]{
Color: colorMap[depType],
Background: bgColorMap[Missing],
Value: &InstallInfo{
Source: Missing,
Reason: depType,
Version: fmt.Sprintf("%s%s", mod, ver),
},
})
}
}
func (g *Grapher) provideMenu(dep string, options []aur.Pkg) *aur.Pkg {
size := len(options)
if size == 1 {
return &options[0]
}
str := text.Bold(gotext.Get("There are %[1]d providers available for %[2]s:", size, dep))
str += "\n"
size = 1
str += g.logger.SprintOperationInfo(gotext.Get("Repository AUR"), "\n ")
for i := range options {
str += fmt.Sprintf("%d) %s ", size, options[i].Name)
size++
}
g.logger.OperationInfoln(str)
for {
g.logger.Println(gotext.Get("\nEnter a number (default=1): "))
if g.noConfirm {
g.logger.Println("1")
return &options[0]
}
numberBuf, err := g.logger.GetInput("", false)
if err != nil {
g.logger.Errorln(err)
return &options[0]
}
if numberBuf == "" {
return &options[0]
}
num, err := strconv.Atoi(numberBuf)
if err != nil {
g.logger.Errorln(gotext.Get("invalid number: %s", numberBuf))
continue
}
if num < 1 || num >= size {
g.logger.Errorln(gotext.Get("invalid value: %d is not between %d and %d",
num, 1, size-1))
continue
}
return &options[num-1]
}
}
func makeAURPKGFromSrcinfo(dbExecutor db.Executor, srcInfo *gosrc.Srcinfo) ([]*aur.Pkg, error) {
pkgs := make([]*aur.Pkg, 0, 1)
alpmArch, err := dbExecutor.AlpmArchitectures()
if err != nil {
return nil, err
}
alpmArch = append(alpmArch, "") // srcinfo assumes no value as ""
getDesc := func(pkg *gosrc.Package) string {
if pkg.Pkgdesc != "" {
return pkg.Pkgdesc
}
return srcInfo.Pkgdesc
}
for i := range srcInfo.Packages {
pkg := &srcInfo.Packages[i]
pkgs = append(pkgs, &aur.Pkg{
ID: 0,
Name: pkg.Pkgname,
PackageBaseID: 0,
PackageBase: srcInfo.Pkgbase,
Version: srcInfo.Version(),
Description: getDesc(pkg),
URL: pkg.URL,
Depends: append(archStringToString(alpmArch, pkg.Depends),
archStringToString(alpmArch, srcInfo.Depends)...),
MakeDepends: archStringToString(alpmArch, srcInfo.MakeDepends),
CheckDepends: archStringToString(alpmArch, srcInfo.CheckDepends),
Conflicts: append(archStringToString(alpmArch, pkg.Conflicts),
archStringToString(alpmArch, srcInfo.Conflicts)...),
Provides: append(archStringToString(alpmArch, pkg.Provides),
archStringToString(alpmArch, srcInfo.Provides)...),
Replaces: append(archStringToString(alpmArch, pkg.Replaces),
archStringToString(alpmArch, srcInfo.Replaces)...),
OptDepends: append(archStringToString(alpmArch, pkg.OptDepends),
archStringToString(alpmArch, srcInfo.OptDepends)...),
Groups: pkg.Groups,
License: pkg.License,
Keywords: []string{},
})
}
return pkgs, nil
}
func archStringToString(alpmArches []string, archString []gosrc.ArchString) []string {
pkgs := make([]string, 0, len(archString))
for _, arch := range archString {
if db.ArchIsSupported(alpmArches, arch.Arch) {
pkgs = append(pkgs, arch.Value)
}
}
return pkgs
}
func aurDepModToAlpmDep(mod string) alpm.DepMod {
switch mod {
case "=":
return alpm.DepModEq
case ">=":
return alpm.DepModGE
case "<=":
return alpm.DepModLE
case ">":
return alpm.DepModGT
case "<":
return alpm.DepModLT
}
return alpm.DepModAny
}

811
pkg/dep/dep_graph_test.go Normal file
View File

@ -0,0 +1,811 @@
//go:build !integration
// +build !integration
package dep
import (
"context"
"encoding/json"
"fmt"
"io"
"os"
"testing"
aurc "github.com/Jguer/aur"
alpm "github.com/Jguer/go-alpm/v2"
"github.com/stretchr/testify/require"
"github.com/Jguer/yay/v12/pkg/db"
"github.com/Jguer/yay/v12/pkg/db/mock"
mockaur "github.com/Jguer/yay/v12/pkg/dep/mock"
aur "github.com/Jguer/yay/v12/pkg/query"
"github.com/Jguer/yay/v12/pkg/text"
)
func ptrString(s string) *string {
return &s
}
func getFromFile(t *testing.T, filePath string) mockaur.GetFunc {
f, err := os.Open(filePath)
require.NoError(t, err)
fBytes, err := io.ReadAll(f)
require.NoError(t, err)
pkgs := []aur.Pkg{}
err = json.Unmarshal(fBytes, &pkgs)
require.NoError(t, err)
return func(ctx context.Context, query *aurc.Query) ([]aur.Pkg, error) {
return pkgs, nil
}
}
func TestGrapher_GraphFromTargets_jellyfin(t *testing.T) {
mockDB := &mock.DBExecutor{
SyncPackageFn: func(string) mock.IPackage { return nil },
SyncSatisfierFn: func(s string) mock.IPackage {
switch s {
case "jellyfin":
return nil
case "dotnet-runtime-6.0":
return &mock.Package{
PName: "dotnet-runtime-6.0",
PBase: "dotnet-runtime-6.0",
PVersion: "6.0.100-1",
PDB: mock.NewDB("community"),
}
case "dotnet-sdk-6.0":
return &mock.Package{
PName: "dotnet-sdk-6.0",
PBase: "dotnet-sdk-6.0",
PVersion: "6.0.100-1",
PDB: mock.NewDB("community"),
}
}
return nil
},
PackagesFromGroupFn: func(string) []mock.IPackage { return nil },
LocalSatisfierExistsFn: func(s string) bool {
switch s {
case "dotnet-sdk-6.0", "dotnet-runtime-6.0", "jellyfin-server=10.8.8", "jellyfin-web=10.8.8":
return false
}
return true
},
LocalPackageFn: func(string) mock.IPackage { return nil },
}
mockAUR := &mockaur.MockAUR{GetFn: func(ctx context.Context, query *aurc.Query) ([]aur.Pkg, error) {
if query.Needles[0] == "jellyfin" {
jfinFn := getFromFile(t, "testdata/jellyfin.json")
return jfinFn(ctx, query)
}
if query.Needles[0] == "jellyfin-web" {
jfinWebFn := getFromFile(t, "testdata/jellyfin-web.json")
return jfinWebFn(ctx, query)
}
if query.Needles[0] == "jellyfin-server" {
jfinServerFn := getFromFile(t, "testdata/jellyfin-server.json")
return jfinServerFn(ctx, query)
}
panic(fmt.Sprintf("implement me %v", query.Needles))
}}
type fields struct {
dbExecutor db.Executor
aurCache aurc.QueryClient
noDeps bool
noCheckDeps bool
}
type args struct {
targets []string
}
tests := []struct {
name string
fields fields
args args
want []map[string]*InstallInfo
wantErr bool
}{
{
name: "noDeps",
fields: fields{
dbExecutor: mockDB,
aurCache: mockAUR,
noDeps: true,
noCheckDeps: false,
},
args: args{
targets: []string{"jellyfin"},
},
want: []map[string]*InstallInfo{
{
"jellyfin": {
Source: AUR,
Reason: Explicit,
Version: "10.8.8-1",
AURBase: ptrString("jellyfin"),
},
},
{
"dotnet-sdk-6.0": {
Source: Sync,
Reason: MakeDep,
Version: "6.0.100-1",
SyncDBName: ptrString("community"),
},
},
},
wantErr: false,
},
{
name: "deps",
fields: fields{
dbExecutor: mockDB,
aurCache: mockAUR,
noDeps: false,
noCheckDeps: false,
},
args: args{
targets: []string{"jellyfin"},
},
want: []map[string]*InstallInfo{
{
"jellyfin": {
Source: AUR,
Reason: Explicit,
Version: "10.8.8-1",
AURBase: ptrString("jellyfin"),
},
},
{
"jellyfin-web": {
Source: AUR,
Reason: Dep,
Version: "10.8.8-1",
AURBase: ptrString("jellyfin"),
},
"jellyfin-server": {
Source: AUR,
Reason: Dep,
Version: "10.8.8-1",
AURBase: ptrString("jellyfin"),
},
},
{
"dotnet-sdk-6.0": {
Source: Sync,
Reason: MakeDep,
Version: "6.0.100-1",
SyncDBName: ptrString("community"),
},
"dotnet-runtime-6.0": {
Source: Sync,
Reason: Dep,
Version: "6.0.100-1",
SyncDBName: ptrString("community"),
},
},
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
g := NewGrapher(tt.fields.dbExecutor,
tt.fields.aurCache, false, true,
tt.fields.noDeps, tt.fields.noCheckDeps, false,
text.NewLogger(io.Discard, io.Discard, &os.File{}, true, "test"))
got, err := g.GraphFromTargets(context.Background(), nil, tt.args.targets)
require.NoError(t, err)
layers := got.TopoSortedLayerMap(nil)
require.EqualValues(t, tt.want, layers, layers)
})
}
}
func TestGrapher_GraphProvides_androidsdk(t *testing.T) {
mockDB := &mock.DBExecutor{
SyncPackageFn: func(string) mock.IPackage { return nil },
SyncSatisfierFn: func(s string) mock.IPackage {
switch s {
case "android-sdk":
return nil
case "jdk11-openjdk":
return &mock.Package{
PName: "jdk11-openjdk",
PVersion: "11.0.12.u7-1",
PDB: mock.NewDB("community"),
PProvides: mock.DependList{
Depends: []alpm.Depend{
{Name: "java-environment", Version: "11", Mod: alpm.DepModEq},
{Name: "java-environment-openjdk", Version: "11", Mod: alpm.DepModEq},
{Name: "jdk11-openjdk", Version: "11.0.19.u7-1", Mod: alpm.DepModEq},
},
},
}
case "java-environment":
panic("not supposed to be called")
}
panic("implement me " + s)
},
PackagesFromGroupFn: func(string) []mock.IPackage { return nil },
LocalSatisfierExistsFn: func(s string) bool {
switch s {
case "java-environment":
return false
}
switch s {
case "libxtst", "fontconfig", "freetype2", "lib32-gcc-libs", "lib32-glibc", "libx11", "libxext", "libxrender", "zlib", "gcc-libs":
return true
}
panic("implement me " + s)
},
LocalPackageFn: func(string) mock.IPackage { return nil },
}
mockAUR := &mockaur.MockAUR{GetFn: func(ctx context.Context, query *aurc.Query) ([]aur.Pkg, error) {
if query.Needles[0] == "android-sdk" {
jfinFn := getFromFile(t, "testdata/android-sdk.json")
return jfinFn(ctx, query)
}
panic(fmt.Sprintf("implement me %v", query.Needles))
}}
type fields struct {
dbExecutor db.Executor
aurCache aurc.QueryClient
noDeps bool
noCheckDeps bool
}
type args struct {
targets []string
}
tests := []struct {
name string
fields fields
args args
want []map[string]*InstallInfo
wantErr bool
}{
{
name: "explicit dep",
fields: fields{
dbExecutor: mockDB,
aurCache: mockAUR,
noDeps: false,
noCheckDeps: false,
},
args: args{
targets: []string{"android-sdk", "jdk11-openjdk"},
},
want: []map[string]*InstallInfo{
{
"android-sdk": {
Source: AUR,
Reason: Explicit,
Version: "26.1.1-2",
AURBase: ptrString("android-sdk"),
},
},
{
"jdk11-openjdk": {
Source: Sync,
Reason: Explicit,
Version: "11.0.12.u7-1",
SyncDBName: ptrString("community"),
},
},
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
g := NewGrapher(tt.fields.dbExecutor,
tt.fields.aurCache, false, true,
tt.fields.noDeps, tt.fields.noCheckDeps, false,
text.NewLogger(io.Discard, io.Discard, &os.File{}, true, "test"))
got, err := g.GraphFromTargets(context.Background(), nil, tt.args.targets)
require.NoError(t, err)
layers := got.TopoSortedLayerMap(nil)
require.EqualValues(t, tt.want, layers, layers)
})
}
}
func TestGrapher_GraphFromAUR_Deps_ceph_bin(t *testing.T) {
mockDB := &mock.DBExecutor{
SyncPackageFn: func(string) mock.IPackage { return nil },
PackagesFromGroupFn: func(string) []mock.IPackage { return []mock.IPackage{} },
SyncSatisfierFn: func(s string) mock.IPackage {
switch s {
case "ceph-bin", "ceph-libs-bin":
return nil
case "ceph", "ceph-libs", "ceph-libs=17.2.6-2":
return nil
}
panic("implement me " + s)
},
LocalSatisfierExistsFn: func(s string) bool {
switch s {
case "ceph-libs", "ceph-libs=17.2.6-2":
return false
case "dep1", "dep2", "dep3", "makedep1", "makedep2", "checkdep1":
return true
}
panic("implement me " + s)
},
LocalPackageFn: func(string) mock.IPackage { return nil },
}
mockAUR := &mockaur.MockAUR{GetFn: func(ctx context.Context, query *aurc.Query) ([]aur.Pkg, error) {
mockPkgs := map[string]aur.Pkg{
"ceph-bin": {
Name: "ceph-bin",
PackageBase: "ceph-bin",
Version: "17.2.6-2",
Depends: []string{"ceph-libs=17.2.6-2", "dep1"},
Provides: []string{"ceph=17.2.6-2"},
},
"ceph-libs-bin": {
Name: "ceph-libs-bin",
PackageBase: "ceph-bin",
Version: "17.2.6-2",
Depends: []string{"dep1", "dep2"},
Provides: []string{"ceph-libs=17.2.6-2"},
},
"ceph": {
Name: "ceph",
PackageBase: "ceph",
Version: "17.2.6-2",
Depends: []string{"ceph-libs=17.2.6-2", "dep1"},
MakeDepends: []string{"makedep1"},
CheckDepends: []string{"checkdep1"},
Provides: []string{"ceph=17.2.6-2"},
},
"ceph-libs": {
Name: "ceph-libs",
PackageBase: "ceph",
Version: "17.2.6-2",
Depends: []string{"dep1", "dep2", "dep3"},
MakeDepends: []string{"makedep1", "makedep2"},
CheckDepends: []string{"checkdep1"},
Provides: []string{"ceph-libs=17.2.6-2"},
},
}
pkgs := []aur.Pkg{}
for _, needle := range query.Needles {
if pkg, ok := mockPkgs[needle]; ok {
pkgs = append(pkgs, pkg)
} else {
panic(fmt.Sprintf("implement me %v", needle))
}
}
return pkgs, nil
}}
installInfos := map[string]*InstallInfo{
"ceph-bin exp": {
Source: AUR,
Reason: Explicit,
Version: "17.2.6-2",
AURBase: ptrString("ceph-bin"),
},
"ceph-libs-bin exp": {
Source: AUR,
Reason: Explicit,
Version: "17.2.6-2",
AURBase: ptrString("ceph-bin"),
},
"ceph exp": {
Source: AUR,
Reason: Explicit,
Version: "17.2.6-2",
AURBase: ptrString("ceph"),
},
"ceph-libs exp": {
Source: AUR,
Reason: Explicit,
Version: "17.2.6-2",
AURBase: ptrString("ceph"),
},
"ceph-libs dep": {
Source: AUR,
Reason: Dep,
Version: "17.2.6-2",
AURBase: ptrString("ceph"),
},
}
tests := []struct {
name string
targets []string
wantLayers []map[string]*InstallInfo
wantErr bool
}{
{
name: "ceph-bin ceph-libs-bin",
targets: []string{"ceph-bin", "ceph-libs-bin"},
wantLayers: []map[string]*InstallInfo{
{"ceph-bin": installInfos["ceph-bin exp"]},
{"ceph-libs-bin": installInfos["ceph-libs-bin exp"]},
},
wantErr: false,
},
{
name: "ceph-libs-bin ceph-bin (reversed order)",
targets: []string{"ceph-libs-bin", "ceph-bin"},
wantLayers: []map[string]*InstallInfo{
{"ceph-bin": installInfos["ceph-bin exp"]},
{"ceph-libs-bin": installInfos["ceph-libs-bin exp"]},
},
wantErr: false,
},
{
name: "ceph",
targets: []string{"ceph"},
wantLayers: []map[string]*InstallInfo{
{"ceph": installInfos["ceph exp"]},
{"ceph-libs": installInfos["ceph-libs dep"]},
},
wantErr: false,
},
{
name: "ceph-bin",
targets: []string{"ceph-bin"},
wantLayers: []map[string]*InstallInfo{
{"ceph-bin": installInfos["ceph-bin exp"]},
{"ceph-libs": installInfos["ceph-libs dep"]},
},
wantErr: false,
},
{
name: "ceph-bin ceph-libs",
targets: []string{"ceph-bin", "ceph-libs"},
wantLayers: []map[string]*InstallInfo{
{"ceph-bin": installInfos["ceph-bin exp"]},
{"ceph-libs": installInfos["ceph-libs exp"]},
},
wantErr: false,
},
{
name: "ceph-libs ceph-bin (reversed order)",
targets: []string{"ceph-libs", "ceph-bin"},
wantLayers: []map[string]*InstallInfo{
{"ceph-bin": installInfos["ceph-bin exp"]},
{"ceph-libs": installInfos["ceph-libs exp"]},
},
wantErr: false,
},
{
name: "ceph ceph-libs-bin",
targets: []string{"ceph", "ceph-libs-bin"},
wantLayers: []map[string]*InstallInfo{
{"ceph": installInfos["ceph exp"]},
{"ceph-libs-bin": installInfos["ceph-libs-bin exp"]},
},
wantErr: false,
},
{
name: "ceph-libs-bin ceph (reversed order)",
targets: []string{"ceph-libs-bin", "ceph"},
wantLayers: []map[string]*InstallInfo{
{"ceph": installInfos["ceph exp"]},
{"ceph-libs-bin": installInfos["ceph-libs-bin exp"]},
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
g := NewGrapher(mockDB, mockAUR,
false, true, false, false, false,
text.NewLogger(io.Discard, io.Discard, &os.File{}, true, "test"))
got, err := g.GraphFromTargets(context.Background(), nil, tt.targets)
require.NoError(t, err)
layers := got.TopoSortedLayerMap(nil)
require.EqualValues(t, tt.wantLayers, layers, layers)
})
}
}
func TestGrapher_GraphFromAUR_Deps_gourou(t *testing.T) {
mockDB := &mock.DBExecutor{
SyncPackageFn: func(string) mock.IPackage { return nil },
PackagesFromGroupFn: func(string) []mock.IPackage { return []mock.IPackage{} },
SyncSatisfierFn: func(s string) mock.IPackage {
switch s {
case "gourou", "libzip-git":
return nil
case "libzip":
return &mock.Package{
PName: "libzip",
PVersion: "1.9.2-1",
PDB: mock.NewDB("extra"),
}
}
panic("implement me " + s)
},
LocalSatisfierExistsFn: func(s string) bool {
switch s {
case "gourou", "libzip", "libzip-git":
return false
case "dep1", "dep2":
return true
}
panic("implement me " + s)
},
LocalPackageFn: func(string) mock.IPackage { return nil },
}
mockAUR := &mockaur.MockAUR{GetFn: func(ctx context.Context, query *aurc.Query) ([]aur.Pkg, error) {
mockPkgs := map[string]aur.Pkg{
"gourou": {
Name: "gourou",
PackageBase: "gourou",
Version: "0.8.1",
Depends: []string{"libzip"},
},
"libzip-git": {
Name: "libzip-git",
PackageBase: "libzip-git",
Version: "1.9.2.r159.gb3ac716c-1",
Depends: []string{"dep1", "dep2"},
Provides: []string{"libzip=1.9.2.r159.gb3ac716c"},
},
}
pkgs := []aur.Pkg{}
for _, needle := range query.Needles {
if pkg, ok := mockPkgs[needle]; ok {
pkgs = append(pkgs, pkg)
} else {
panic(fmt.Sprintf("implement me %v", needle))
}
}
return pkgs, nil
}}
installInfos := map[string]*InstallInfo{
"gourou exp": {
Source: AUR,
Reason: Explicit,
Version: "0.8.1",
AURBase: ptrString("gourou"),
},
"libzip dep": {
Source: Sync,
Reason: Dep,
Version: "1.9.2-1",
SyncDBName: ptrString("extra"),
},
"libzip exp": {
Source: Sync,
Reason: Explicit,
Version: "1.9.2-1",
SyncDBName: ptrString("extra"),
},
"libzip-git exp": {
Source: AUR,
Reason: Explicit,
Version: "1.9.2.r159.gb3ac716c-1",
AURBase: ptrString("libzip-git"),
},
}
tests := []struct {
name string
targets []string
wantLayers []map[string]*InstallInfo
wantErr bool
}{
{
name: "gourou",
targets: []string{"gourou"},
wantLayers: []map[string]*InstallInfo{
{"gourou": installInfos["gourou exp"]},
{"libzip": installInfos["libzip dep"]},
},
wantErr: false,
},
{
name: "gourou libzip",
targets: []string{"gourou", "libzip"},
wantLayers: []map[string]*InstallInfo{
{"gourou": installInfos["gourou exp"]},
{"libzip": installInfos["libzip exp"]},
},
wantErr: false,
},
{
name: "gourou libzip-git",
targets: []string{"gourou", "libzip-git"},
wantLayers: []map[string]*InstallInfo{
{"gourou": installInfos["gourou exp"]},
{"libzip-git": installInfos["libzip-git exp"]},
},
wantErr: false,
},
{
name: "libzip-git gourou (reversed order)",
targets: []string{"libzip-git", "gourou"},
wantLayers: []map[string]*InstallInfo{
{"gourou": installInfos["gourou exp"]},
{"libzip-git": installInfos["libzip-git exp"]},
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
g := NewGrapher(mockDB, mockAUR,
false, true, false, false, false,
text.NewLogger(io.Discard, io.Discard, &os.File{}, true, "test"))
got, err := g.GraphFromTargets(context.Background(), nil, tt.targets)
require.NoError(t, err)
layers := got.TopoSortedLayerMap(nil)
require.EqualValues(t, tt.wantLayers, layers, layers)
})
}
}
func TestGrapher_GraphFromTargets_ReinstalledDeps(t *testing.T) {
mockDB := &mock.DBExecutor{
SyncPackageFn: func(string) mock.IPackage { return nil },
PackagesFromGroupFn: func(string) []mock.IPackage { return []mock.IPackage{} },
SyncSatisfierFn: func(s string) mock.IPackage {
switch s {
case "gourou":
return nil
case "libzip":
return &mock.Package{
PName: "libzip",
PVersion: "1.9.2-1",
PDB: mock.NewDB("extra"),
}
}
panic("implement me " + s)
},
SatisfierFromDBFn: func(s, s2 string) (mock.IPackage, error) {
if s2 == "extra" {
switch s {
case "libzip":
return &mock.Package{
PName: "libzip",
PVersion: "1.9.2-1",
PDB: mock.NewDB("extra"),
}, nil
}
}
panic("implement me " + s2 + "/" + s)
},
LocalSatisfierExistsFn: func(s string) bool {
switch s {
case "gourou", "libzip":
return true
}
panic("implement me " + s)
},
LocalPackageFn: func(s string) mock.IPackage {
switch s {
case "libzip":
return &mock.Package{
PName: "libzip",
PVersion: "1.9.2-1",
PDB: mock.NewDB("extra"),
PReason: alpm.PkgReasonDepend,
}
case "gourou":
return &mock.Package{
PName: "gourou",
PVersion: "0.8.1",
PDB: mock.NewDB("aur"),
PReason: alpm.PkgReasonDepend,
}
}
return nil
},
}
mockAUR := &mockaur.MockAUR{GetFn: func(ctx context.Context, query *aurc.Query) ([]aur.Pkg, error) {
mockPkgs := map[string]aur.Pkg{
"gourou": {
Name: "gourou",
PackageBase: "gourou",
Version: "0.8.1",
Depends: []string{"libzip"},
},
}
pkgs := []aur.Pkg{}
for _, needle := range query.Needles {
if pkg, ok := mockPkgs[needle]; ok {
pkgs = append(pkgs, pkg)
} else {
panic(fmt.Sprintf("implement me %v", needle))
}
}
return pkgs, nil
}}
installInfos := map[string]*InstallInfo{
"gourou dep": {
Source: AUR,
Reason: Dep,
Version: "0.8.1",
AURBase: ptrString("gourou"),
},
"libzip dep": {
Source: Sync,
Reason: Dep,
Version: "1.9.2-1",
SyncDBName: ptrString("extra"),
},
}
tests := []struct {
name string
targets []string
wantLayers []map[string]*InstallInfo
wantErr bool
}{
{
name: "gourou libzip",
targets: []string{"gourou", "libzip"},
wantLayers: []map[string]*InstallInfo{
{"gourou": installInfos["gourou dep"]},
{"libzip": installInfos["libzip dep"]},
},
wantErr: false,
},
{
name: "aur/gourou extra/libzip",
targets: []string{"aur/gourou", "extra/libzip"},
wantLayers: []map[string]*InstallInfo{
{"gourou": installInfos["gourou dep"]},
{"libzip": installInfos["libzip dep"]},
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
g := NewGrapher(mockDB, mockAUR,
false, true, false, false, false,
text.NewLogger(io.Discard, io.Discard, &os.File{}, true, "test"))
got, err := g.GraphFromTargets(context.Background(), nil, tt.targets)
require.NoError(t, err)
layers := got.TopoSortedLayerMap(nil)
require.EqualValues(t, tt.wantLayers, layers, layers)
})
}
}

21
pkg/dep/mock/aur.go Normal file
View File

@ -0,0 +1,21 @@
package mock
import (
"context"
"github.com/Jguer/aur"
)
type GetFunc func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error)
type MockAUR struct {
GetFn GetFunc
}
func (m *MockAUR) Get(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
if m.GetFn != nil {
return m.GetFn(ctx, query)
}
panic("implement me")
}

34
pkg/dep/target_handler.go Normal file
View File

@ -0,0 +1,34 @@
package dep
import "github.com/Jguer/yay/v12/pkg/text"
type Target struct {
DB string
Name string
Mod string
Version string
}
func ToTarget(pkg string) Target {
dbName, depString := text.SplitDBFromName(pkg)
name, mod, depVersion := splitDep(depString)
return Target{
DB: dbName,
Name: name,
Mod: mod,
Version: depVersion,
}
}
func (t Target) DepString() string {
return t.Name + t.Mod + t.Version
}
func (t Target) String() string {
if t.DB != "" {
return t.DB + "/" + t.DepString()
}
return t.DepString()
}

3
pkg/dep/testdata/android-sdk.json vendored Normal file
View File

@ -0,0 +1,3 @@
[
{"ID":1055234,"Name":"android-sdk","PackageBaseID":13751,"PackageBase":"android-sdk","Version":"26.1.1-2","Description":"Google Android SDK","URL":"https://developer.android.com/studio/releases/sdk-tools.html","NumVotes":1487,"Popularity":0.802316,"OutOfDate":null,"Maintainer":"dreamingincode","Submitter":null,"FirstSubmitted":1194895596,"LastModified":1647982720,"URLPath":"/cgit/aur.git/snapshot/android-sdk.tar.gz","Depends":["java-environment","libxtst","fontconfig","freetype2","lib32-gcc-libs","lib32-glibc","libx11","libxext","libxrender","zlib","gcc-libs"],"OptDepends":["android-emulator","android-sdk-platform-tools","android-udev"],"License":["custom"],"Keywords":["android","development"]}
]

3
pkg/dep/testdata/jellyfin-server.json vendored Normal file
View File

@ -0,0 +1,3 @@
[
{"ID":1176791,"Name":"jellyfin-server","PackageBaseID":138631,"PackageBase":"jellyfin","Version":"10.8.8-1","Description":"Jellyfin server component","URL":"https://github.com/jellyfin/jellyfin","NumVotes":84,"Popularity":1.272964,"OutOfDate":null,"Maintainer":"z3ntu","Submitter":"z3ntu","FirstSubmitted":1547053171,"LastModified":1669830147,"URLPath":"/cgit/aur.git/snapshot/jellyfin-server.tar.gz","Depends":["dotnet-runtime-6.0","aspnet-runtime-6.0","ffmpeg","sqlite"],"MakeDepends":["dotnet-sdk-6.0","nodejs","npm","git"],"License":["GPL2"]}
]

3
pkg/dep/testdata/jellyfin-web.json vendored Normal file
View File

@ -0,0 +1,3 @@
[
{"ID":1176790,"Name":"jellyfin-web","PackageBaseID":138631,"PackageBase":"jellyfin","Version":"10.8.8-1","Description":"Jellyfin web client","URL":"https://github.com/jellyfin/jellyfin","NumVotes":84,"Popularity":1.272964,"OutOfDate":null,"Maintainer":"z3ntu","Submitter":"z3ntu","FirstSubmitted":1547053171,"LastModified":1669830147,"URLPath":"/cgit/aur.git/snapshot/jellyfin-web.tar.gz","MakeDepends":["dotnet-sdk-6.0","nodejs","npm","git"],"License":["GPL2"]}
]

3
pkg/dep/testdata/jellyfin.json vendored Normal file
View File

@ -0,0 +1,3 @@
[
{"ID":1176789,"Name":"jellyfin","PackageBaseID":138631,"PackageBase":"jellyfin","Version":"10.8.8-1","Description":"The Free Software Media System","URL":"https://github.com/jellyfin/jellyfin","NumVotes":84,"Popularity":1.272964,"OutOfDate":null,"Maintainer":"z3ntu","Submitter":"z3ntu","FirstSubmitted":1547053171,"LastModified":1669830147,"URLPath":"/cgit/aur.git/snapshot/jellyfin.tar.gz","Depends":["jellyfin-web=10.8.8","jellyfin-server=10.8.8"],"MakeDepends":["dotnet-sdk-6.0","nodejs","npm","git"],"License":["GPL2"]}
]

371
pkg/dep/topo/dep.go Normal file
View File

@ -0,0 +1,371 @@
package topo
import (
"fmt"
"strings"
"github.com/Jguer/go-alpm/v2"
)
type (
NodeSet[T comparable] map[T]bool
ProvidesMap[T comparable] map[T]*DependencyInfo[T]
DepMap[T comparable] map[T]NodeSet[T]
)
func (n NodeSet[T]) Slice() []T {
var slice []T
for node := range n {
slice = append(slice, node)
}
return slice
}
type NodeInfo[V any] struct {
Color string
Background string
Value V
}
type DependencyInfo[T comparable] struct {
Provider T
alpm.Depend
}
type CheckFn[T comparable, V any] func(T, V) error
type Graph[T comparable, V any] struct {
nodes NodeSet[T]
// node info map
nodeInfo map[T]*NodeInfo[V]
// `provides` tracks provides -> node.
provides ProvidesMap[T]
// `dependencies` tracks child -> parents.
dependencies DepMap[T]
// `dependents` tracks parent -> children.
dependents DepMap[T]
}
func New[T comparable, V any]() *Graph[T, V] {
return &Graph[T, V]{
nodes: make(NodeSet[T]),
dependencies: make(DepMap[T]),
dependents: make(DepMap[T]),
nodeInfo: make(map[T]*NodeInfo[V]),
provides: make(ProvidesMap[T]),
}
}
func (g *Graph[T, V]) Len() int {
return len(g.nodes)
}
func (g *Graph[T, V]) Exists(node T) bool {
_, ok := g.nodes[node]
return ok
}
func (g *Graph[T, V]) AddNode(node T) {
g.nodes[node] = true
}
func (g *Graph[T, V]) ProvidesExists(provides T) bool {
_, ok := g.provides[provides]
return ok
}
func (g *Graph[T, V]) GetProviderNode(provides T) *DependencyInfo[T] {
return g.provides[provides]
}
func (g *Graph[T, V]) Provides(provides T, depInfo *alpm.Depend, node T) {
g.provides[provides] = &DependencyInfo[T]{
Provider: node,
Depend: *depInfo,
}
}
func (g *Graph[T, V]) ForEach(f CheckFn[T, V]) error {
for node := range g.nodes {
if err := f(node, g.nodeInfo[node].Value); err != nil {
return err
}
}
return nil
}
func (g *Graph[T, V]) SetNodeInfo(node T, nodeInfo *NodeInfo[V]) {
g.nodeInfo[node] = nodeInfo
}
func (g *Graph[T, V]) GetNodeInfo(node T) *NodeInfo[V] {
return g.nodeInfo[node]
}
func (g *Graph[T, V]) DependOn(child, parent T) error {
if child == parent {
return ErrSelfReferential
}
if g.DependsOn(parent, child) {
return ErrCircular
}
g.AddNode(parent)
g.AddNode(child)
// Add edges.
g.dependents.addNodeToNodeset(parent, child)
g.dependencies.addNodeToNodeset(child, parent)
return nil
}
func (g *Graph[T, V]) String() string {
var sb strings.Builder
sb.WriteString("digraph {\n")
sb.WriteString("compound=true;\n")
sb.WriteString("concentrate=true;\n")
sb.WriteString("node [shape = record, ordering=out];\n")
for node := range g.nodes {
extra := ""
if info, ok := g.nodeInfo[node]; ok {
if info.Background != "" || info.Color != "" {
extra = fmt.Sprintf("[color = %s, style = filled, fillcolor = %s]", info.Color, info.Background)
}
}
sb.WriteString(fmt.Sprintf("\t\"%v\"%s;\n", node, extra))
}
for parent, children := range g.dependencies {
for child := range children {
sb.WriteString(fmt.Sprintf("\t\"%v\" -> \"%v\";\n", parent, child))
}
}
sb.WriteString("}")
return sb.String()
}
func (g *Graph[T, V]) DependsOn(child, parent T) bool {
deps := g.Dependencies(child)
_, ok := deps[parent]
return ok
}
func (g *Graph[T, V]) HasDependent(parent, child T) bool {
deps := g.Dependents(parent)
_, ok := deps[child]
return ok
}
// leavesMap returns a map of leaves with the node as key and the node info value as value.
func (g *Graph[T, V]) leavesMap() map[T]V {
leaves := make(map[T]V, 0)
for node := range g.nodes {
if _, ok := g.dependencies[node]; !ok {
nodeInfo := g.GetNodeInfo(node)
if nodeInfo == nil {
nodeInfo = &NodeInfo[V]{}
}
leaves[node] = nodeInfo.Value
}
}
return leaves
}
// TopoSortedLayerMap returns a slice of all of the graph nodes in topological sort order with their node info.
func (g *Graph[T, V]) TopoSortedLayerMap(checkFn CheckFn[T, V]) []map[T]V {
layers := []map[T]V{}
// Copy the graph
shrinkingGraph := g.clone()
for {
leaves := shrinkingGraph.leavesMap()
if len(leaves) == 0 {
break
}
layers = append(layers, leaves)
for leafNode := range leaves {
if checkFn != nil {
if err := checkFn(leafNode, leaves[leafNode]); err != nil {
return nil
}
}
shrinkingGraph.remove(leafNode)
}
}
return layers
}
// returns if it was the last
func (dm DepMap[T]) removeFromDepmap(key, node T) bool {
if nodes := dm[key]; len(nodes) == 1 {
// The only element in the nodeset must be `node`, so we
// can delete the entry entirely.
delete(dm, key)
return true
} else {
// Otherwise, remove the single node from the nodeset.
delete(nodes, node)
return false
}
}
// Prune removes the node,
// its dependencies if there are no other dependents
// and its dependents
func (g *Graph[T, V]) Prune(node T) []T {
pruned := []T{node}
// Remove edges from things that depend on `node`.
for dependent := range g.dependents[node] {
last := g.dependencies.removeFromDepmap(dependent, node)
if last {
pruned = append(pruned, g.Prune(dependent)...)
}
}
delete(g.dependents, node)
// Remove all edges from node to the things it depends on.
for dependency := range g.dependencies[node] {
last := g.dependents.removeFromDepmap(dependency, node)
if last {
pruned = append(pruned, g.Prune(dependency)...)
}
}
delete(g.dependencies, node)
// Finally, remove the node itself.
delete(g.nodes, node)
return pruned
}
func (g *Graph[T, V]) remove(node T) {
// Remove edges from things that depend on `node`.
for dependent := range g.dependents[node] {
g.dependencies.removeFromDepmap(dependent, node)
}
delete(g.dependents, node)
// Remove all edges from node to the things it depends on.
for dependency := range g.dependencies[node] {
g.dependents.removeFromDepmap(dependency, node)
}
delete(g.dependencies, node)
// Finally, remove the node itself.
delete(g.nodes, node)
}
func (g *Graph[T, V]) Dependencies(child T) NodeSet[T] {
return g.buildTransitive(child, g.ImmediateDependencies)
}
func (g *Graph[T, V]) ImmediateDependencies(node T) NodeSet[T] {
return g.dependencies[node]
}
func (g *Graph[T, V]) Dependents(parent T) NodeSet[T] {
return g.buildTransitive(parent, g.immediateDependents)
}
func (g *Graph[T, V]) immediateDependents(node T) NodeSet[T] {
return g.dependents[node]
}
func (g *Graph[T, V]) clone() *Graph[T, V] {
return &Graph[T, V]{
dependencies: g.dependencies.copy(),
dependents: g.dependents.copy(),
nodes: g.nodes.copy(),
nodeInfo: g.nodeInfo, // not copied, as it is not modified
}
}
// buildTransitive starts at `root` and continues calling `nextFn` to keep discovering more nodes until
// the graph cannot produce any more. It returns the set of all discovered nodes.
func (g *Graph[T, V]) buildTransitive(root T, nextFn func(T) NodeSet[T]) NodeSet[T] {
if _, ok := g.nodes[root]; !ok {
return nil
}
out := make(NodeSet[T])
searchNext := []T{root}
for len(searchNext) > 0 {
// List of new nodes from this layer of the dependency graph. This is
// assigned to `searchNext` at the end of the outer "discovery" loop.
discovered := []T{}
for _, node := range searchNext {
// For each node to discover, find the next nodes.
for nextNode := range nextFn(node) {
// If we have not seen the node before, add it to the output as well
// as the list of nodes to traverse in the next iteration.
if _, ok := out[nextNode]; !ok {
out[nextNode] = true
discovered = append(discovered, nextNode)
}
}
}
searchNext = discovered
}
return out
}
func (s NodeSet[T]) copy() NodeSet[T] {
out := make(NodeSet[T], len(s))
for k, v := range s {
out[k] = v
}
return out
}
func (dm DepMap[T]) copy() DepMap[T] {
out := make(DepMap[T], len(dm))
for k := range dm {
out[k] = dm[k].copy()
}
return out
}
func (dm DepMap[T]) addNodeToNodeset(key, node T) {
nodes, ok := dm[key]
if !ok {
nodes = make(NodeSet[T])
dm[key] = nodes
}
nodes[node] = true
}

9
pkg/dep/topo/errors.go Normal file
View File

@ -0,0 +1,9 @@
package topo
import "errors"
var (
ErrSelfReferential = errors.New(" self-referential dependencies not allowed")
ErrConflictingAlias = errors.New(" alias already defined")
ErrCircular = errors.New(" circular dependencies not allowed")
)

92
pkg/download/abs.go Normal file
View File

@ -0,0 +1,92 @@
package download
import (
"context"
"errors"
"fmt"
"io"
"net/http"
"regexp"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/settings/exe"
)
const (
MaxConcurrentFetch = 20
absPackageURL = "https://gitlab.archlinux.org/archlinux/packaging/packages"
)
var (
ErrInvalidRepository = errors.New(gotext.Get("invalid repository"))
ErrABSPackageNotFound = errors.New(gotext.Get("package not found in repos"))
)
type regexReplace struct {
repl string
match *regexp.Regexp
}
// regex replacements for Gitlab URLs
// info: https://gitlab.archlinux.org/archlinux/devtools/-/blob/6ce666a1669235749c17d5c44d8a24dea4a135da/src/lib/api/gitlab.sh#L84
var gitlabRepl = []regexReplace{
{repl: `$1-$2`, match: regexp.MustCompile(`([a-zA-Z0-9]+)\+([a-zA-Z]+)`)},
{repl: `plus`, match: regexp.MustCompile(`\+`)},
{repl: `-`, match: regexp.MustCompile(`[^a-zA-Z0-9_\-.]`)},
{repl: `-`, match: regexp.MustCompile(`[_\-]{2,}`)},
{repl: `unix-tree`, match: regexp.MustCompile(`^tree$`)},
}
// Return format for pkgbuild
// https://gitlab.archlinux.org/archlinux/packaging/packages/0ad/-/raw/main/PKGBUILD
func getPackagePKGBUILDURL(pkgName string) string {
return fmt.Sprintf("%s/%s/-/raw/main/PKGBUILD", absPackageURL, convertPkgNameForURL(pkgName))
}
// Return format for pkgbuild repo
// https://gitlab.archlinux.org/archlinux/packaging/packages/0ad.git
func getPackageRepoURL(pkgName string) string {
return fmt.Sprintf("%s/%s.git", absPackageURL, convertPkgNameForURL(pkgName))
}
// convert pkgName for Gitlab URL path (repo name)
func convertPkgNameForURL(pkgName string) string {
for _, regex := range gitlabRepl {
pkgName = regex.match.ReplaceAllString(pkgName, regex.repl)
}
return pkgName
}
// ABSPKGBUILD retrieves the PKGBUILD file to a dest directory.
func ABSPKGBUILD(httpClient httpRequestDoer, dbName, pkgName string) ([]byte, error) {
packageURL := getPackagePKGBUILDURL(pkgName)
resp, err := httpClient.Get(packageURL)
if err != nil {
return nil, err
}
if resp.StatusCode != http.StatusOK {
return nil, ErrABSPackageNotFound
}
defer resp.Body.Close()
pkgBuild, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
return pkgBuild, nil
}
// ABSPKGBUILDRepo retrieves the PKGBUILD repository to a dest directory.
func ABSPKGBUILDRepo(ctx context.Context, cmdBuilder exe.GitCmdBuilder,
dbName, pkgName, dest string, force bool,
) (bool, error) {
pkgURL := getPackageRepoURL(pkgName)
return downloadGitRepo(ctx, cmdBuilder, pkgURL,
pkgName, dest, force, "--single-branch")
}

331
pkg/download/abs_test.go Normal file
View File

@ -0,0 +1,331 @@
//go:build !integration
// +build !integration
package download
import (
"context"
"fmt"
"os"
"os/exec"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/Jguer/yay/v12/pkg/settings/exe"
)
const gitExtrasPKGBUILD = `pkgname=git-extras
pkgver=6.1.0
pkgrel=1
pkgdesc="GIT utilities -- repo summary, commit counting, repl, changelog population and more"
arch=('any')
url="https://github.com/tj/${pkgname}"
license=('MIT')
depends=('git')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/${pkgver}.tar.gz")
sha256sums=('7be0b15ee803d76d2c2e8036f5d9db6677f2232bb8d2c4976691ff7ae026a22f')
b2sums=('3450edecb3116e19ffcf918b118aee04f025c06d812e29e8701f35a3c466b13d2578d41c8e1ee93327743d0019bf98bb3f397189e19435f89e3a259ff1b82747')
package() {
cd "${srcdir}/${pkgname}-${pkgver}"
# avoid annoying interactive prompts if an alias is in your gitconfig
export GIT_CONFIG=/dev/null
make DESTDIR="${pkgdir}" PREFIX=/usr SYSCONFDIR=/etc install
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}`
func Test_getPackageURL(t *testing.T) {
t.Parallel()
type args struct {
db string
pkgName string
}
tests := []struct {
name string
args args
want string
wantErr bool
}{
{
name: "extra package",
args: args{
db: "extra",
pkgName: "kitty",
},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/kitty/-/raw/main/PKGBUILD",
wantErr: false,
},
{
name: "core package",
args: args{
db: "core",
pkgName: "linux",
},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/raw/main/PKGBUILD",
wantErr: false,
},
{
name: "personal repo package",
args: args{
db: "sweswe",
pkgName: "zabix",
},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/zabix/-/raw/main/PKGBUILD",
wantErr: false,
},
{
name: "special name +",
args: args{
db: "core",
pkgName: "my+package",
},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/my-package/-/raw/main/PKGBUILD",
wantErr: false,
},
{
name: "special name %",
args: args{
db: "core",
pkgName: "my%package",
},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/my-package/-/raw/main/PKGBUILD",
wantErr: false,
},
{
name: "special name _-",
args: args{
db: "core",
pkgName: "my_-package",
},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/my-package/-/raw/main/PKGBUILD",
wantErr: false,
},
{
name: "special name ++",
args: args{
db: "core",
pkgName: "my++package",
},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/mypluspluspackage/-/raw/main/PKGBUILD",
wantErr: false,
},
{
name: "special name tree",
args: args{
db: "sweswe",
pkgName: "tree",
},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/unix-tree/-/raw/main/PKGBUILD",
wantErr: false,
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
got := getPackagePKGBUILDURL(tt.args.pkgName)
assert.Equal(t, tt.want, got)
})
}
}
func TestGetABSPkgbuild(t *testing.T) {
t.Parallel()
type args struct {
dbName string
body string
status int
pkgName string
wantURL string
}
tests := []struct {
name string
args args
want string
wantErr bool
}{
{
name: "found package",
args: args{
dbName: "core",
body: gitExtrasPKGBUILD,
status: 200,
pkgName: "git-extras",
wantURL: "https://gitlab.archlinux.org/archlinux/packaging/packages/git-extras/-/raw/main/PKGBUILD",
},
want: gitExtrasPKGBUILD,
wantErr: false,
},
{
name: "not found package",
args: args{
dbName: "core",
body: "",
status: 404,
pkgName: "git-git",
wantURL: "https://gitlab.archlinux.org/archlinux/packaging/packages/git-git/-/raw/main/PKGBUILD",
},
want: "",
wantErr: true,
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
httpClient := &testClient{
t: t,
wantURL: tt.args.wantURL,
body: tt.args.body,
status: tt.args.status,
}
got, err := ABSPKGBUILD(httpClient, tt.args.dbName, tt.args.pkgName)
if tt.wantErr {
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
assert.Equal(t, tt.want, string(got))
})
}
}
func Test_getPackageRepoURL(t *testing.T) {
t.Parallel()
type args struct {
pkgName string
}
tests := []struct {
name string
args args
want string
wantErr bool
}{
{
name: "extra package",
args: args{pkgName: "zoxide"},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/zoxide.git",
wantErr: false,
},
{
name: "core package",
args: args{pkgName: "linux"},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/linux.git",
wantErr: false,
},
{
name: "personal repo package",
args: args{pkgName: "sweswe"},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/sweswe.git",
wantErr: false,
},
{
name: "special name +",
args: args{pkgName: "my+package"},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/my-package.git",
wantErr: false,
},
{
name: "special name %",
args: args{pkgName: "my%package"},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/my-package.git",
wantErr: false,
},
{
name: "special name _-",
args: args{pkgName: "my_-package"},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/my-package.git",
wantErr: false,
},
{
name: "special name ++",
args: args{pkgName: "my++package"},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/mypluspluspackage.git",
wantErr: false,
},
{
name: "special name tree",
args: args{pkgName: "tree"},
want: "https://gitlab.archlinux.org/archlinux/packaging/packages/unix-tree.git",
wantErr: false,
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
got := getPackageRepoURL(tt.args.pkgName)
assert.Equal(t, tt.want, got)
})
}
}
// GIVEN no previous existing folder
// WHEN ABSPKGBUILDRepo is called
// THEN a clone command should be formed
func TestABSPKGBUILDRepo(t *testing.T) {
t.Parallel()
cmdRunner := &testRunner{}
want := "/usr/local/bin/git --no-replace-objects -C /tmp/doesnt-exist clone --no-progress --single-branch https://gitlab.archlinux.org/archlinux/packaging/packages/linux.git linux"
if os.Getuid() == 0 {
ld := "systemd-run"
if path, _ := exec.LookPath(ld); path != "" {
ld = path
}
want = fmt.Sprintf("%s --service-type=oneshot --pipe --wait --pty --quiet -p DynamicUser=yes -p CacheDirectory=yay -E HOME=/tmp --no-replace-objects -C /tmp/doesnt-exist clone --no-progress --single-branch https://gitlab.archlinux.org/archlinux/packaging/packages/linux.git linux", ld)
}
cmdBuilder := &testGitBuilder{
index: 0,
test: t,
want: want,
parentBuilder: &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "/usr/local/bin/git",
GitFlags: []string{"--no-replace-objects"},
},
}
newClone, err := ABSPKGBUILDRepo(context.Background(), cmdBuilder, "core", "linux", "/tmp/doesnt-exist", false)
assert.NoError(t, err)
assert.Equal(t, true, newClone)
}
// GIVEN a previous existing folder with permissions
// WHEN ABSPKGBUILDRepo is called
// THEN a pull command should be formed
func TestABSPKGBUILDRepoExistsPerms(t *testing.T) {
t.Parallel()
dir := t.TempDir()
os.MkdirAll(filepath.Join(dir, "linux", ".git"), 0o777)
want := fmt.Sprintf("/usr/local/bin/git --no-replace-objects -C %s/linux pull --rebase --autostash", dir)
if os.Getuid() == 0 {
ld := "systemd-run"
if path, _ := exec.LookPath(ld); path != "" {
ld = path
}
want = fmt.Sprintf("%s --service-type=oneshot --pipe --wait --pty --quiet -p DynamicUser=yes -p CacheDirectory=yay -E HOME=/tmp --no-replace-objects -C %s/linux pull --rebase --autostash", ld, dir)
}
cmdRunner := &testRunner{}
cmdBuilder := &testGitBuilder{
index: 0,
test: t,
want: want,
parentBuilder: &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "/usr/local/bin/git",
GitFlags: []string{"--no-replace-objects"},
},
}
newClone, err := ABSPKGBUILDRepo(context.Background(), cmdBuilder, "core", "linux", dir, false)
assert.NoError(t, err)
assert.Equal(t, false, newClone)
}

100
pkg/download/aur.go Normal file
View File

@ -0,0 +1,100 @@
package download
import (
"context"
"fmt"
"io"
"net/http"
"net/url"
"sync"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/multierror"
"github.com/Jguer/yay/v12/pkg/settings/exe"
"github.com/Jguer/yay/v12/pkg/text"
)
func AURPKGBUILD(httpClient httpRequestDoer, pkgName, aurURL string) ([]byte, error) {
values := url.Values{}
values.Set("h", pkgName)
pkgURL := aurURL + "/cgit/aur.git/plain/PKGBUILD?" + values.Encode()
resp, err := httpClient.Get(pkgURL)
if err != nil {
return nil, err
}
if resp.StatusCode != http.StatusOK {
return nil, ErrAURPackageNotFound{pkgName: pkgName}
}
defer resp.Body.Close()
pkgBuild, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
return pkgBuild, nil
}
// AURPkgbuildRepo retrieves the PKGBUILD repository to a dest directory.
func AURPKGBUILDRepo(ctx context.Context, cmdBuilder exe.GitCmdBuilder, aurURL, pkgName, dest string, force bool) (bool, error) {
pkgURL := fmt.Sprintf("%s/%s.git", aurURL, pkgName)
return downloadGitRepo(ctx, cmdBuilder, pkgURL, pkgName, dest, force)
}
func AURPKGBUILDRepos(
ctx context.Context,
cmdBuilder exe.GitCmdBuilder, logger *text.Logger,
targets []string, aurURL, dest string, force bool,
) (map[string]bool, error) {
cloned := make(map[string]bool, len(targets))
var (
mux sync.Mutex
errs multierror.MultiError
wg sync.WaitGroup
)
sem := make(chan uint8, MaxConcurrentFetch)
for _, target := range targets {
sem <- 1
wg.Add(1)
go func(target string) {
defer func() {
<-sem
wg.Done()
}()
newClone, err := AURPKGBUILDRepo(ctx, cmdBuilder, aurURL, target, dest, force)
mux.Lock()
progress := len(cloned)
if err != nil {
errs.Add(err)
mux.Unlock()
logger.OperationInfoln(
gotext.Get("(%d/%d) Failed to download PKGBUILD: %s",
progress, len(targets), text.Cyan(target)))
return
}
cloned[target] = newClone
progress = len(cloned)
mux.Unlock()
logger.OperationInfoln(
gotext.Get("(%d/%d) Downloaded PKGBUILD: %s",
progress, len(targets), text.Cyan(target)))
}(target)
}
wg.Wait()
return cloned, errs.Return()
}

165
pkg/download/aur_test.go Normal file
View File

@ -0,0 +1,165 @@
//go:build !integration
// +build !integration
package download
import (
"context"
"fmt"
"os"
"os/exec"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/Jguer/yay/v12/pkg/settings/exe"
)
func TestGetAURPkgbuild(t *testing.T) {
t.Parallel()
type args struct {
body string
status int
pkgName string
wantURL string
}
tests := []struct {
name string
args args
want string
wantErr bool
}{
{
name: "found package",
args: args{
body: gitExtrasPKGBUILD,
status: 200,
pkgName: "git-extras",
wantURL: "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=git-extras",
},
want: gitExtrasPKGBUILD,
wantErr: false,
},
{
name: "not found package",
args: args{
body: "",
status: 404,
pkgName: "git-git",
wantURL: "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=git-git",
},
want: "",
wantErr: true,
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
httpClient := &testClient{
t: t,
wantURL: tt.args.wantURL,
body: tt.args.body,
status: tt.args.status,
}
got, err := AURPKGBUILD(httpClient, tt.args.pkgName, "https://aur.archlinux.org")
if tt.wantErr {
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
assert.Equal(t, tt.want, string(got))
})
}
}
// GIVEN no previous existing folder
// WHEN AURPKGBUILDRepo is called
// THEN a clone command should be formed
func TestAURPKGBUILDRepo(t *testing.T) {
t.Parallel()
want := "/usr/local/bin/git --no-replace-objects -C /tmp/doesnt-exist clone --no-progress https://aur.archlinux.org/yay-bin.git yay-bin"
if os.Getuid() == 0 {
ld := "systemd-run"
if path, _ := exec.LookPath(ld); path != "" {
ld = path
}
want = fmt.Sprintf("%s --service-type=oneshot --pipe --wait --pty --quiet -p DynamicUser=yes -p CacheDirectory=yay -E HOME=/tmp --no-replace-objects -C /tmp/doesnt-exist clone --no-progress https://aur.archlinux.org/yay-bin.git yay-bin", ld)
}
cmdRunner := &testRunner{}
cmdBuilder := &testGitBuilder{
index: 0,
test: t,
want: want,
parentBuilder: &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "/usr/local/bin/git",
GitFlags: []string{"--no-replace-objects"},
},
}
newCloned, err := AURPKGBUILDRepo(context.Background(), cmdBuilder, "https://aur.archlinux.org", "yay-bin", "/tmp/doesnt-exist", false)
assert.NoError(t, err)
assert.Equal(t, true, newCloned)
}
// GIVEN a previous existing folder with permissions
// WHEN AURPKGBUILDRepo is called
// THEN a pull command should be formed
func TestAURPKGBUILDRepoExistsPerms(t *testing.T) {
t.Parallel()
dir := t.TempDir()
os.MkdirAll(filepath.Join(dir, "yay-bin", ".git"), 0o777)
want := fmt.Sprintf("/usr/local/bin/git --no-replace-objects -C %s/yay-bin pull --rebase --autostash", dir)
if os.Getuid() == 0 {
ld := "systemd-run"
if path, _ := exec.LookPath(ld); path != "" {
ld = path
}
want = fmt.Sprintf("%s --service-type=oneshot --pipe --wait --pty --quiet -p DynamicUser=yes -p CacheDirectory=yay -E HOME=/tmp --no-replace-objects -C %s/yay-bin pull --rebase --autostash", ld, dir)
}
cmdRunner := &testRunner{}
cmdBuilder := &testGitBuilder{
index: 0,
test: t,
want: want,
parentBuilder: &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "/usr/local/bin/git",
GitFlags: []string{"--no-replace-objects"},
},
}
cloned, err := AURPKGBUILDRepo(context.Background(), cmdBuilder, "https://aur.archlinux.org", "yay-bin", dir, false)
assert.NoError(t, err)
assert.Equal(t, false, cloned)
}
func TestAURPKGBUILDRepos(t *testing.T) {
t.Parallel()
dir := t.TempDir()
os.MkdirAll(filepath.Join(dir, "yay-bin", ".git"), 0o777)
targets := []string{"yay", "yay-bin", "yay-git"}
cmdRunner := &testRunner{}
cmdBuilder := &testGitBuilder{
index: 0,
test: t,
want: "",
parentBuilder: &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "/usr/local/bin/git",
GitFlags: []string{},
},
}
cloned, err := AURPKGBUILDRepos(context.Background(), cmdBuilder, newTestLogger(), targets, "https://aur.archlinux.org", dir, false)
assert.NoError(t, err)
assert.EqualValues(t, map[string]bool{"yay": true, "yay-bin": false, "yay-git": true}, cloned)
}

31
pkg/download/errors.go Normal file
View File

@ -0,0 +1,31 @@
package download
import (
"fmt"
"github.com/leonelquinteros/gotext"
)
// ErrAURPackageNotFound means that package was not found in AUR.
type ErrAURPackageNotFound struct {
pkgName string
}
func (e ErrAURPackageNotFound) Error() string {
return fmt.Sprintln(gotext.Get("package not found in AUR"), ":", e.pkgName)
}
type ErrGetPKGBUILDRepo struct {
inner error
pkgName string
errOut string
}
func (e ErrGetPKGBUILDRepo) Error() string {
return fmt.Sprintln(gotext.Get("error fetching %s: %s", e.pkgName, e.errOut),
"\n\t context:", e.inner.Error())
}
func (e *ErrGetPKGBUILDRepo) Unwrap() error {
return e.inner
}

251
pkg/download/unified.go Normal file
View File

@ -0,0 +1,251 @@
package download
import (
"context"
"net/http"
"os"
"path/filepath"
"sync"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/aur"
"github.com/Jguer/yay/v12/pkg/db"
"github.com/Jguer/yay/v12/pkg/multierror"
"github.com/Jguer/yay/v12/pkg/settings/exe"
"github.com/Jguer/yay/v12/pkg/settings/parser"
"github.com/Jguer/yay/v12/pkg/text"
)
type httpRequestDoer interface {
Get(string) (*http.Response, error)
}
type DBSearcher interface {
SyncPackage(string) db.IPackage
SyncPackageFromDB(string, string) db.IPackage
}
func downloadGitRepo(ctx context.Context, cmdBuilder exe.GitCmdBuilder,
pkgURL, pkgName, dest string, force bool, gitArgs ...string,
) (bool, error) {
finalDir := filepath.Join(dest, pkgName)
newClone := true
switch _, err := os.Stat(filepath.Join(finalDir, ".git")); {
case os.IsNotExist(err) || (err == nil && force):
if _, errD := os.Stat(finalDir); force && errD == nil {
if errR := os.RemoveAll(finalDir); errR != nil {
return false, ErrGetPKGBUILDRepo{inner: errR, pkgName: pkgName, errOut: ""}
}
}
gitArgs = append(gitArgs, pkgURL, pkgName)
cloneArgs := make([]string, 0, len(gitArgs)+4)
cloneArgs = append(cloneArgs, "clone", "--no-progress")
cloneArgs = append(cloneArgs, gitArgs...)
cmd := cmdBuilder.BuildGitCmd(ctx, dest, cloneArgs...)
_, stderr, errCapture := cmdBuilder.Capture(cmd)
if errCapture != nil {
return false, ErrGetPKGBUILDRepo{inner: errCapture, pkgName: pkgName, errOut: stderr}
}
case err != nil:
return false, ErrGetPKGBUILDRepo{
inner: err,
pkgName: pkgName,
errOut: gotext.Get("error reading %s", filepath.Join(dest, pkgName, ".git")),
}
default:
cmd := cmdBuilder.BuildGitCmd(ctx, filepath.Join(dest, pkgName), "pull", "--rebase", "--autostash")
_, stderr, errCmd := cmdBuilder.Capture(cmd)
if errCmd != nil {
return false, ErrGetPKGBUILDRepo{inner: errCmd, pkgName: pkgName, errOut: stderr}
}
newClone = false
}
return newClone, nil
}
func getURLName(pkg db.IPackage) string {
name := pkg.Base()
if name == "" {
name = pkg.Name()
}
return name
}
func PKGBUILDs(dbExecutor DBSearcher, aurClient aur.QueryClient, httpClient *http.Client,
logger *text.Logger, targets []string, aurURL string, mode parser.TargetMode,
) (map[string][]byte, error) {
pkgbuilds := make(map[string][]byte, len(targets))
var (
mux sync.Mutex
errs multierror.MultiError
wg sync.WaitGroup
)
sem := make(chan uint8, MaxConcurrentFetch)
for _, target := range targets {
// Probably replaceable by something in query.
dbName, name, isAUR, toSkip := getPackageUsableName(dbExecutor, aurClient, logger, target, mode)
if toSkip {
continue
}
sem <- 1
wg.Add(1)
go func(target, dbName, pkgName string, aur bool) {
var (
err error
pkgbuild []byte
)
if aur {
pkgbuild, err = AURPKGBUILD(httpClient, pkgName, aurURL)
} else {
pkgbuild, err = ABSPKGBUILD(httpClient, dbName, pkgName)
}
if err == nil {
mux.Lock()
pkgbuilds[target] = pkgbuild
mux.Unlock()
} else {
errs.Add(err)
}
<-sem
wg.Done()
}(target, dbName, name, isAUR)
}
wg.Wait()
return pkgbuilds, errs.Return()
}
func PKGBUILDRepos(ctx context.Context, dbExecutor DBSearcher, aurClient aur.QueryClient,
cmdBuilder exe.GitCmdBuilder, logger *text.Logger,
targets []string, mode parser.TargetMode, aurURL, dest string, force bool,
) (map[string]bool, error) {
cloned := make(map[string]bool, len(targets))
var (
mux sync.Mutex
errs multierror.MultiError
wg sync.WaitGroup
)
sem := make(chan uint8, MaxConcurrentFetch)
for _, target := range targets {
// Probably replaceable by something in query.
dbName, name, isAUR, toSkip := getPackageUsableName(dbExecutor, aurClient, logger, target, mode)
if toSkip {
continue
}
sem <- 1
wg.Add(1)
go func(target, dbName, pkgName string, aur bool) {
var (
err error
newClone bool
)
if aur {
newClone, err = AURPKGBUILDRepo(ctx, cmdBuilder, aurURL, pkgName, dest, force)
} else {
newClone, err = ABSPKGBUILDRepo(ctx, cmdBuilder, dbName, pkgName, dest, force)
}
progress := 0
if err != nil {
errs.Add(err)
} else {
mux.Lock()
cloned[target] = newClone
progress = len(cloned)
mux.Unlock()
}
if aur {
logger.OperationInfoln(
gotext.Get("(%d/%d) Downloaded PKGBUILD: %s",
progress, len(targets), text.Cyan(pkgName)))
} else {
logger.OperationInfoln(
gotext.Get("(%d/%d) Downloaded PKGBUILD from ABS: %s",
progress, len(targets), text.Cyan(pkgName)))
}
<-sem
wg.Done()
}(target, dbName, name, isAUR)
}
wg.Wait()
return cloned, errs.Return()
}
// TODO: replace with dep.ResolveTargets.
func getPackageUsableName(dbExecutor DBSearcher, aurClient aur.QueryClient,
logger *text.Logger, target string, mode parser.TargetMode,
) (dbname, pkgname string, isAUR, toSkip bool) {
dbName, name := text.SplitDBFromName(target)
if dbName != "aur" && mode.AtLeastRepo() {
var pkg db.IPackage
if dbName != "" {
pkg = dbExecutor.SyncPackageFromDB(name, dbName)
} else {
pkg = dbExecutor.SyncPackage(name)
}
if pkg != nil {
name = getURLName(pkg)
dbName = pkg.DB().Name()
return dbName, name, false, false
}
// If the package is not found in the database and it was expected to be
if pkg == nil && dbName != "" {
return dbName, name, true, true
}
}
if mode == parser.ModeRepo {
return dbName, name, true, true
}
pkgs, err := aurClient.Get(context.Background(), &aur.Query{
By: aur.Name,
Contains: false,
Needles: []string{name},
})
if err != nil {
logger.Warnln(err)
return dbName, name, true, true
}
if len(pkgs) == 0 {
return dbName, name, true, true
}
return "aur", name, true, false
}

View File

@ -0,0 +1,106 @@
//go:build integration
// +build integration
package download
import (
"context"
"net/http"
"os"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/Jguer/aur"
mockaur "github.com/Jguer/yay/v12/pkg/dep/mock"
"github.com/Jguer/yay/v12/pkg/settings/exe"
"github.com/Jguer/yay/v12/pkg/settings/parser"
"github.com/Jguer/yay/v12/pkg/text"
)
func TestIntegrationPKGBUILDReposDefinedDBClone(t *testing.T) {
dir := t.TempDir()
mockClient := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{{}}, nil // fakes a package found for all
},
}
targets := []string{"core/linux", "yay-bin", "yay-git"}
testLogger := text.NewLogger(os.Stdout, os.Stderr, strings.NewReader(""), true, "test")
cmdRunner := &exe.OSRunner{Log: testLogger}
cmdBuilder := &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "git",
GitFlags: []string{},
Log: testLogger,
}
searcher := &testDBSearcher{
absPackagesDB: map[string]string{"linux": "core"},
}
cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient,
cmdBuilder, testLogger.Child("test"),
targets, parser.ModeAny, "https://aur.archlinux.org", dir, false)
assert.NoError(t, err)
assert.EqualValues(t, map[string]bool{"core/linux": true, "yay-bin": true, "yay-git": true}, cloned)
}
func TestIntegrationPKGBUILDReposNotExist(t *testing.T) {
dir := t.TempDir()
mockClient := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{{}}, nil // fakes a package found for all
},
}
targets := []string{"core/yay", "yay-bin", "yay-git"}
testLogger := text.NewLogger(os.Stdout, os.Stderr, strings.NewReader(""), true, "test")
cmdRunner := &exe.OSRunner{Log: testLogger}
cmdBuilder := &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "git",
GitFlags: []string{},
Log: testLogger,
}
searcher := &testDBSearcher{
absPackagesDB: map[string]string{"yay": "core"},
}
cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient,
cmdBuilder, testLogger.Child("test"),
targets, parser.ModeAny, "https://aur.archlinux.org", dir, false)
assert.Error(t, err)
assert.EqualValues(t, map[string]bool{"yay-bin": true, "yay-git": true}, cloned)
}
// GIVEN 2 aur packages and 1 in repo
// WHEN defining as specified targets
// THEN all aur be found and cloned
func TestIntegrationPKGBUILDFull(t *testing.T) {
mockClient := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{{}}, nil
},
}
testLogger := text.NewLogger(os.Stdout, os.Stderr, strings.NewReader(""), true, "test")
targets := []string{"core/linux", "aur/yay-bin", "yay-git"}
searcher := &testDBSearcher{
absPackagesDB: map[string]string{"linux": "core"},
}
fetched, err := PKGBUILDs(searcher, mockClient, &http.Client{}, testLogger.Child("test"),
targets, "https://aur.archlinux.org", parser.ModeAny)
assert.NoError(t, err)
for _, target := range targets {
assert.Contains(t, fetched, target)
assert.NotEmpty(t, fetched[target])
}
}

View File

@ -0,0 +1,281 @@
//go:build !integration
// +build !integration
package download
import (
"context"
"io"
"net/http"
"os"
"path/filepath"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"gopkg.in/h2non/gock.v1"
"github.com/Jguer/aur"
mockaur "github.com/Jguer/yay/v12/pkg/dep/mock"
"github.com/Jguer/yay/v12/pkg/settings/exe"
"github.com/Jguer/yay/v12/pkg/settings/parser"
"github.com/Jguer/yay/v12/pkg/text"
)
func newTestLogger() *text.Logger {
return text.NewLogger(io.Discard, io.Discard, strings.NewReader(""), true, "test")
}
// GIVEN 2 aur packages and 1 in repo
// GIVEN package in repo is already present
// WHEN defining package db as a target
// THEN all should be found and cloned, except the repo one
func TestPKGBUILDReposDefinedDBPull(t *testing.T) {
t.Parallel()
dir := t.TempDir()
mockClient := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{{}}, nil // fakes a package found for all
},
}
testLogger := text.NewLogger(os.Stdout, os.Stderr, strings.NewReader(""), true, "test")
os.MkdirAll(filepath.Join(dir, "yay", ".git"), 0o777)
targets := []string{"core/yay", "yay-bin", "yay-git"}
cmdRunner := &testRunner{}
cmdBuilder := &testGitBuilder{
index: 0,
test: t,
parentBuilder: &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "/usr/local/bin/git",
GitFlags: []string{},
Log: testLogger,
},
}
searcher := &testDBSearcher{
absPackagesDB: map[string]string{"yay": "core"},
}
cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient,
cmdBuilder, newTestLogger(),
targets, parser.ModeAny, "https://aur.archlinux.org", dir, false)
assert.NoError(t, err)
assert.EqualValues(t, map[string]bool{"core/yay": false, "yay-bin": true, "yay-git": true}, cloned)
}
// GIVEN 2 aur packages and 1 in repo
// WHEN defining package db as a target
// THEN all should be found and cloned
func TestPKGBUILDReposDefinedDBClone(t *testing.T) {
t.Parallel()
dir := t.TempDir()
mockClient := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{{}}, nil // fakes a package found for all
},
}
targets := []string{"core/yay", "yay-bin", "yay-git"}
cmdRunner := &testRunner{}
cmdBuilder := &testGitBuilder{
index: 0,
test: t,
parentBuilder: &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "/usr/local/bin/git",
GitFlags: []string{},
},
}
searcher := &testDBSearcher{
absPackagesDB: map[string]string{"yay": "core"},
}
cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient,
cmdBuilder, newTestLogger(),
targets, parser.ModeAny, "https://aur.archlinux.org", dir, false)
assert.NoError(t, err)
assert.EqualValues(t, map[string]bool{"core/yay": true, "yay-bin": true, "yay-git": true}, cloned)
}
// GIVEN 2 aur packages and 1 in repo
// WHEN defining as non specified targets
// THEN all should be found and cloned
func TestPKGBUILDReposClone(t *testing.T) {
t.Parallel()
dir := t.TempDir()
mockClient := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{{}}, nil // fakes a package found for all
},
}
targets := []string{"yay", "yay-bin", "yay-git"}
cmdRunner := &testRunner{}
cmdBuilder := &testGitBuilder{
index: 0,
test: t,
parentBuilder: &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "/usr/local/bin/git",
GitFlags: []string{},
},
}
searcher := &testDBSearcher{
absPackagesDB: map[string]string{"yay": "core"},
}
cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient,
cmdBuilder, newTestLogger(),
targets, parser.ModeAny, "https://aur.archlinux.org", dir, false)
assert.NoError(t, err)
assert.EqualValues(t, map[string]bool{"yay": true, "yay-bin": true, "yay-git": true}, cloned)
}
// GIVEN 2 aur packages and 1 in repo but wrong db
// WHEN defining as non specified targets
// THEN all aur be found and cloned
func TestPKGBUILDReposNotFound(t *testing.T) {
t.Parallel()
dir := t.TempDir()
mockClient := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{{}}, nil // fakes a package found for all
},
}
targets := []string{"extra/yay", "yay-bin", "yay-git"}
cmdRunner := &testRunner{}
cmdBuilder := &testGitBuilder{
index: 0,
test: t,
parentBuilder: &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "/usr/local/bin/git",
GitFlags: []string{},
},
}
searcher := &testDBSearcher{
absPackagesDB: map[string]string{"yay": "core"},
}
cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient,
cmdBuilder, newTestLogger(),
targets, parser.ModeAny, "https://aur.archlinux.org", dir, false)
assert.NoError(t, err)
assert.EqualValues(t, map[string]bool{"yay-bin": true, "yay-git": true}, cloned)
}
// GIVEN 2 aur packages and 1 in repo
// WHEN defining as non specified targets in repo mode
// THEN only repo should be cloned
func TestPKGBUILDReposRepoMode(t *testing.T) {
t.Parallel()
dir := t.TempDir()
mockClient := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{}, nil // fakes a package found for all
},
}
targets := []string{"yay", "yay-bin", "yay-git"}
cmdRunner := &testRunner{}
cmdBuilder := &testGitBuilder{
index: 0,
test: t,
parentBuilder: &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "/usr/local/bin/git",
GitFlags: []string{},
},
}
searcher := &testDBSearcher{
absPackagesDB: map[string]string{"yay": "core"},
}
cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient,
cmdBuilder, newTestLogger(),
targets, parser.ModeRepo, "https://aur.archlinux.org", dir, false)
assert.NoError(t, err)
assert.EqualValues(t, map[string]bool{"yay": true}, cloned)
}
// GIVEN 2 aur packages and 1 in repo
// WHEN defining as specified targets
// THEN all aur be found and cloned
func TestPKGBUILDFull(t *testing.T) {
t.Parallel()
mockClient := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{{}}, nil
},
}
gock.New("https://aur.archlinux.org").
Get("/cgit/aur.git/plain/PKGBUILD").MatchParam("h", "yay-git").
Reply(200).
BodyString("example_yay-git")
gock.New("https://aur.archlinux.org").
Get("/cgit/aur.git/plain/PKGBUILD").MatchParam("h", "yay-bin").
Reply(200).
BodyString("example_yay-bin")
gock.New("https://gitlab.archlinux.org/").
Get("archlinux/packaging/packages/yay/-/raw/main/PKGBUILD").
Reply(200).
BodyString("example_yay")
defer gock.Off()
targets := []string{"core/yay", "aur/yay-bin", "yay-git"}
searcher := &testDBSearcher{
absPackagesDB: map[string]string{"yay": "core"},
}
fetched, err := PKGBUILDs(searcher, mockClient, &http.Client{}, newTestLogger(),
targets, "https://aur.archlinux.org", parser.ModeAny)
assert.NoError(t, err)
assert.EqualValues(t, map[string][]byte{
"core/yay": []byte("example_yay"),
"aur/yay-bin": []byte("example_yay-bin"),
"yay-git": []byte("example_yay-git"),
}, fetched)
}
// GIVEN 2 aur packages and 1 in repo
// WHEN aur packages are not found
// only repo should be cloned
func TestPKGBUILDReposMissingAUR(t *testing.T) {
t.Parallel()
dir := t.TempDir()
mockClient := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{}, nil // fakes a package found for all
},
}
targets := []string{"core/yay", "aur/yay-bin", "aur/yay-git"}
cmdRunner := &testRunner{}
cmdBuilder := &testGitBuilder{
index: 0,
test: t,
parentBuilder: &exe.CmdBuilder{
Runner: cmdRunner,
GitBin: "/usr/local/bin/git",
GitFlags: []string{},
},
}
searcher := &testDBSearcher{
absPackagesDB: map[string]string{"yay": "core"},
}
cloned, err := PKGBUILDRepos(context.Background(), searcher, mockClient,
cmdBuilder, newTestLogger(),
targets, parser.ModeAny, "https://aur.archlinux.org", dir, false)
assert.NoError(t, err)
assert.EqualValues(t, map[string]bool{"core/yay": true}, cloned)
}

120
pkg/download/utils_test.go Normal file
View File

@ -0,0 +1,120 @@
package download
import (
"context"
"io"
"net/http"
"os/exec"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/Jguer/go-alpm/v2"
"github.com/Jguer/yay/v12/pkg/db"
"github.com/Jguer/yay/v12/pkg/settings/exe"
)
type testRunner struct{}
func (t *testRunner) Capture(cmd *exec.Cmd) (stdout string, stderr string, err error) {
return "", "", nil
}
func (t *testRunner) Show(cmd *exec.Cmd) error {
return nil
}
type testGitBuilder struct {
index int
test *testing.T
want string
parentBuilder *exe.CmdBuilder
}
func (t *testGitBuilder) BuildGitCmd(ctx context.Context, dir string, extraArgs ...string) *exec.Cmd {
cmd := t.parentBuilder.BuildGitCmd(ctx, dir, extraArgs...)
if t.want != "" {
assert.Equal(t.test, t.want, cmd.String())
}
return cmd
}
func (c *testGitBuilder) Show(cmd *exec.Cmd) error {
return c.parentBuilder.Show(cmd)
}
func (c *testGitBuilder) Capture(cmd *exec.Cmd) (stdout, stderr string, err error) {
return c.parentBuilder.Capture(cmd)
}
type (
testDB struct {
alpm.IDB
name string
}
testPackage struct {
db.IPackage
name string
base string
db *testDB
}
testDBSearcher struct {
absPackagesDB map[string]string
}
testClient struct {
t *testing.T
wantURL string
body string
status int
}
)
func (d *testDB) Name() string {
return d.name
}
func (p *testPackage) Name() string {
return p.name
}
func (p *testPackage) Base() string {
return p.base
}
func (p *testPackage) DB() alpm.IDB {
return p.db
}
func (d *testDBSearcher) SyncPackage(name string) db.IPackage {
if v, ok := d.absPackagesDB[name]; ok {
return &testPackage{
name: name,
base: name,
db: &testDB{name: v},
}
}
return nil
}
func (d *testDBSearcher) SyncPackageFromDB(name string, db string) db.IPackage {
if v, ok := d.absPackagesDB[name]; ok && v == db {
return &testPackage{
name: name,
base: name,
db: &testDB{name: v},
}
}
return nil
}
func (t *testClient) Get(url string) (*http.Response, error) {
assert.Equal(t.t, t.wantURL, url)
return &http.Response{StatusCode: t.status, Body: io.NopCloser(strings.NewReader(t.body))}, nil
}

112
pkg/intrange/intrange.go Normal file
View File

@ -0,0 +1,112 @@
package intrange
import (
"strconv"
"strings"
"unicode"
mapset "github.com/deckarep/golang-set/v2"
)
// IntRange stores a max and min amount for range.
type IntRange struct {
min int
max int
}
// IntRanges is a slice of IntRange.
type IntRanges []IntRange
func makeIntRange(minVal, maxVal int) IntRange {
return IntRange{
min: minVal,
max: maxVal,
}
}
// Get returns true if the argument n is included in the closed range
// between min and max.
func (r IntRange) Get(n int) bool {
return n >= r.min && n <= r.max
}
// Get returns true if the argument n is included in the closed range
// between min and max of any of the provided IntRanges.
func (rs IntRanges) Get(n int) bool {
for _, r := range rs {
if r.Get(n) {
return true
}
}
return false
}
// ParseNumberMenu parses input for number menus split by spaces or commas
// supports individual selection: 1 2 3 4
// supports range selections: 1-4 10-20
// supports negation: ^1 ^1-4
//
// include and excule holds numbers that should be added and should not be added
// respectively. other holds anything that can't be parsed as an int. This is
// intended to allow words inside of number menus. e.g. 'all' 'none' 'abort'
// of course the implementation is up to the caller, this function mearley parses
// the input and organizes it.
func ParseNumberMenu(input string) (include, exclude IntRanges,
otherInclude, otherExclude mapset.Set[string],
) {
include = make(IntRanges, 0)
exclude = make(IntRanges, 0)
otherInclude = mapset.NewThreadUnsafeSet[string]()
otherExclude = mapset.NewThreadUnsafeSet[string]()
words := strings.FieldsFunc(input, func(c rune) bool {
return unicode.IsSpace(c) || c == ','
})
for _, word := range words {
var (
num1 int
num2 int
err error
)
invert := false
other := otherInclude
if word[0] == '^' {
invert = true
other = otherExclude
word = word[1:]
}
ranges := strings.SplitN(word, "-", 2)
num1, err = strconv.Atoi(ranges[0])
if err != nil {
other.Add(strings.ToLower(word))
continue
}
if len(ranges) == 2 {
num2, err = strconv.Atoi(ranges[1])
if err != nil {
other.Add(strings.ToLower(word))
continue
}
} else {
num2 = num1
}
mi := min(num1, num2)
ma := max(num1, num2)
if !invert {
include = append(include, makeIntRange(mi, ma))
} else {
exclude = append(exclude, makeIntRange(mi, ma))
}
}
return include, exclude, otherInclude, otherExclude
}

View File

@ -0,0 +1,194 @@
//go:build !integration
// +build !integration
package intrange
import (
"testing"
mapset "github.com/deckarep/golang-set/v2"
"github.com/stretchr/testify/assert"
)
func TestParseNumberMenu(t *testing.T) {
t.Parallel()
type result struct {
Include IntRanges
Exclude IntRanges
OtherInclude mapset.Set[string]
OtherExclude mapset.Set[string]
}
inputs := []string{
"1 2 3 4 5",
"1-10 5-15",
"10-5 90-85",
"1 ^2 ^10-5 99 ^40-38 ^123 60-62",
"abort all none",
"a-b ^a-b ^abort",
"-9223372036854775809-9223372036854775809",
"1\t2 3 4\t\t \t 5",
"1 2,3, 4, 5,6 ,7 ,8",
"",
" \t ",
"A B C D E",
}
expected := []result{
{IntRanges{
makeIntRange(1, 1),
makeIntRange(2, 2),
makeIntRange(3, 3),
makeIntRange(4, 4),
makeIntRange(5, 5),
}, IntRanges{}, mapset.NewThreadUnsafeSet[string](), mapset.NewThreadUnsafeSet[string]()},
{IntRanges{
makeIntRange(1, 10),
makeIntRange(5, 15),
}, IntRanges{}, mapset.NewThreadUnsafeSet[string](), mapset.NewThreadUnsafeSet[string]()},
{IntRanges{
makeIntRange(5, 10),
makeIntRange(85, 90),
}, IntRanges{}, mapset.NewThreadUnsafeSet[string](), mapset.NewThreadUnsafeSet[string]()},
{
IntRanges{
makeIntRange(1, 1),
makeIntRange(99, 99),
makeIntRange(60, 62),
},
IntRanges{
makeIntRange(2, 2),
makeIntRange(5, 10),
makeIntRange(38, 40),
makeIntRange(123, 123),
},
mapset.NewThreadUnsafeSet[string](), mapset.NewThreadUnsafeSet[string](),
},
{IntRanges{}, IntRanges{}, mapset.NewThreadUnsafeSet("abort", "all", "none"), mapset.NewThreadUnsafeSet[string]()},
{IntRanges{}, IntRanges{}, mapset.NewThreadUnsafeSet("a-b"), mapset.NewThreadUnsafeSet("abort", "a-b")},
{IntRanges{}, IntRanges{}, mapset.NewThreadUnsafeSet("-9223372036854775809-9223372036854775809"), mapset.NewThreadUnsafeSet[string]()},
{IntRanges{
makeIntRange(1, 1),
makeIntRange(2, 2),
makeIntRange(3, 3),
makeIntRange(4, 4),
makeIntRange(5, 5),
}, IntRanges{}, mapset.NewThreadUnsafeSet[string](), mapset.NewThreadUnsafeSet[string]()},
{IntRanges{
makeIntRange(1, 1),
makeIntRange(2, 2),
makeIntRange(3, 3),
makeIntRange(4, 4),
makeIntRange(5, 5),
makeIntRange(6, 6),
makeIntRange(7, 7),
makeIntRange(8, 8),
}, IntRanges{}, mapset.NewThreadUnsafeSet[string](), mapset.NewThreadUnsafeSet[string]()},
{IntRanges{}, IntRanges{}, mapset.NewThreadUnsafeSet[string](), mapset.NewThreadUnsafeSet[string]()},
{IntRanges{}, IntRanges{}, mapset.NewThreadUnsafeSet[string](), mapset.NewThreadUnsafeSet[string]()},
{IntRanges{}, IntRanges{}, mapset.NewThreadUnsafeSet("a", "b", "c", "d", "e"), mapset.NewThreadUnsafeSet[string]()},
}
for n, in := range inputs {
res := expected[n]
include, exclude, otherInclude, otherExclude := ParseNumberMenu(in)
assert.True(t, intRangesEqual(include, res.Include), "Test %d Failed: Expected: include=%+v got include=%+v", n+1, res.Include, include)
assert.True(t, intRangesEqual(exclude, res.Exclude), "Test %d Failed: Expected: exclude=%+v got exclude=%+v", n+1, res.Exclude, exclude)
assert.True(t, otherInclude.Equal(res.OtherInclude), "Test %d Failed: Expected: otherInclude=%+v got otherInclude=%+v", n+1, res.OtherInclude, otherInclude)
assert.True(t, otherExclude.Equal(res.OtherExclude), "Test %d Failed: Expected: otherExclude=%+v got otherExclude=%+v", n+1, res.OtherExclude, otherExclude)
}
}
func TestIntRange_Get(t *testing.T) {
t.Parallel()
type fields struct {
min int
max int
}
type args struct {
n int
}
tests := []struct {
name string
fields fields
args args
want bool
}{
{name: "normal range true", fields: fields{0, 10}, args: args{5}, want: true},
{name: "normal start range true", fields: fields{0, 10}, args: args{0}, want: true},
{name: "normal end range true", fields: fields{0, 10}, args: args{10}, want: true},
{name: "small range true", fields: fields{1, 1}, args: args{1}, want: true},
{name: "normal start range false", fields: fields{1, 2}, args: args{0}, want: false},
{name: "normal end range false", fields: fields{1, 2}, args: args{3}, want: false},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
r := IntRange{
min: tt.fields.min,
max: tt.fields.max,
}
if got := r.Get(tt.args.n); got != tt.want {
t.Errorf("IntRange.Get() = %v, want %v", got, tt.want)
}
})
}
}
func intRangesEqual(a, b IntRanges) bool {
if a == nil && b == nil {
return true
}
if a == nil || b == nil {
return false
}
if len(a) != len(b) {
return false
}
for n := range a {
r1 := a[n]
r2 := b[n]
if r1.min != r2.min || r1.max != r2.max {
return false
}
}
return true
}
func TestIntRanges_Get(t *testing.T) {
t.Parallel()
type args struct {
n int
}
tests := []struct {
name string
rs IntRanges
args args
want bool
}{
{name: "normal range true", rs: IntRanges{{0, 10}}, args: args{5}, want: true},
{name: "normal ranges in between true", rs: IntRanges{{0, 4}, {5, 10}}, args: args{5}, want: true},
{name: "normal ranges in between false", rs: IntRanges{{0, 4}, {6, 10}}, args: args{5}, want: false},
{name: "normal start range true", rs: IntRanges{{0, 10}}, args: args{0}, want: true},
{name: "normal end range true", rs: IntRanges{{0, 10}}, args: args{10}, want: true},
{name: "small range true", rs: IntRanges{{1, 1}, {3, 3}}, args: args{1}, want: true},
{name: "normal start range false", rs: IntRanges{{1, 2}}, args: args{0}, want: false},
{name: "normal end range false", rs: IntRanges{{1, 2}}, args: args{3}, want: false},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := tt.rs.Get(tt.args.n); got != tt.want {
t.Errorf("IntRanges.Get() = %v, want %v", got, tt.want)
}
})
}
}

78
pkg/menus/clean_menu.go Normal file
View File

@ -0,0 +1,78 @@
// Clean Build Menu functions
package menus
import (
"context"
"io"
"os"
mapset "github.com/deckarep/golang-set/v2"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/runtime"
"github.com/Jguer/yay/v12/pkg/settings"
"github.com/Jguer/yay/v12/pkg/text"
)
func anyExistInCache(pkgbuildDirs map[string]string) bool {
for _, dir := range pkgbuildDirs {
if _, err := os.Stat(dir); !os.IsNotExist(err) {
return true
}
}
return false
}
func CleanFn(ctx context.Context, run *runtime.Runtime, w io.Writer,
pkgbuildDirsByBase map[string]string, installed mapset.Set[string],
) error {
if len(pkgbuildDirsByBase) == 0 {
return nil // no work to do
}
if !anyExistInCache(pkgbuildDirsByBase) {
return nil
}
skipFunc := func(pkg string) bool {
dir := pkgbuildDirsByBase[pkg]
// TOFIX: new install engine dir will always exist, check if unclean instead
if _, err := os.Stat(dir); os.IsNotExist(err) {
return true
}
return false
}
bases := make([]string, 0, len(pkgbuildDirsByBase))
for pkg := range pkgbuildDirsByBase {
bases = append(bases, pkg)
}
toClean, errClean := selectionMenu(run.Logger, pkgbuildDirsByBase, bases, installed,
gotext.Get("Packages to cleanBuild?"),
settings.NoConfirm, run.Cfg.AnswerClean, skipFunc)
if errClean != nil {
return errClean
}
for i, base := range toClean {
dir := pkgbuildDirsByBase[base]
run.Logger.OperationInfoln(gotext.Get("Deleting (%d/%d): %s", i+1, len(toClean), text.Cyan(dir)))
if err := run.CmdBuilder.Show(run.CmdBuilder.BuildGitCmd(ctx, dir, "reset", "--hard", "origin/HEAD")); err != nil {
run.Logger.Warnln(gotext.Get("Unable to clean:"), dir)
return err
}
if err := run.CmdBuilder.Show(run.CmdBuilder.BuildGitCmd(ctx, dir, "clean", "-fdx")); err != nil {
run.Logger.Warnln(gotext.Get("Unable to clean:"), dir)
return err
}
}
return nil
}

181
pkg/menus/diff_menu.go Normal file
View File

@ -0,0 +1,181 @@
// file dedicated to diff menu
package menus
import (
"context"
"fmt"
"io"
"strings"
mapset "github.com/deckarep/golang-set/v2"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/multierror"
"github.com/Jguer/yay/v12/pkg/runtime"
"github.com/Jguer/yay/v12/pkg/settings"
"github.com/Jguer/yay/v12/pkg/settings/exe"
"github.com/Jguer/yay/v12/pkg/text"
)
const (
gitEmptyTree = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
gitDiffRefName = "AUR_SEEN"
)
func showPkgbuildDiffs(ctx context.Context, cmdBuilder exe.ICmdBuilder, logger *text.Logger,
pkgbuildDirs map[string]string, bases []string,
) error {
var errMulti multierror.MultiError
for _, pkg := range bases {
dir := pkgbuildDirs[pkg]
start, err := getLastSeenHash(ctx, cmdBuilder, dir)
if err != nil {
errMulti.Add(err)
continue
}
if start != gitEmptyTree {
hasDiff, err := gitHasDiff(ctx, cmdBuilder, dir)
if err != nil {
errMulti.Add(err)
continue
}
if !hasDiff {
logger.Warnln(gotext.Get("%s: No changes -- skipping", text.Cyan(pkg)))
continue
}
}
args := []string{
"diff",
start + "..HEAD@{upstream}", "--src-prefix",
dir + "/", "--dst-prefix", dir + "/", "--", ".", ":(exclude).SRCINFO",
}
if text.UseColor {
args = append(args, "--color=always")
} else {
args = append(args, "--color=never")
}
_ = cmdBuilder.Show(cmdBuilder.BuildGitCmd(ctx, dir, args...))
}
return errMulti.Return()
}
// Check whether or not a diff exists between the last reviewed diff and
// HEAD@{upstream}.
func gitHasDiff(ctx context.Context, cmdBuilder exe.ICmdBuilder, dir string) (bool, error) {
if gitHasLastSeenRef(ctx, cmdBuilder, dir) {
stdout, stderr, err := cmdBuilder.Capture(
cmdBuilder.BuildGitCmd(ctx, dir, "rev-parse", gitDiffRefName, "HEAD@{upstream}"))
if err != nil {
return false, fmt.Errorf("%s%w", stderr, err)
}
lines := strings.Split(stdout, "\n")
lastseen := lines[0]
upstream := lines[1]
return lastseen != upstream, nil
}
// If AUR_SEEN does not exists, we have never reviewed a diff for this package
// and should display it.
return true, nil
}
// Return whether or not we have reviewed a diff yet. It checks for the existence of
// AUR_SEEN in the git ref-list.
func gitHasLastSeenRef(ctx context.Context, cmdBuilder exe.ICmdBuilder, dir string) bool {
_, _, err := cmdBuilder.Capture(
cmdBuilder.BuildGitCmd(ctx,
dir, "rev-parse", "--quiet", "--verify", gitDiffRefName))
return err == nil
}
// Returns the last reviewed hash. If AUR_SEEN exists it will return this hash.
// If it does not it will return empty tree as no diff have been reviewed yet.
func getLastSeenHash(ctx context.Context, cmdBuilder exe.ICmdBuilder, dir string) (string, error) {
if gitHasLastSeenRef(ctx, cmdBuilder, dir) {
stdout, stderr, err := cmdBuilder.Capture(
cmdBuilder.BuildGitCmd(ctx,
dir, "rev-parse", gitDiffRefName))
if err != nil {
return "", fmt.Errorf("%s %w", stderr, err)
}
lines := strings.Split(stdout, "\n")
return lines[0], nil
}
return gitEmptyTree, nil
}
// Update the AUR_SEEN ref to HEAD. We use this ref to determine which diff were
// reviewed by the user.
func gitUpdateSeenRef(ctx context.Context, cmdBuilder exe.ICmdBuilder, dir string) error {
_, stderr, err := cmdBuilder.Capture(
cmdBuilder.BuildGitCmd(ctx,
dir, "update-ref", gitDiffRefName, "HEAD"))
if err != nil {
return fmt.Errorf("%s %w", stderr, err)
}
return nil
}
func updatePkgbuildSeenRef(ctx context.Context, cmdBuilder exe.ICmdBuilder, pkgbuildDirs map[string]string, bases []string) error {
var errMulti multierror.MultiError
for _, pkg := range bases {
dir := pkgbuildDirs[pkg]
if err := gitUpdateSeenRef(ctx, cmdBuilder, dir); err != nil {
errMulti.Add(err)
}
}
return errMulti.Return()
}
func DiffFn(ctx context.Context, run *runtime.Runtime, w io.Writer,
pkgbuildDirsByBase map[string]string, installed mapset.Set[string],
) error {
if len(pkgbuildDirsByBase) == 0 {
return nil // no work to do
}
bases := make([]string, 0, len(pkgbuildDirsByBase))
for base := range pkgbuildDirsByBase {
bases = append(bases, base)
}
toDiff, errMenu := selectionMenu(run.Logger, pkgbuildDirsByBase, bases, installed, gotext.Get("Diffs to show?"),
settings.NoConfirm, run.Cfg.AnswerDiff, nil)
if errMenu != nil || len(toDiff) == 0 {
return errMenu
}
if errD := showPkgbuildDiffs(ctx, run.CmdBuilder, run.Logger, pkgbuildDirsByBase, toDiff); errD != nil {
return errD
}
run.Logger.Println()
if !run.Logger.ContinueTask(gotext.Get("Proceed with install?"), true, false) {
return settings.ErrUserAbort{}
}
if errUpd := updatePkgbuildSeenRef(ctx, run.CmdBuilder, pkgbuildDirsByBase, toDiff); errUpd != nil {
return errUpd
}
return nil
}

148
pkg/menus/edit_menu.go Normal file
View File

@ -0,0 +1,148 @@
// edit menu
package menus
import (
"context"
"errors"
"io"
"os"
"os/exec"
"path/filepath"
"strings"
gosrc "github.com/Morganamilo/go-srcinfo"
mapset "github.com/deckarep/golang-set/v2"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/runtime"
"github.com/Jguer/yay/v12/pkg/settings"
"github.com/Jguer/yay/v12/pkg/text"
)
// Editor returns the preferred system editor.
func editor(log *text.Logger, editorConfig, editorFlags string, noConfirm bool) (editor string, args []string) {
switch {
case editorConfig != "":
editor, err := exec.LookPath(editorConfig)
if err != nil {
log.Errorln(err)
} else {
return editor, strings.Fields(editorFlags)
}
fallthrough
case os.Getenv("VISUAL") != "":
if editorArgs := strings.Fields(os.Getenv("VISUAL")); len(editorArgs) != 0 {
editor, err := exec.LookPath(editorArgs[0])
if err != nil {
log.Errorln(err)
} else {
return editor, editorArgs[1:]
}
}
fallthrough
case os.Getenv("EDITOR") != "":
if editorArgs := strings.Fields(os.Getenv("EDITOR")); len(editorArgs) != 0 {
editor, err := exec.LookPath(editorArgs[0])
if err != nil {
log.Errorln(err)
} else {
return editor, editorArgs[1:]
}
}
fallthrough
default:
log.Errorln("\n", gotext.Get("%s is not set", text.Bold(text.Cyan("$EDITOR"))))
log.Warnln(gotext.Get("Add %s or %s to your environment variables", text.Bold(text.Cyan("$EDITOR")), text.Bold(text.Cyan("$VISUAL"))))
for {
log.Infoln(gotext.Get("Edit PKGBUILD with?"))
editorInput, err := log.GetInput("", noConfirm)
if err != nil {
log.Errorln(err)
continue
}
editorArgs := strings.Fields(editorInput)
if len(editorArgs) == 0 {
continue
}
editor, err := exec.LookPath(editorArgs[0])
if err != nil {
log.Errorln(err)
continue
}
return editor, editorArgs[1:]
}
}
}
func editPkgbuilds(log *text.Logger, pkgbuildDirs map[string]string, bases []string, editorConfig,
editorFlags string, srcinfos map[string]*gosrc.Srcinfo, noConfirm bool,
) error {
pkgbuilds := make([]string, 0, len(bases))
for _, pkg := range bases {
dir := pkgbuildDirs[pkg]
pkgbuilds = append(pkgbuilds, filepath.Join(dir, "PKGBUILD"))
if srcinfos != nil {
for _, splitPkg := range srcinfos[pkg].SplitPackages() {
if splitPkg.Install != "" {
pkgbuilds = append(pkgbuilds, filepath.Join(dir, splitPkg.Install))
}
}
}
}
if len(pkgbuilds) > 0 {
editor, editorArgs := editor(log, editorConfig, editorFlags, noConfirm)
editorArgs = append(editorArgs, pkgbuilds...)
editcmd := exec.Command(editor, editorArgs...)
editcmd.Stdin, editcmd.Stdout, editcmd.Stderr = os.Stdin, os.Stdout, os.Stderr
if err := editcmd.Run(); err != nil {
return errors.New(gotext.Get("editor did not exit successfully, aborting: %s", err))
}
}
return nil
}
func EditFn(ctx context.Context, run *runtime.Runtime, w io.Writer,
pkgbuildDirsByBase map[string]string, installed mapset.Set[string],
) error {
if len(pkgbuildDirsByBase) == 0 {
return nil // no work to do
}
bases := make([]string, 0, len(pkgbuildDirsByBase))
for pkg := range pkgbuildDirsByBase {
bases = append(bases, pkg)
}
toEdit, errMenu := selectionMenu(run.Logger, pkgbuildDirsByBase, bases, installed,
gotext.Get("PKGBUILDs to edit?"), settings.NoConfirm, run.Cfg.AnswerEdit, nil)
if errMenu != nil || len(toEdit) == 0 {
return errMenu
}
// TOFIX: remove or use srcinfo data
if errEdit := editPkgbuilds(run.Logger, pkgbuildDirsByBase,
toEdit, run.Cfg.Editor, run.Cfg.EditorFlags, nil, settings.NoConfirm); errEdit != nil {
return errEdit
}
run.Logger.Println()
if !run.Logger.ContinueTask(gotext.Get("Proceed with install?"), true, false) {
return settings.ErrUserAbort{}
}
return nil
}

103
pkg/menus/menu.go Normal file
View File

@ -0,0 +1,103 @@
package menus
import (
"fmt"
"os"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/intrange"
"github.com/Jguer/yay/v12/pkg/settings"
"github.com/Jguer/yay/v12/pkg/text"
mapset "github.com/deckarep/golang-set/v2"
)
func pkgbuildNumberMenu(logger *text.Logger, pkgbuildDirs map[string]string,
bases []string, installed mapset.Set[string],
) {
toPrint := ""
for n, pkgBase := range bases {
dir := pkgbuildDirs[pkgBase]
toPrint += fmt.Sprintf(text.Magenta("%3d")+" %-40s", len(pkgbuildDirs)-n,
text.Bold(pkgBase))
if installed.Contains(pkgBase) {
toPrint += text.Bold(text.Green(gotext.Get(" (Installed)")))
}
// TODO: remove or refactor to check if git dir is unclean
if _, err := os.Stat(dir); !os.IsNotExist(err) {
toPrint += text.Bold(text.Green(gotext.Get(" (Build Files Exist)")))
}
toPrint += "\n"
}
logger.Print(toPrint)
}
func selectionMenu(logger *text.Logger, pkgbuildDirs map[string]string, bases []string, installed mapset.Set[string],
message string, noConfirm bool, defaultAnswer string, skipFunc func(string) bool,
) ([]string, error) {
selected := make([]string, 0)
pkgbuildNumberMenu(logger, pkgbuildDirs, bases, installed)
logger.Infoln(message)
logger.Infoln(gotext.Get("%s [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)", text.Cyan(gotext.Get("[N]one"))))
selectInput, err := logger.GetInput(defaultAnswer, noConfirm)
if err != nil {
return nil, err
}
eInclude, eExclude, eOtherInclude, eOtherExclude := intrange.ParseNumberMenu(selectInput)
eIsInclude := len(eExclude) == 0 && eOtherExclude.Cardinality() == 0
if eOtherInclude.Contains("abort") || eOtherInclude.Contains("ab") {
return nil, settings.ErrUserAbort{}
}
if eOtherInclude.Contains("n") || eOtherInclude.Contains("none") {
return selected, nil
}
for i, pkgBase := range bases {
if skipFunc != nil && skipFunc(pkgBase) {
continue
}
anyInstalled := installed.Contains(pkgBase)
if !eIsInclude && eExclude.Get(len(bases)-i) {
continue
}
if anyInstalled && (eOtherInclude.Contains("i") || eOtherInclude.Contains("installed")) {
selected = append(selected, pkgBase)
continue
}
if !anyInstalled && (eOtherInclude.Contains("no") || eOtherInclude.Contains("notinstalled")) {
selected = append(selected, pkgBase)
continue
}
if eOtherInclude.Contains("a") || eOtherInclude.Contains("all") {
selected = append(selected, pkgBase)
continue
}
if eIsInclude && (eInclude.Get(len(bases)-i) || eOtherInclude.Contains(pkgBase)) {
selected = append(selected, pkgBase)
}
if !eIsInclude && (!eExclude.Get(len(bases)-i) && !eOtherExclude.Contains(pkgBase)) {
selected = append(selected, pkgBase)
}
}
return selected, nil
}

View File

@ -0,0 +1,41 @@
package multierror
import "sync"
// MultiError type handles error accumulation from goroutines.
type MultiError struct {
Errors []error
mux sync.Mutex
}
// Error turns the MultiError structure into a string.
func (err *MultiError) Error() string {
str := ""
for _, e := range err.Errors {
str += e.Error() + "\n"
}
return str[:len(str)-1]
}
// Add adds an error to the Multierror structure.
func (err *MultiError) Add(e error) {
if e == nil {
return
}
err.mux.Lock()
err.Errors = append(err.Errors, e)
err.mux.Unlock()
}
// Return is used as a wrapper on return on whether to return the
// MultiError Structure if errors exist or nil instead of delivering an empty structure.
func (err *MultiError) Return() error {
if len(err.Errors) > 0 {
return err
}
return nil
}

View File

@ -0,0 +1,11 @@
2019-12-20 Xorg cleanup requires manual intervention
2020-01-04 Now using Zstandard instead of xz for package compression
2020-01-15 rsync compatibility
2020-02-17 sshd needs restarting after upgrading to openssh-8.2p1
2020-02-22 Planet Arch Linux migration
2020-02-24 The Future of the Arch Linux Project Leader
2020-03-01 firewalld>=0.8.1-2 update requires manual intervention
2020-03-19 hplip 3.20.3-2 update requires manual intervention
2020-04-13 nss>=3.51.1-1 and lib32-nss>=3.51.1-1 updates require manual intervention
2020-04-14 zn_poly 0.9.2-2 update requires manual intervention

View File

@ -0,0 +1,114 @@
2019-12-20 Xorg cleanup requires manual intervention
In the process of Xorg cleanup the update requires manual
intervention when you hit this message:
:: installing xorgproto (2019.2-2) breaks dependency 'inputproto' required by lib32-libxi
:: installing xorgproto (2019.2-2) breaks dependency 'dmxproto' required by libdmx
:: installing xorgproto (2019.2-2) breaks dependency 'xf86dgaproto' required by libxxf86dga
:: installing xorgproto (2019.2-2) breaks dependency 'xf86miscproto' required by libxxf86misc

when updating, use: pacman -Rdd libdmx libxxf86dga libxxf86misc && pacman -Syu to perform the upgrade.

2020-01-04 Now using Zstandard instead of xz for package compression
As announced on the mailing list, on Friday, Dec 27 2019, our package compression scheme has changed from xz (.pkg.tar.xz) to zstd (.pkg.tar.zst).
zstd and xz trade blows in their compression ratio. Recompressing all packages to zstd with our options yields a total ~0.8% increase in package size on all of our packages combined, but the decompression time for all packages saw a ~1300% speedup.
We already have more than 545 zstd-compressed packages in our repositories, and as packages get updated more will keep rolling in. We have not found any user-facing issues as of yet, so things appear to be working.
As a packager, you will automatically start building .pkg.tar.zst packages if you are using the latest version of devtools (>= 20191227).
As an end-user no manual intervention is required, assuming that you have read and followed the news post from late last year.
If you nevertheless haven't updated libarchive since 2018, all hope is not lost! Binary builds of pacman-static are available from Eli Schwartz' personal repository (or direct link to binary), signed with their Trusted User keys, with which you can perform the update.

2020-01-15 rsync compatibility
Our rsync package was shipped with bundled zlib to provide compatibility
with the old-style --compress option up to version 3.1.0. Version 3.1.1 was
released on 2014-06-22 and is shipped by all major distributions now.
So we decided to finally drop the bundled library and ship a package with
system zlib. This also fixes security issues, actual ones and in future. Go
and blame those running old versions if you encounter errors with rsync
3.1.3-3.

2020-02-17 sshd needs restarting after upgrading to openssh-8.2p1
After upgrading to openssh-8.2p1, the existing SSH daemon will be unable to accept new connections. (See FS#65517.) When upgrading remote hosts, please make sure to restart the SSH daemon using systemctl restart sshd right after running pacman -Syu. If you are upgrading to openssh-8.2p1-3 or higher, this restart will happen automatically.

2020-02-22 Planet Arch Linux migration
The software behind planet.archlinux.org was implemented in Python 2 and is no longer maintained upstream. This functionality has now been implemented in archlinux.org's archweb backend which is actively maintained but offers a slightly different experience.
The most notable changes are the offered feeds and the feed location. Archweb only offers an Atom feed which is located at here.

2020-02-24 The Future of the Arch Linux Project Leader
Hello everyone,
Some of you may know me from the days when I was much more involved in Arch, but most of you probably just know me as a name on the website. Ive been with Arch for some time, taking the leadership of this beast over from Judd back in 2007. But, as these things often go, my involvement has slid down to minimal levels over time. Its high time that changes.
Arch Linux needs involved leadership to make hard decisions and direct the project where it needs to go. And I am not in a position to do this.
In a team effort, the Arch Linux staff devised a new process for determining future leaders. From now on, leaders will be elected by the staff for a term length of two years. Details of this new process can be found here
In the first official vote with Levente Polyak (anthraxx), Gaetan Bisson (vesath), Giancarlo Razzolini (grazzolini), and Sven-Hendrik Haase (svenstaro) as candidates, and through 58 verified votes, a winner was chosen:
Levente Polyak (anthraxx) will be taking over the reins of this ship. Congratulations!
Thanks for everything over all these years,
Aaron Griffin (phrakture)

2020-03-01 firewalld>=0.8.1-2 update requires manual intervention
The firewalld package prior to version 0.8.1-2 was missing the compiled python modules. This has been fixed in 0.8.1-2, so the upgrade will need to overwrite the untracked pyc files created. If you get errors like these
firewalld: /usr/lib/python3.8/site-packages/firewall/__pycache__/__init__.cpython-38.pyc exists in filesystem
firewalld: /usr/lib/python3.8/site-packages/firewall/__pycache__/client.cpython-38.pyc exists in filesystem
firewalld: /usr/lib/python3.8/site-packages/firewall/__pycache__/dbus_utils.cpython-38.pyc exists in filesystem
...many more...

when updating, use
pacman -Suy --overwrite /usr/lib/python3.8/site-packages/firewall/\*

to perform the upgrade.

2020-03-19 hplip 3.20.3-2 update requires manual intervention
The hplip package prior to version 3.20.3-2 was missing the compiled
python modules. This has been fixed in 3.20.3-2, so the upgrade will
need to overwrite the untracked pyc files that were created. If you get errors
such as these
hplip: /usr/share/hplip/base/__pycache__/__init__.cpython-38.pyc exists in filesystem
hplip: /usr/share/hplip/base/__pycache__/avahi.cpython-38.pyc exists in filesystem
hplip: /usr/share/hplip/base/__pycache__/codes.cpython-38.pyc exists in filesystem
...many more...

when updating, use
pacman -Suy --overwrite /usr/share/hplip/\*

to perform the upgrade.

2020-04-13 nss>=3.51.1-1 and lib32-nss>=3.51.1-1 updates require manual intervention
The nss and lib32-nss packages prior to version 3.51.1-1 were missing a soname link each. This has been fixed in 3.51.1-1, so the upgrade will need to overwrite the untracked files created by ldconfig. If you get any of these errors
nss: /usr/lib/p11-kit-trust.so exists in filesystem
lib32-nss: /usr/lib32/p11-kit-trust.so exists in filesystem

when updating, use
pacman -Syu --overwrite /usr/lib\*/p11-kit-trust.so

to perform the upgrade.

2020-04-14 zn_poly 0.9.2-2 update requires manual intervention
The zn_poly package prior to version 0.9.2-2 was missing a soname link.
This has been fixed in 0.9.2-2, so the upgrade will need to overwrite the
untracked files created by ldconfig. If you get an error
zn_poly: /usr/lib/libzn_poly-0.9.so exists in filesystem

when updating, use
pacman -Syu --overwrite usr/lib/libzn_poly-0.9.so

to perform the upgrade.


View File

@ -0,0 +1,3 @@
2020-04-13 nss>=3.51.1-1 and lib32-nss>=3.51.1-1 updates require manual intervention
2020-04-14 zn_poly 0.9.2-2 update requires manual intervention

View File

@ -0,0 +1,3 @@
2020-04-14 zn_poly 0.9.2-2 update requires manual intervention
2020-04-13 nss>=3.51.1-1 and lib32-nss>=3.51.1-1 updates require manual intervention

View File

@ -0,0 +1,3 @@
2020-04-14 zn_poly 0.9.2-2 update requires manual intervention
The zn_poly package prior to version 0.9.2-2 was missing a soname link.

174
pkg/news/news.go Normal file
View File

@ -0,0 +1,174 @@
package news
import (
"bytes"
"context"
"encoding/xml"
"html"
"io"
"net/http"
"strings"
"time"
"github.com/Jguer/yay/v12/pkg/text"
)
type item struct {
Title string `xml:"title"`
Link string `xml:"link"`
Description string `xml:"description"`
PubDate string `xml:"pubDate"`
Creator string `xml:"dc:creator"`
}
func (item *item) printNews(logger *text.Logger, buildTime time.Time, all, quiet bool) {
var fd string
date, err := time.Parse(time.RFC1123Z, item.PubDate)
if err != nil {
logger.Errorln(err)
} else {
fd = text.FormatTime(int(date.Unix()))
if !all && !buildTime.IsZero() {
if buildTime.After(date) {
return
}
}
}
logger.Println(text.Bold(text.Magenta(fd)), text.Bold(strings.TrimSpace(item.Title)))
if !quiet {
desc := strings.TrimSpace(parseNews(item.Description))
logger.Println(desc)
}
}
type channel struct {
Title string `xml:"title"`
Link string `xml:"link"`
Description string `xml:"description"`
Language string `xml:"language"`
Lastbuilddate string `xml:"lastbuilddate"`
Items []item `xml:"item"`
}
type rss struct {
Channel channel `xml:"channel"`
}
func PrintNewsFeed(ctx context.Context, client *http.Client, logger *text.Logger,
cutOffDate time.Time, bottomUp, all, quiet bool,
) error {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://archlinux.org/feeds/news", http.NoBody)
if err != nil {
return err
}
resp, err := client.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return err
}
rssGot := rss{}
d := xml.NewDecoder(bytes.NewReader(body))
if err := d.Decode(&rssGot); err != nil {
return err
}
if bottomUp {
for i := len(rssGot.Channel.Items) - 1; i >= 0; i-- {
rssGot.Channel.Items[i].printNews(logger, cutOffDate, all, quiet)
}
} else {
for i := 0; i < len(rssGot.Channel.Items); i++ {
rssGot.Channel.Items[i].printNews(logger, cutOffDate, all, quiet)
}
}
return nil
}
// Crude html parsing, good enough for the arch news
// This is only displayed in the terminal so there should be no security
// concerns.
func parseNews(str string) string {
var (
buffer bytes.Buffer
tagBuffer bytes.Buffer
escapeBuffer bytes.Buffer
inTag = false
inEscape = false
)
for _, char := range str {
if inTag {
if char == '>' {
inTag = false
switch tagBuffer.String() {
case "code":
buffer.WriteString(text.CyanCode)
case "/code":
buffer.WriteString(text.ResetCode)
case "/p":
buffer.WriteRune('\n')
}
continue
}
tagBuffer.WriteRune(char)
continue
}
if inEscape {
if char == ';' {
inEscape = false
escapeBuffer.WriteRune(char)
s := html.UnescapeString(escapeBuffer.String())
buffer.WriteString(s)
continue
}
escapeBuffer.WriteRune(char)
continue
}
if char == '<' {
inTag = true
tagBuffer.Reset()
continue
}
if char == '&' {
inEscape = true
escapeBuffer.Reset()
escapeBuffer.WriteRune(char)
continue
}
buffer.WriteRune(char)
}
buffer.WriteString(text.ResetCode)
return buffer.String()
}

179
pkg/news/news_test.go Normal file
View File

@ -0,0 +1,179 @@
//go:build !integration
// +build !integration
package news
import (
"context"
"io"
"net/http"
"os"
"strings"
"testing"
"time"
"github.com/bradleyjkemp/cupaloy"
"github.com/stretchr/testify/assert"
"gopkg.in/h2non/gock.v1"
"github.com/Jguer/yay/v12/pkg/text"
)
const lastNews = `
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>Arch Linux: Recent news updates</title>
<link>https://www.archlinux.org/news/</link>
<description>The latest and greatest news from the Arch Linux distribution.</description>
<atom:link href="https://www.archlinux.org/feeds/news/" rel="self" />
<language>en-us</language>
<lastBuildDate>Tue, 14 Apr 2020 16:30:32 +0000</lastBuildDate>
<item>
<title>zn_poly 0.9.2-2 update requires manual intervention</title>
<link>https://www.archlinux.org/news/zn_poly-092-2-update-requires-manual-intervention/</link>
<description>&lt;p&gt;The zn_poly package prior to version 0.9.2-2 was missing a soname link.</description>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Antonio Rojas</dc:creator>
<pubDate>Tue, 14 Apr 2020 16:30:30 +0000</pubDate>
<guid isPermaLink="false">tag:www.archlinux.org,2020-04-14:/news/zn_poly-092-2-update-requires-manual-intervention/</guid>
</item>
</channel>
</rss>
`
const sampleNews = `<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Arch Linux: Recent news updates</title><link>https://www.archlinux.org/news/</link><description>The latest and greatest news from the Arch Linux distribution.</description><atom:link href="https://www.archlinux.org/feeds/news/" rel="self"></atom:link><language>en-us</language><lastBuildDate>Tue, 14 Apr 2020 16:30:32 +0000</lastBuildDate><item><title>zn_poly 0.9.2-2 update requires manual intervention</title><link>https://www.archlinux.org/news/zn_poly-092-2-update-requires-manual-intervention/</link><description>&lt;p&gt;The zn_poly package prior to version 0.9.2-2 was missing a soname link.
This has been fixed in 0.9.2-2, so the upgrade will need to overwrite the
untracked files created by ldconfig. If you get an error&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;zn_poly: /usr/lib/libzn_poly-0.9.so exists in filesystem
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;when updating, use&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pacman -Syu --overwrite usr/lib/libzn_poly-0.9.so
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to perform the upgrade.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Antonio Rojas</dc:creator><pubDate>Tue, 14 Apr 2020 16:30:30 +0000</pubDate><guid isPermaLink="false">tag:www.archlinux.org,2020-04-14:/news/zn_poly-092-2-update-requires-manual-intervention/</guid></item><item><title>nss&gt;=3.51.1-1 and lib32-nss&gt;=3.51.1-1 updates require manual intervention</title><link>https://www.archlinux.org/news/nss3511-1-and-lib32-nss3511-1-updates-require-manual-intervention/</link><description>&lt;p&gt;The nss and lib32-nss packages prior to version 3.51.1-1 were missing a soname link each. This has been fixed in 3.51.1-1, so the upgrade will need to overwrite the untracked files created by ldconfig. If you get any of these errors&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nss: /usr/lib/p11-kit-trust.so exists in filesystem
lib32-nss: /usr/lib32/p11-kit-trust.so exists in filesystem
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;when updating, use&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pacman -Syu --overwrite /usr/lib\*/p11-kit-trust.so
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to perform the upgrade.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jan Alexander Steffens</dc:creator><pubDate>Mon, 13 Apr 2020 00:35:58 +0000</pubDate><guid isPermaLink="false">tag:www.archlinux.org,2020-04-13:/news/nss3511-1-and-lib32-nss3511-1-updates-require-manual-intervention/</guid></item><item><title>hplip 3.20.3-2 update requires manual intervention</title><link>https://www.archlinux.org/news/hplip-3203-2-update-requires-manual-intervention/</link><description>&lt;p&gt;The hplip package prior to version 3.20.3-2 was missing the compiled
python modules. This has been fixed in 3.20.3-2, so the upgrade will
need to overwrite the untracked pyc files that were created. If you get errors
such as these&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hplip: /usr/share/hplip/base/__pycache__/__init__.cpython-38.pyc exists in filesystem
hplip: /usr/share/hplip/base/__pycache__/avahi.cpython-38.pyc exists in filesystem
hplip: /usr/share/hplip/base/__pycache__/codes.cpython-38.pyc exists in filesystem
...many more...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;when updating, use&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pacman -Suy --overwrite /usr/share/hplip/\*
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to perform the upgrade.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Andreas Radke</dc:creator><pubDate>Thu, 19 Mar 2020 06:53:30 +0000</pubDate><guid isPermaLink="false">tag:www.archlinux.org,2020-03-19:/news/hplip-3203-2-update-requires-manual-intervention/</guid></item><item><title>firewalld&gt;=0.8.1-2 update requires manual intervention</title><link>https://www.archlinux.org/news/firewalld081-2-update-requires-manual-intervention/</link><description>&lt;p&gt;The firewalld package prior to version 0.8.1-2 was missing the compiled python modules. This has been fixed in 0.8.1-2, so the upgrade will need to overwrite the untracked pyc files created. If you get errors like these&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;firewalld: /usr/lib/python3.8/site-packages/firewall/__pycache__/__init__.cpython-38.pyc exists in filesystem
firewalld: /usr/lib/python3.8/site-packages/firewall/__pycache__/client.cpython-38.pyc exists in filesystem
firewalld: /usr/lib/python3.8/site-packages/firewall/__pycache__/dbus_utils.cpython-38.pyc exists in filesystem
...many more...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;when updating, use&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pacman -Suy --overwrite /usr/lib/python3.8/site-packages/firewall/\*
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to perform the upgrade.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jan Alexander Steffens</dc:creator><pubDate>Sun, 01 Mar 2020 16:36:48 +0000</pubDate><guid isPermaLink="false">tag:www.archlinux.org,2020-03-01:/news/firewalld081-2-update-requires-manual-intervention/</guid></item><item><title>The Future of the Arch Linux Project Leader</title><link>https://www.archlinux.org/news/the-future-of-the-arch-linux-project-leader/</link><description>&lt;p&gt;Hello everyone,&lt;/p&gt;
&lt;p&gt;Some of you may know me from the days when I was much more involved in Arch, but most of you probably just know me as a name on the website. Ive been with Arch for some time, taking the leadership of this beast over from Judd back in 2007. But, as these things often go, my involvement has slid down to minimal levels over time. Its high time that changes.&lt;/p&gt;
&lt;p&gt;Arch Linux needs involved leadership to make hard decisions and direct the project where it needs to go. And I am not in a position to do this.&lt;/p&gt;
&lt;p&gt;In a team effort, the Arch Linux staff devised a new process for determining future leaders. From now on, leaders will be elected by the staff for a term length of two years. Details of this new process can be found &lt;a href="https://wiki.archlinux.org/index.php/DeveloperWiki:Project_Leader"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the first official vote with Levente Polyak (anthraxx), Gaetan Bisson (vesath), Giancarlo Razzolini (grazzolini), and Sven-Hendrik Haase (svenstaro) as candidates, and through 58 verified votes, a winner was chosen:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Levente Polyak (anthraxx) will be taking over the reins of this ship. Congratulations!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Thanks for everything over all these years,&lt;br /&gt;
Aaron Griffin (phrakture)&lt;/em&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Aaron Griffin</dc:creator><pubDate>Mon, 24 Feb 2020 15:56:28 +0000</pubDate><guid isPermaLink="false">tag:www.archlinux.org,2020-02-24:/news/the-future-of-the-arch-linux-project-leader/</guid></item><item><title>Planet Arch Linux migration</title><link>https://www.archlinux.org/news/planet-arch-linux-migration/</link><description>&lt;p&gt;The software behind planet.archlinux.org was implemented in Python 2 and is no longer maintained upstream. This functionality has now been implemented in archlinux.org's archweb backend which is actively maintained but offers a slightly different experience.&lt;/p&gt;
&lt;p&gt;The most notable changes are the offered feeds and the feed location. Archweb only offers an Atom feed which is located at &lt;a href="https://archlinux.org/feeds/planet"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jelle van der Waa</dc:creator><pubDate>Sat, 22 Feb 2020 22:43:00 +0000</pubDate><guid isPermaLink="false">tag:www.archlinux.org,2020-02-22:/news/planet-arch-linux-migration/</guid></item><item><title>sshd needs restarting after upgrading to openssh-8.2p1</title><link>https://www.archlinux.org/news/sshd-needs-restarting-after-upgrading-to-openssh-82p1/</link><description>&lt;p&gt;After upgrading to openssh-8.2p1, the existing SSH daemon will be unable to accept new connections. (See &lt;a href="https://bugs.archlinux.org/task/65517"&gt;FS#65517&lt;/a&gt;.) When upgrading remote hosts, please make sure to restart the SSH daemon using &lt;code&gt;systemctl restart sshd&lt;/code&gt; right after running &lt;code&gt;pacman -Syu&lt;/code&gt;. If you are upgrading to openssh-8.2p1-3 or higher, this restart will happen automatically.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gaetan Bisson</dc:creator><pubDate>Mon, 17 Feb 2020 01:35:04 +0000</pubDate><guid isPermaLink="false">tag:www.archlinux.org,2020-02-17:/news/sshd-needs-restarting-after-upgrading-to-openssh-82p1/</guid></item><item><title>rsync compatibility</title><link>https://www.archlinux.org/news/rsync-compatibility/</link><description>&lt;p&gt;Our &lt;code&gt;rsync&lt;/code&gt; package was shipped with bundled &lt;code&gt;zlib&lt;/code&gt; to provide compatibility
with the old-style &lt;code&gt;--compress&lt;/code&gt; option up to version 3.1.0. Version 3.1.1 was
released on 2014-06-22 and is shipped by all major distributions now.&lt;/p&gt;
&lt;p&gt;So we decided to finally drop the bundled library and ship a package with
system &lt;code&gt;zlib&lt;/code&gt;. This also fixes security issues, actual ones and in future. Go
and blame those running old versions if you encounter errors with &lt;code&gt;rsync
3.1.3-3&lt;/code&gt;.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Christian Hesse</dc:creator><pubDate>Wed, 15 Jan 2020 20:14:43 +0000</pubDate><guid isPermaLink="false">tag:www.archlinux.org,2020-01-15:/news/rsync-compatibility/</guid></item><item><title>Now using Zstandard instead of xz for package compression</title><link>https://www.archlinux.org/news/now-using-zstandard-instead-of-xz-for-package-compression/</link><description>&lt;p&gt;As announced on the &lt;a href="https://lists.archlinux.org/pipermail/arch-dev-public/2019-December/029752.html"&gt;mailing list&lt;/a&gt;, on Friday, Dec 27 2019, our package compression scheme has changed from xz (.pkg.tar.xz) to &lt;a href="https://lists.archlinux.org/pipermail/arch-dev-public/2019-December/029778.html"&gt;zstd (.pkg.tar.zst)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;zstd and xz trade blows in their compression ratio. Recompressing all packages to zstd with our options yields a total ~0.8% increase in package size on all of our packages combined, but the decompression time for all packages saw a ~1300% speedup.&lt;/p&gt;
&lt;p&gt;We already have more than 545 zstd-compressed packages in our repositories, and as packages get updated more will keep rolling in. We have not found any user-facing issues as of yet, so things appear to be working.&lt;/p&gt;
&lt;p&gt;As a packager, you will automatically start building .pkg.tar.zst packages if you are using the latest version of devtools (&amp;gt;= 20191227).&lt;br /&gt;
As an end-user no manual intervention is required, assuming that you have read and followed the news post &lt;a href="https://www.archlinux.org/news/required-update-to-recent-libarchive/"&gt;from late last year&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you nevertheless haven't updated libarchive since 2018, all hope is not lost! Binary builds of pacman-static are available from Eli Schwartz' &lt;a href="https://wiki.archlinux.org/index.php/Unofficial_user_repositories#eschwartz"&gt;personal repository&lt;/a&gt; (or direct link to &lt;a href="https://pkgbuild.com/~eschwartz/repo/x86_64-extracted/"&gt;binary&lt;/a&gt;), signed with their Trusted User keys, with which you can perform the update.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Robin Broda</dc:creator><pubDate>Sat, 04 Jan 2020 20:35:55 +0000</pubDate><guid isPermaLink="false">tag:www.archlinux.org,2020-01-04:/news/now-using-zstandard-instead-of-xz-for-package-compression/</guid></item><item><title>Xorg cleanup requires manual intervention</title><link>https://www.archlinux.org/news/xorg-cleanup-requires-manual-intervention/</link><description>&lt;p&gt;In the process of &lt;a href="https://bugs.archlinux.org/task/64892"&gt;Xorg cleanup&lt;/a&gt; the update requires manual
intervention when you hit this message:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:: installing xorgproto (2019.2-2) breaks dependency 'inputproto' required by lib32-libxi
:: installing xorgproto (2019.2-2) breaks dependency 'dmxproto' required by libdmx
:: installing xorgproto (2019.2-2) breaks dependency 'xf86dgaproto' required by libxxf86dga
:: installing xorgproto (2019.2-2) breaks dependency 'xf86miscproto' required by libxxf86misc
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;when updating, use: &lt;code&gt;pacman -Rdd libdmx libxxf86dga libxxf86misc &amp;amp;&amp;amp; pacman -Syu&lt;/code&gt; to perform the upgrade.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Andreas Radke</dc:creator><pubDate>Fri, 20 Dec 2019 13:37:40 +0000</pubDate><guid isPermaLink="false">tag:www.archlinux.org,2019-12-20:/news/xorg-cleanup-requires-manual-intervention/</guid></item></channel></rss>
`
func TestPrintNewsFeed(t *testing.T) {
layout := "2006-01-02"
str := "2020-04-13"
lastNewsTime, _ := time.Parse(layout, str)
type args struct {
cutOffDate time.Time
bottomUp bool
all bool
quiet bool
}
tests := []struct {
name string
args args
wantErr bool
}{
{name: "all-verbose", args: args{bottomUp: true, cutOffDate: time.Now(), all: true, quiet: false}, wantErr: false},
{name: "all-quiet", args: args{bottomUp: true, cutOffDate: lastNewsTime, all: true, quiet: true}, wantErr: false},
{name: "latest-quiet", args: args{bottomUp: true, cutOffDate: lastNewsTime, all: false, quiet: true}, wantErr: false},
{name: "latest-quiet-topdown", args: args{bottomUp: false, cutOffDate: lastNewsTime, all: false, quiet: true}, wantErr: false},
}
t.Setenv("TZ", "UTC")
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
gock.New("https://archlinux.org").
Get("/feeds/news").
Reply(200).
BodyString(sampleNews)
defer gock.Off()
r, w, _ := os.Pipe()
logger := text.NewLogger(w, w, strings.NewReader(""), false, "logger")
err := PrintNewsFeed(context.Background(), &http.Client{}, logger,
tt.args.cutOffDate, tt.args.bottomUp, tt.args.all, tt.args.quiet)
assert.NoError(t, err)
w.Close()
out, _ := io.ReadAll(r)
cupaloy.SnapshotT(t, out)
})
}
}
// GIVEN last build time at 13h00
// WHEN there's a news posted at 18h00
// THEN it should still be printed
func TestPrintNewsFeedSameDay(t *testing.T) {
str := "2020-04-14T13:04:05Z"
lastNewsTime, _ := time.Parse(time.RFC3339, str)
gock.New("https://archlinux.org").
Get("/feeds/news").
Reply(200).
BodyString(lastNews)
defer gock.Off()
r, w, _ := os.Pipe()
logger := text.NewLogger(w, w, strings.NewReader(""), false, "logger")
err := PrintNewsFeed(context.Background(), &http.Client{}, logger,
lastNewsTime, true, false, false)
assert.NoError(t, err)
w.Close()
out, _ := io.ReadAll(r)
cupaloy.SnapshotT(t, out)
}

110
pkg/query/aur_warnings.go Normal file
View File

@ -0,0 +1,110 @@
package query
import (
"strings"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/aur"
"github.com/Jguer/go-alpm/v2"
"github.com/Jguer/yay/v12/pkg/db"
"github.com/Jguer/yay/v12/pkg/text"
)
type AURWarnings struct {
Orphans []string
OutOfDate []string
Missing []string
LocalNewer []string
log *text.Logger
}
func NewWarnings(logger *text.Logger) *AURWarnings {
return &AURWarnings{log: logger}
}
func (warnings *AURWarnings) AddToWarnings(remote map[string]alpm.IPackage, aurPkg *aur.Pkg) {
name := aurPkg.Name
pkg, ok := remote[name]
if !ok {
return
}
if aurPkg.Maintainer == "" && !pkg.ShouldIgnore() {
warnings.Orphans = append(warnings.Orphans, name)
}
if aurPkg.OutOfDate != 0 && !pkg.ShouldIgnore() {
warnings.OutOfDate = append(warnings.OutOfDate, name)
}
if !pkg.ShouldIgnore() && !isDevelPackage(pkg) && db.VerCmp(pkg.Version(), aurPkg.Version) > 0 {
left, right := GetVersionDiff(pkg.Version(), aurPkg.Version)
newerMsg := gotext.Get("%s: local (%s) is newer than AUR (%s)",
text.Cyan(name),
left, right,
)
warnings.LocalNewer = append(warnings.LocalNewer, newerMsg)
}
}
func (warnings *AURWarnings) CalculateMissing(remoteNames []string,
remote map[string]alpm.IPackage, aurData map[string]*aur.Pkg,
) {
for _, name := range remoteNames {
if _, ok := aurData[name]; !ok && !remote[name].ShouldIgnore() {
if _, ok := aurData[strings.TrimSuffix(name, "-debug")]; !ok {
warnings.Missing = append(warnings.Missing, name)
}
}
}
}
func (warnings *AURWarnings) Print() {
normalMissing, debugMissing := filterDebugPkgs(warnings.Missing)
if len(normalMissing) > 0 {
warnings.log.Warnln(gotext.Get("Packages not in AUR:"), formatNames(normalMissing))
}
if len(debugMissing) > 0 {
warnings.log.Warnln(gotext.Get("Missing AUR Debug Packages:"), formatNames(debugMissing))
}
if len(warnings.Orphans) > 0 {
warnings.log.Warnln(gotext.Get("Orphan (unmaintained) AUR Packages:"), formatNames(warnings.Orphans))
}
if len(warnings.OutOfDate) > 0 {
warnings.log.Warnln(gotext.Get("Flagged Out Of Date AUR Packages:"), formatNames(warnings.OutOfDate))
}
if len(warnings.LocalNewer) > 0 {
for _, newer := range warnings.LocalNewer {
warnings.log.Warnln(newer)
}
}
}
func filterDebugPkgs(names []string) (normal, debug []string) {
normal = make([]string, 0, len(names))
debug = make([]string, 0, len(names))
for _, name := range names {
if strings.HasSuffix(name, "-debug") {
debug = append(debug, name)
} else {
normal = append(normal, name)
}
}
return
}
func formatNames(names []string) string {
return " " + text.Cyan(strings.Join(names, " "))
}

21
pkg/query/errors.go Normal file
View File

@ -0,0 +1,21 @@
package query
import (
"github.com/leonelquinteros/gotext"
)
// ErrAURSearch means that it was not possible to connect to the AUR.
type ErrAURSearch struct {
inner error
}
func (e ErrAURSearch) Error() string {
return gotext.Get("Error during AUR search: %s\n", e.inner.Error())
}
// ErrNoQuery means that query was not executed.
type ErrNoQuery struct{}
func (e ErrNoQuery) Error() string {
return gotext.Get("no query was executed")
}

30
pkg/query/filter.go Normal file
View File

@ -0,0 +1,30 @@
package query
import (
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/settings/parser"
"github.com/Jguer/yay/v12/pkg/text"
)
func RemoveInvalidTargets(logger *text.Logger, targets []string, mode parser.TargetMode) []string {
filteredTargets := make([]string, 0)
for _, target := range targets {
dbName, _ := text.SplitDBFromName(target)
if dbName == "aur" && !mode.AtLeastAUR() {
logger.Warnln(gotext.Get("%s: can't use target with option --repo -- skipping", text.Cyan(target)))
continue
}
if dbName != "aur" && dbName != "" && !mode.AtLeastRepo() {
logger.Warnln(gotext.Get("%s: can't use target with option --aur -- skipping", text.Cyan(target)))
continue
}
filteredTargets = append(filteredTargets, target)
}
return filteredTargets
}

89
pkg/query/metric.go Normal file
View File

@ -0,0 +1,89 @@
package query
import (
"hash/fnv"
"strings"
"github.com/adrg/strutil"
)
const minVotes = 30
// TODO: Add support for Popularity and LastModified
func (a *abstractResults) aurSortByMetric(pkg *abstractResult) float64 {
return 1 - (minVotes / (minVotes + float64(pkg.votes)))
}
func (a *abstractResults) GetMetric(pkg *abstractResult) float64 {
if v, ok := a.distanceCache[pkg.name]; ok {
return v
}
if strings.EqualFold(pkg.name, a.search) {
return 1.0
}
sim := strutil.Similarity(pkg.name, a.search, a.metric)
for _, prov := range pkg.provides {
// If the package provides search, it's a perfect match
// AUR packages don't populate provides
candidate := strutil.Similarity(prov, a.search, a.metric) * 0.80
if candidate > sim {
sim = candidate
}
}
simDesc := strutil.Similarity(pkg.description, a.search, a.metric)
// slightly overweight sync sources by always giving them max popularity
popularity := 1.0
if pkg.source == sourceAUR {
popularity = a.aurSortByMetric(pkg)
}
sim = sim*0.5 + simDesc*0.2 + popularity*0.3
a.distanceCache[pkg.name] = sim
return sim
}
func (a *abstractResults) separateSourceScore(source string, score float64) float64 {
if !a.separateSources {
return 0
}
if score == 1.0 {
return 50
}
switch source {
case sourceAUR:
return 0
case "core":
return 40
case "extra":
return 30
case "community":
return 20
case "multilib":
return 10
}
if v, ok := a.separateSourceCache[source]; ok {
return v
}
h := fnv.New32a()
h.Write([]byte(source))
sourceScore := float64(int(h.Sum32())%9 + 2)
a.separateSourceCache[source] = sourceScore
return sourceScore
}
func (a *abstractResults) calculateMetric(pkg *abstractResult) float64 {
score := a.GetMetric(pkg)
return a.separateSourceScore(pkg.source, score) + score
}

298
pkg/query/query_builder.go Normal file
View File

@ -0,0 +1,298 @@
package query
import (
"context"
"sort"
"strconv"
"strings"
"unicode"
"github.com/Jguer/aur"
"github.com/Jguer/go-alpm/v2"
"github.com/adrg/strutil"
"github.com/adrg/strutil/metrics"
mapset "github.com/deckarep/golang-set/v2"
"github.com/leonelquinteros/gotext"
"github.com/Jguer/yay/v12/pkg/db"
"github.com/Jguer/yay/v12/pkg/intrange"
"github.com/Jguer/yay/v12/pkg/settings/parser"
"github.com/Jguer/yay/v12/pkg/text"
)
const sourceAUR = "aur"
type SearchVerbosity int
// Verbosity settings for search.
const (
NumberMenu SearchVerbosity = iota
Detailed
Minimal
)
type Builder interface {
Len() int
Execute(ctx context.Context, dbExecutor db.Executor, pkgS []string)
Results(dbExecutor db.Executor, verboseSearch SearchVerbosity) error
GetTargets(include, exclude intrange.IntRanges, otherExclude mapset.Set[string]) ([]string, error)
}
type SourceQueryBuilder struct {
results []abstractResult
sortBy string
searchBy string
targetMode parser.TargetMode
queryMap map[string]map[string]interface{}
bottomUp bool
singleLineResults bool
separateSources bool
aurClient aur.QueryClient
logger *text.Logger
}
func NewSourceQueryBuilder(
aurClient aur.QueryClient,
logger *text.Logger,
sortBy string,
targetMode parser.TargetMode,
searchBy string,
bottomUp,
singleLineResults bool,
separateSources bool,
) *SourceQueryBuilder {
return &SourceQueryBuilder{
aurClient: aurClient,
logger: logger,
bottomUp: bottomUp,
sortBy: sortBy,
targetMode: targetMode,
searchBy: searchBy,
singleLineResults: singleLineResults,
separateSources: separateSources,
queryMap: map[string]map[string]interface{}{},
results: make([]abstractResult, 0, 100),
}
}
type abstractResult struct {
source string
name string
description string
votes int
provides []string
}
type abstractResults struct {
results []abstractResult
search string
bottomUp bool
metric strutil.StringMetric
separateSources bool
sortBy string
distanceCache map[string]float64
separateSourceCache map[string]float64
}
func (a *abstractResults) Len() int { return len(a.results) }
func (a *abstractResults) Swap(i, j int) { a.results[i], a.results[j] = a.results[j], a.results[i] }
func (a *abstractResults) Less(i, j int) bool {
pkgA := a.results[i]
pkgB := a.results[j]
var cmpResult bool
switch a.sortBy {
case "name":
cmpResult = !text.LessRunes([]rune(pkgA.name), []rune(pkgB.name))
if a.separateSources {
cmpSources := strings.Compare(pkgA.source, pkgB.source)
if cmpSources != 0 {
cmpResult = cmpSources > 0
}
}
default:
simA := a.calculateMetric(&pkgA)
simB := a.calculateMetric(&pkgB)
cmpResult = simA > simB
}
if a.bottomUp {
cmpResult = !cmpResult
}
return cmpResult
}
func (s *SourceQueryBuilder) Execute(ctx context.Context, dbExecutor db.Executor, pkgS []string) {
var aurErr error
pkgS = RemoveInvalidTargets(s.logger, pkgS, s.targetMode)
metric := &metrics.Hamming{
CaseSensitive: false,
}
sortableResults := &abstractResults{
results: []abstractResult{},
search: strings.Join(pkgS, ""),
bottomUp: s.bottomUp,
metric: metric,
separateSources: s.separateSources,
sortBy: s.sortBy,
distanceCache: map[string]float64{},
separateSourceCache: map[string]float64{},
}
if s.targetMode.AtLeastAUR() {
var aurResults []aur.Pkg
aurResults, aurErr = queryAUR(ctx, s.aurClient, pkgS, s.searchBy)
dbName := sourceAUR
for i := range aurResults {
if s.queryMap[dbName] == nil {
s.queryMap[dbName] = map[string]interface{}{}
}
by := getSearchBy(s.searchBy)
if (by == aur.NameDesc || by == aur.None || by == aur.Name) &&
!matchesSearch(&aurResults[i], pkgS) {
continue
}
s.queryMap[dbName][aurResults[i].Name] = aurResults[i]
sortableResults.results = append(sortableResults.results, abstractResult{
source: dbName,
name: aurResults[i].Name,
description: aurResults[i].Description,
provides: aurResults[i].Provides,
votes: aurResults[i].NumVotes,
})
}
}
var repoResults []alpm.IPackage
if s.targetMode.AtLeastRepo() {
repoResults = dbExecutor.SyncPackages(pkgS...)
for i := range repoResults {
dbName := repoResults[i].DB().Name()
if s.queryMap[dbName] == nil {
s.queryMap[dbName] = map[string]interface{}{}
}
s.queryMap[dbName][repoResults[i].Name()] = repoResults[i]
rawProvides := repoResults[i].Provides().Slice()
provides := make([]string, len(rawProvides))
for j := range rawProvides {
provides[j] = rawProvides[j].Name
}
sortableResults.results = append(sortableResults.results, abstractResult{
source: repoResults[i].DB().Name(),
name: repoResults[i].Name(),
description: repoResults[i].Description(),
provides: provides,
votes: -1,
})
}
}
sort.Sort(sortableResults)
s.results = sortableResults.results
if aurErr != nil {
s.logger.Errorln(ErrAURSearch{inner: aurErr})
if len(repoResults) != 0 {
s.logger.Warnln(gotext.Get("Showing repo packages only"))
}
}
}
func (s *SourceQueryBuilder) Results(dbExecutor db.Executor, verboseSearch SearchVerbosity) error {
for i := range s.results {
if verboseSearch == Minimal {
s.logger.Println(s.results[i].name)
continue
}
var toPrint string
if verboseSearch == NumberMenu {
if s.bottomUp {
toPrint += text.Magenta(strconv.Itoa(len(s.results)-i)) + " "
} else {
toPrint += text.Magenta(strconv.Itoa(i+1)) + " "
}
}
pkg := s.queryMap[s.results[i].source][s.results[i].name]
switch pPkg := pkg.(type) {
case aur.Pkg:
toPrint += aurPkgSearchString(&pPkg, dbExecutor, s.singleLineResults)
case alpm.IPackage:
toPrint += syncPkgSearchString(pPkg, dbExecutor, s.singleLineResults)
}
s.logger.Println(toPrint)
}
return nil
}
func (s *SourceQueryBuilder) Len() int {
return len(s.results)
}
func (s *SourceQueryBuilder) GetTargets(include, exclude intrange.IntRanges,
otherExclude mapset.Set[string],
) ([]string, error) {
var (
isInclude = len(exclude) == 0 && otherExclude.Cardinality() == 0
targets []string
lenRes = len(s.results)
)
for i := 1; i <= s.Len(); i++ {
target := i - 1
if s.bottomUp {
target = lenRes - i
}
if (isInclude && include.Get(i)) || (!isInclude && !exclude.Get(i)) {
targets = append(targets, s.results[target].source+"/"+s.results[target].name)
}
}
return targets, nil
}
func matchesSearch(pkg *aur.Pkg, terms []string) bool {
if len(terms) <= 1 {
return true
}
for _, pkgN := range terms {
if strings.IndexFunc(pkgN, unicode.IsSymbol) != -1 {
return true
}
name := strings.ToLower(pkg.Name)
desc := strings.ToLower(pkg.Description)
targ := strings.ToLower(pkgN)
if !strings.Contains(name, targ) && !strings.Contains(desc, targ) {
return false
}
}
return true
}

View File

@ -0,0 +1,362 @@
//go:build !integration
// +build !integration
package query
import (
"context"
"io"
"strings"
"testing"
"github.com/Jguer/aur"
"github.com/Jguer/yay/v12/pkg/db/mock"
mockaur "github.com/Jguer/yay/v12/pkg/dep/mock"
"github.com/Jguer/yay/v12/pkg/settings/parser"
"github.com/Jguer/yay/v12/pkg/text"
"github.com/stretchr/testify/assert"
)
func TestSourceQueryBuilder(t *testing.T) {
t.Parallel()
type testCase struct {
desc string
search []string
bottomUp bool
separateSources bool
sortBy string
verbosity SearchVerbosity
targetMode parser.TargetMode
singleLineResults bool
searchBy string
wantResults []string
wantOutput []string
}
testCases := []testCase{
{
desc: "sort-by-votes bottomup separatesources",
search: []string{"linux"},
bottomUp: true,
separateSources: true,
sortBy: "votes",
verbosity: Detailed,
wantResults: []string{"linux-ck", "linux-zen", "linux"},
wantOutput: []string{
"\x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
},
},
{
desc: "sort-by-votes topdown separatesources",
search: []string{"linux"},
bottomUp: false,
separateSources: true,
sortBy: "votes",
verbosity: Detailed,
wantResults: []string{"linux", "linux-zen", "linux-ck"},
wantOutput: []string{
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
"\x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
},
},
{
desc: "sort-by-votes bottomup noseparatesources",
search: []string{"linux"},
bottomUp: true,
separateSources: false,
sortBy: "votes",
verbosity: Detailed,
wantResults: []string{"linux-zen", "linux-ck", "linux"},
wantOutput: []string{
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
"\x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
},
},
{
desc: "sort-by-votes topdown noseparatesources",
search: []string{"linux"},
bottomUp: false,
separateSources: false,
sortBy: "votes",
verbosity: Detailed,
wantResults: []string{"linux", "linux-ck", "linux-zen"},
wantOutput: []string{
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
"\x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
},
},
{
desc: "sort-by-name bottomup separatesources",
search: []string{"linux"},
bottomUp: true,
separateSources: true,
sortBy: "name",
verbosity: Detailed,
wantResults: []string{"linux-ck", "linux", "linux-zen"},
wantOutput: []string{
"\x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
},
},
{
desc: "sort-by-name topdown separatesources",
search: []string{"linux"},
bottomUp: false,
separateSources: true,
sortBy: "name",
verbosity: Detailed,
wantResults: []string{"linux-zen", "linux", "linux-ck"},
wantOutput: []string{
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
"\x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
},
},
{
desc: "sort-by-name bottomup noseparatesources",
search: []string{"linux"},
bottomUp: true,
separateSources: false,
sortBy: "name",
verbosity: Detailed,
wantResults: []string{"linux", "linux-ck", "linux-zen"},
wantOutput: []string{
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
"\x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
},
},
{
desc: "sort-by-name topdown noseparatesources",
search: []string{"linux"},
bottomUp: false,
separateSources: false,
sortBy: "name",
verbosity: Detailed,
wantResults: []string{"linux-zen", "linux-ck", "linux"},
wantOutput: []string{
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
"\x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
},
},
{
desc: "sort-by-votes bottomup separatesources number-menu",
search: []string{"linux"},
bottomUp: true,
separateSources: true,
sortBy: "votes",
verbosity: NumberMenu,
wantResults: []string{"linux-ck", "linux-zen", "linux"},
wantOutput: []string{
"\x1b[35m3\x1b[0m \x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
"\x1b[35m2\x1b[0m \x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
"\x1b[35m1\x1b[0m \x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
},
},
{
desc: "sort-by-votes topdown separatesources number-menu",
search: []string{"linux"},
bottomUp: false,
separateSources: true,
sortBy: "votes",
verbosity: NumberMenu,
wantResults: []string{"linux", "linux-zen", "linux-ck"},
wantOutput: []string{
"\x1b[35m1\x1b[0m \x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
"\x1b[35m2\x1b[0m \x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
"\x1b[35m3\x1b[0m \x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
},
},
{
desc: "sort-by-name bottomup separatesources number-menu",
search: []string{"linux"},
bottomUp: true,
separateSources: true,
sortBy: "name",
verbosity: NumberMenu,
wantResults: []string{"linux-ck", "linux", "linux-zen"},
wantOutput: []string{
"\x1b[35m3\x1b[0m \x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
"\x1b[35m2\x1b[0m \x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
"\x1b[35m1\x1b[0m \x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
},
},
{
desc: "sort-by-name topdown separatesources number-menu",
search: []string{"linux"},
bottomUp: false,
separateSources: true,
sortBy: "name",
verbosity: NumberMenu,
wantResults: []string{"linux-zen", "linux", "linux-ck"},
wantOutput: []string{
"\x1b[35m1\x1b[0m \x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux ZEN kernel and modules\n",
"\x1b[35m2\x1b[0m \x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\n The Linux kernel and modules\n",
"\x1b[35m3\x1b[0m \x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
},
},
{
desc: "sort-by-name bottomup noseparatesources minimal",
search: []string{"linux"},
bottomUp: true,
separateSources: false,
sortBy: "name",
verbosity: Minimal,
wantResults: []string{"linux", "linux-ck", "linux-zen"},
wantOutput: []string{
"linux\n",
"linux-ck\n",
"linux-zen\n",
},
},
{
desc: "only-aur minimal",
search: []string{"linux"},
bottomUp: true,
separateSources: true,
sortBy: "name",
verbosity: Minimal,
targetMode: parser.ModeAUR,
wantResults: []string{"linux-ck"},
wantOutput: []string{
"linux-ck\n",
},
},
{
desc: "only-repo minimal",
search: []string{"linux"},
bottomUp: true,
separateSources: true,
sortBy: "name",
verbosity: Minimal,
targetMode: parser.ModeRepo,
wantResults: []string{"linux", "linux-zen"},
wantOutput: []string{
"linux\n",
"linux-zen\n",
},
},
{
desc: "sort-by-name singleline",
search: []string{"linux"},
bottomUp: true,
separateSources: true,
sortBy: "name",
verbosity: Detailed,
singleLineResults: true,
wantResults: []string{"linux-ck", "linux", "linux-zen"},
wantOutput: []string{
"\x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\tThe Linux-ck kernel and modules with ck's hrtimer patches\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\tThe Linux kernel and modules\n",
"\x1b[1m\x1b[33mcore\x1b[0m\x1b[0m/\x1b[1mlinux-zen\x1b[0m \x1b[36m5.16.0\x1b[0m\x1b[1m (1.0 B 1.0 B) \x1b[0m\tThe Linux ZEN kernel and modules\n",
},
},
{
desc: "sort-by-name search-by-name",
search: []string{"linux-ck"},
bottomUp: true,
separateSources: true,
sortBy: "name",
verbosity: Detailed,
searchBy: "name",
targetMode: parser.ModeAUR,
wantResults: []string{"linux-ck"},
wantOutput: []string{
"\x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
},
},
{
desc: "only-aur search-by-several-terms",
search: []string{"linux-ck", "hrtimer"},
bottomUp: true,
separateSources: true,
verbosity: Detailed,
targetMode: parser.ModeAUR,
wantResults: []string{"linux-ck"},
wantOutput: []string{
"\x1b[1m\x1b[34maur\x1b[0m\x1b[0m/\x1b[1mlinux-ck\x1b[0m \x1b[36m5.16.12-1\x1b[0m\x1b[1m (+450\x1b[0m \x1b[1m1.51) \x1b[0m\n The Linux-ck kernel and modules with ck's hrtimer patches\n",
},
},
}
mockDB := &mock.DBExecutor{
SyncPackagesFn: func(pkgs ...string) []mock.IPackage {
mockDB := mock.NewDB("core")
return []mock.IPackage{
&mock.Package{
PName: "linux",
PVersion: "5.16.0",
PDescription: "The Linux kernel and modules",
PSize: 1,
PISize: 1,
PDB: mockDB,
},
&mock.Package{
PName: "linux-zen",
PVersion: "5.16.0",
PDescription: "The Linux ZEN kernel and modules",
PSize: 1,
PISize: 1,
PDB: mockDB,
},
}
},
LocalPackageFn: func(string) mock.IPackage {
return nil
},
}
mockAUR := &mockaur.MockAUR{
GetFn: func(ctx context.Context, query *aur.Query) ([]aur.Pkg, error) {
return []aur.Pkg{
{
Description: "The Linux-ck kernel and modules with ck's hrtimer patches",
FirstSubmitted: 1311346274,
ID: 1045311,
LastModified: 1646250901,
Maintainer: "graysky",
Name: "linux-ck",
NumVotes: 450,
OutOfDate: 0,
PackageBase: "linux-ck",
PackageBaseID: 50911,
Popularity: 1.511141,
URL: "https://wiki.archlinux.org/index.php/Linux-ck",
URLPath: "/cgit/aur.git/snapshot/linux-ck.tar.gz",
Version: "5.16.12-1",
},
}, nil
},
}
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
w := &strings.Builder{}
queryBuilder := NewSourceQueryBuilder(mockAUR,
text.NewLogger(w, io.Discard, strings.NewReader(""), false, "test"),
tc.sortBy, tc.targetMode, tc.searchBy, tc.bottomUp,
tc.singleLineResults, tc.separateSources)
queryBuilder.Execute(context.Background(), mockDB, tc.search)
assert.Len(t, queryBuilder.results, len(tc.wantResults))
assert.Equal(t, len(tc.wantResults), queryBuilder.Len())
for i, name := range tc.wantResults {
assert.Equal(t, name, queryBuilder.results[i].name)
}
queryBuilder.Results(mockDB, tc.verbosity)
assert.Equal(t, strings.Join(tc.wantOutput, ""), w.String())
})
}
}

34
pkg/query/source.go Normal file
View File

@ -0,0 +1,34 @@
package query
import (
"context"
"github.com/Jguer/aur"
"github.com/hashicorp/go-multierror"
)
// queryAUR searches AUR and narrows based on subarguments.
func queryAUR(ctx context.Context,
aurClient aur.QueryClient,
pkgS []string, searchBy string,
) ([]aur.Pkg, error) {
var (
err error
by = getSearchBy(searchBy)
)
for _, word := range pkgS {
r, errM := aurClient.Get(ctx, &aur.Query{
Needles: []string{word},
By: by,
Contains: true,
})
if errM == nil {
return r, nil
}
err = multierror.Append(err, errM)
}
return nil, err
}

Some files were not shown because too many files have changed in this diff Show More