Sergey Bugaev
ae6fb9199f
Propagate install_if and provider_priority to APKINDEX ( #28899 )
...
Resolves https://github.com/go-gitea/gitea/issues/28704
Example of an entry in the generated `APKINDEX` file:
```
C:Q1xCO3H9LTTEbhKt9G1alSC87I56c=
P:hello
V:2.12-r1
A:x86_64
T:The GNU Hello program produces a familiar, friendly greeting
U:https://www.gnu.org/software/hello/
L:GPL-3.0-or-later
S:15403
I:36864
o:hello
m:
t:1705934118
D:so:libc.musl-x86_64.so.1
p:cmd:hello=2.12-r1
i:foobar=1.0 !baz
k:42
```
the `i:` and `k:` entries are new.
---------
Co-authored-by: KN4CK3R <admin@oldschoolhack.me >
2024-02-05 05:52:56 +00:00
KN4CK3R
80d5e51e5f
Use new RPM constants ( #28931 )
...
https://github.com/sassoftware/go-rpmutils/pull/24 got merged.
2024-01-25 21:40:24 +00:00
KN4CK3R
cb3ba6de2d
Fix some RPM registry flaws ( #28782 )
...
Related #26984
(https://github.com/go-gitea/gitea/pull/26984#issuecomment-1889588912 )
Fix admin cleanup message.
Fix models `Get` not respecting default values.
Rebuild RPM repository files after cleanup.
Do not add RPM group to package version name.
Force stable sorting of Alpine/Debian/RPM repository data.
Fix missing deferred `Close`.
Add tests for multiple RPM groups.
Removed non-cached `ReplaceAllStringRegex`.
If there are multiple groups available, it's stated in the package
installation screen:

2024-01-19 11:37:10 +00:00
Exploding Dragon
b6af12387a
Support for grouping RPMs using paths ( #26984 )
...
The current rpm repository places all packages in the same repository,
and different systems (el7,f34) may hit packages that do not belong to
this distribution ( #25304 ) , which now supports grouping of rpm.

Fixes #25304 .
Fixes #27056 .
Refactor: [#25866 ](https://github.com/go-gitea/gitea/pull/25866 )
2024-01-12 03:16:05 +00:00
KN4CK3R
35f67f49b2
Close all hashed buffers ( #27787 )
...
Add missing `.Close()` calls. The current code does not delete the
temporary files if the data grows over 32mb.
2023-10-25 21:24:24 +02:00
Lunny Xiao
a604698ef4
Use docs.gitea.com instead of docs.gitea.io ( #26739 )
2023-08-27 11:59:12 +00:00
TimberBro
ebeb15f235
Fix NPM packages name validation ( #26595 )
...
- Added new tests to cover corner cases
- Replace existing regex with new one
Closes #26551
---
As @silverwind suggested, I started from
[validate-npm-package-name](https://github.com/npm/validate-npm-package-name ),
but found this solution too complicated.
Then I tried to fix existing regex myself, but thought, that exclude all
restricted symbols is harder, than set only allowed symbols.
Then I search a bit more and found
[package-name-regex](https://github.com/dword-design/package-name-regex )
and regex from it works for all new test cases.
Let me know, if more information or help with this PR is needed.
2023-08-20 15:06:42 +00:00
KN4CK3R
3ca046733f
Prevent newline errors with Debian packages ( #26332 )
...
Fixes #26313
2023-08-05 10:59:52 +02:00
KN4CK3R
a0cf23fae5
Fix typo in metadata ( #26207 )
...
https://github.com/go-gitea/gitea/pull/26194#discussion_r1277094525
There is no need to backport because these names are just used internal.
2023-07-30 23:54:22 +00:00
KN4CK3R
f3cb144fd1
Fix handling of Debian files with trailing slash ( #26087 )
...
Fixes #26022
- Fix handling of files with trailing slash
- Fix handling of duplicate package file errors
- Added test for both
2023-07-24 16:19:44 +02:00
KN4CK3R
51c6d33ac9
Add support for different Maven POM encoding ( #25873 )
...
Fixes #25853
- Maven POM files aren't always UTF-8 encoded.
- Reject the upload of unparsable POM files
2023-07-14 09:39:15 +00:00
silverwind
01d3d331e1
Replace interface{} with any ( #25686 )
...
Result of running `perl -p -i -e 's#interface\{\}#any#g' **/*` and `make fmt`.
Basically the same [as golang did](2580d0e08d ).
2023-07-04 18:36:08 +00:00
KN4CK3R
e243cf25b4
Add direct serving of package content ( #25543 )
...
Fixes #24723
Direct serving of content aka HTTP redirect is not mentioned in any of
the package registry specs but lots of official registries do that so it
should be supported by the usual clients.
2023-07-03 15:33:28 +02:00
KN4CK3R
61008870a9
Add CRAN package registry ( #22331 )
...
This PR adds a [CRAN](https://cran.r-project.org/ ) package registry.

2023-05-22 10:57:49 +08:00
KN4CK3R
3935ff393a
Add Go package registry ( #24687 )
...
Fixes #7608
This PR adds a Go package registry usable with the Go proxy protocol.

2023-05-14 23:38:40 +08:00
KN4CK3R
aaa9fed845
Add Alpine package registry ( #23714 )
...
This PR adds an Alpine package registry. You can follow [this
tutorial](https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package )
to build a *.apk package for testing.
This functionality is similar to the Debian registry (#22854 ) and
therefore shares some methods. I marked this PR as blocked because it
should be merged after #22854 .

---------
Co-authored-by: techknowlogick <techknowlogick@gitea.io >
Co-authored-by: silverwind <me@silverwind.io >
Co-authored-by: Giteabot <teabot@gitea.io >
2023-05-12 17:27:50 +00:00
KN4CK3R
272efb6f84
Add RPM registry ( #23380 )
...
Fixes #20751
This PR adds a RPM package registry. You can follow [this
tutorial](https://opensource.com/article/18/9/how-build-rpm-packages ) to
build a *.rpm package for testing.
This functionality is similar to the Debian registry (#22854 ) and
therefore shares some methods. I marked this PR as blocked because it
should be merged after #22854 .

2023-05-05 20:33:37 +00:00
KN4CK3R
ae5b28834b
Add Debian package registry ( #24426 )
...
Co-authored-by: @awkwardbunny
This PR adds a Debian package registry.
You can follow [this
tutorial](https://www.baeldung.com/linux/create-debian-package ) to build
a *.deb package for testing.
Source packages are not supported at the moment and I did not find
documentation of the architecture "all" and how these packages should be
treated.

Part of #20751 .
Revised copy of #22854 .
---------
Co-authored-by: Brian Hong <brian@hongs.me >
Co-authored-by: techknowlogick <techknowlogick@gitea.io >
Co-authored-by: Giteabot <teabot@gitea.io >
2023-05-02 12:31:35 -04:00
Yarden Shoham
f38e98a1fa
Revert "Add Debian package registry" ( #24412 )
...
Reverts go-gitea/gitea#22854
2023-04-28 18:06:41 -04:00
KN4CK3R
d840fa60ab
Add Debian package registry ( #22854 )
...
Co-authored-by: @awkwardbunny
This PR adds a Debian package registry. You can follow [this
tutorial](https://www.baeldung.com/linux/create-debian-package ) to build
a *.deb package for testing. Source packages are not supported at the
moment and I did not find documentation of the architecture "all" and
how these packages should be treated.
---------
Co-authored-by: Brian Hong <brian@hongs.me >
Co-authored-by: techknowlogick <techknowlogick@gitea.io >
2023-04-28 17:51:36 -04:00
KN4CK3R
67059a8659
Use more specific test methods ( #24265 )
...
Co-authored-by: silverwind <me@silverwind.io >
Co-authored-by: Giteabot <teabot@gitea.io >
2023-04-22 17:56:27 -04:00
KN4CK3R
5b6ab51d5f
Display image size for multiarch container images ( #23821 )
...
Fixes #23771
Changes the display of different architectures for multiarch images to
show the image size:

2023-04-02 17:53:37 +08:00
Zettat123
8a412d7b5d
Return repository in npm package metadata endpoint ( #23539 )
...
Close #23444
Add `Repository` to npm package `Metadata` struct so the `repository` in
`package.json` can be stored and be returned in the endpoint.
Co-authored-by: KN4CK3R <admin@oldschoolhack.me >
2023-03-17 14:39:19 -04:00
KN4CK3R
f0ec5b94c6
Add Swift package registry ( #22404 )
...
This PR adds a [Swift](https://www.swift.org/ ) package registry.

2023-03-13 15:28:39 -05:00
KN4CK3R
714716e055
Use import of OCI structs ( #22765 )
...
Fixes #22758
Otherwise we would need to rewrite the structs in `oci.go`.
2023-02-06 10:07:09 +00:00
KN4CK3R
423acc5d4c
Add Chef package registry ( #22554 )
...
This PR implements a [Chef registry](https://chef.io/ ) to manage
cookbooks. This package type was a bit complicated because Chef uses RSA
signed requests as authentication with the registry.


Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
2023-02-06 09:49:21 +08:00
KN4CK3R
2f3b65ac09
Add Cargo package registry ( #21888 )
...
This PR implements a [Cargo registry](https://doc.rust-lang.org/cargo/ )
to manage Rust packages. This package type was a little bit more
complicated because Cargo needs an additional Git repository to store
its package index.
Screenshots:



---------
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
2023-02-05 18:12:31 +08:00
KN4CK3R
cdacd3519b
Add Conda package registry ( #22262 )
...
This PR adds a [Conda](https://conda.io/ ) package registry.
2023-02-01 12:30:39 -06:00
KN4CK3R
cef704bee3
Use ErrInvalidArgument in packages ( #22268 )
...
Related to
https://github.com/go-gitea/gitea/pull/22262#discussion_r1059010774
Signed-off-by: Andrew Thornton <art27@cantab.net >
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
Co-authored-by: zeripath <art27@cantab.net >
Co-authored-by: Lauris BH <lauris@nix.lv >
2022-12-31 12:49:37 +01:00
KN4CK3R
7f12a7d9eb
Normalize NuGet package version on upload ( #22186 )
...
Fixes #22178
After this change upload versions with different semver metadata are
treated as the same version and trigger a duplicated version error.
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
2022-12-20 22:20:23 -05:00
Jason Song
da5ad6b708
Replace fmt.Sprintf with hex.EncodeToString ( #21960 )
...
`hex.EncodeToString` has better performance than `fmt.Sprintf("%x",
[]byte)`, we should use it as much as possible.
I'm not an extreme fan of performance, so I think there are some
exceptions:
- `fmt.Sprintf("%x", func(...)[N]byte())`
- We can't slice the function return value directly, and it's not worth
adding lines.
```diff
func A()[20]byte { ... }
- a := fmt.Sprintf("%x", A())
- a := hex.EncodeToString(A()[:]) // invalid
+ tmp := A()
+ a := hex.EncodeToString(tmp[:])
```
- `fmt.Sprintf("%X", []byte)`
- `strings.ToUpper(hex.EncodeToString(bytes))` has even worse
performance.
2022-11-28 11:19:18 +00:00
flynnnnnnnnnn
487cb6a411
Implement FSFE REUSE for golang files ( #21840 )
...
Change all license headers to comply with REUSE specification.
Fix #16132
Co-authored-by: flynnnnnnnnnn <flynnnnnnnnnn@github>
Co-authored-by: John Olheiser <john.olheiser@gmail.com >
2022-11-27 18:20:29 +00:00
KN4CK3R
920e9bea6c
Workaround for container registry push/pull errors ( #21862 )
...
This PR addresses #19586
I added a mutex to the upload version creation which will prevent the
push errors when two requests try to create these database entries. I'm
not sure if this should be the final solution for this problem.
I added a workaround to allow a reupload of missing blobs. Normally a
reupload is skipped because the database knows the blob is already
present. The workaround checks if the blob exists on the file system.
This should not be needed anymore with the above fix so I marked this
code to be removed with Gitea v1.20.
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
2022-11-25 13:47:46 +08:00
Jason Song
ccbf3f1d48
Replace yaml.v2 with yaml.v3 ( #21832 )
...
I don't see why we have to use two versions of yaml. The difference
between the two versions has nothing to do with our usage.
2022-11-21 16:36:59 +08:00
zeripath
9461ebdd8e
Adjust gitea doctor --run storages to check all storage types ( #21785 )
...
The doctor check `storages` currently only checks the attachment
storage. This PR adds some basic garbage collection functionality for
the other types of storage.
Signed-off-by: Andrew Thornton <art27@cantab.net >
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
2022-11-15 16:08:59 +08:00
delvh
c43098ab25
Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) ( #21551 )
...
Found using
`find . -type f -name '*.go' -print -exec vim {} -c
':%s/fmt\.Errorf(\(.*\)%v\(.*\)err/fmt.Errorf(\1%w\2err/g' -c ':wq' \;`
Co-authored-by: 6543 <6543@obermui.de >
Co-authored-by: Andrew Thornton <art27@cantab.net >
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
2022-10-24 20:29:17 +01:00
KN4CK3R
52eebdb5d4
Add support for Chocolatey/NuGet v2 API ( #21393 )
...
Fixes #21294
This PR adds support for NuGet v2 API.
Co-authored-by: Lauris BH <lauris@nix.lv >
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
2022-10-13 18:19:39 +08:00
eleith
e4abde20c1
npm package registry support for bin ( #21372 )
...
Fix #21303
npm package.json supports binary packaging:
https://docs.npmjs.com/cli/v8/configuring-npm/package-json#bin
the npm registry documents that the binary references will be attached
to the abbreviated version object:
https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#abbreviated-version-object
unfortunately their api documentation leaves this out:
https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#abbreviated-version-objectdoc
which is likely to be the reason this was left out in gitea's initial
implementation
this response is critical for npm to install the binary in the `.bin`
folder so as to be included on the users default bin path, resulting in
immediate access to any binaries provided by the package
2022-10-08 13:24:44 +08:00
KN4CK3R
6cf4446c4a
Fix empty container layer history and UI ( #21251 )
...
Fixes #21248
2022-09-27 15:03:24 +02:00
Jack Vine
7a4d8032e6
NPM Package Registry search API endpoint ( #20280 )
...
Close #20098 , in the NPM registry API, implemented to match what's described by https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search
Currently have only implemented the bare minimum to work with the [Unity Package Manager](https://docs.unity3d.com/Manual/upm-ui.html ).
Co-authored-by: Jack Vine <jackv@jack-lemur-suse.cat-prometheus.ts.net >
Co-authored-by: KN4CK3R <admin@oldschoolhack.me >
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
2022-09-24 19:24:33 +08:00
luzpaz
74e399fd2f
Fix various typos ( #21103 )
...
Found via `codespell -q 3 -S
./options/locale,./options/license,./public/vendor,./web_src/fomantic -L
actived,allways,attachements,ba,befores,commiter,pullrequest,pullrequests,readby,splitted,te,unknwon`
Co-authored-by: techknowlogick <techknowlogick@gitea.io >
2022-09-07 14:40:36 -04:00
KN4CK3R
6021c5d6b6
Add support for Vagrant packages ( #20930 )
...
* Add support for Vagrant boxes.
* Add authentication.
* Add tests.
* Add integration tests.
* Add docs.
* Add icons.
* Update routers/api/packages/api.go
Co-authored-by: Lauris BH <lauris@nix.lv >
Co-authored-by: 6543 <6543@obermui.de >
2022-08-29 15:04:45 +08:00
Lunny Xiao
f253cb2adc
Add migrate repo archiver and packages storage support on command line ( #20757 )
...
* Add migrate repo archiver and packages storage support on command line
* Fix typo
* Use stdCtx
* Use packageblob and fix command description
* Add migrate packages unit tests
* Fix comment year
* Fix the migrate storage command line description
* Update cmd/migrate_storage.go
Co-authored-by: zeripath <art27@cantab.net >
* Update cmd/migrate_storage.go
Co-authored-by: zeripath <art27@cantab.net >
* Update cmd/migrate_storage.go
Co-authored-by: zeripath <art27@cantab.net >
* Fix test
Co-authored-by: 6543 <6543@obermui.de >
Co-authored-by: zeripath <art27@cantab.net >
2022-08-16 12:05:15 +08:00
KN4CK3R
bacb6509c0
Add support for Pub packages ( #20560 )
...
* Added support for Pub packages.
* Update docs/content/doc/packages/overview.en-us.md
Co-authored-by: Gergely Nagy <algernon@users.noreply.github.com >
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
Co-authored-by: Gergely Nagy <algernon@users.noreply.github.com >
Co-authored-by: Lauris BH <lauris@nix.lv >
2022-08-07 18:09:54 +08:00
KN4CK3R
30f16f373c
Fix package upload for files >32mb ( #20622 )
...
* Rewind file before first read.
* Added tests.
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
2022-08-02 21:35:48 +08:00
KN4CK3R
8e45a82c3f
Add Docker /v2/_catalog endpoint ( #20469 )
...
* Added properties for packages.
* Fixed authenticate header format.
* Added _catalog endpoint.
* Check owner visibility.
* Extracted condition.
* Added test for _catalog.
Co-authored-by: 6543 <6543@obermui.de >
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
Co-authored-by: Lauris BH <lauris@nix.lv >
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
2022-07-28 11:59:39 +08:00
KN4CK3R
8ef7d15fa5
Fix Ruby package parsing by removed unused email field ( #20470 )
2022-07-25 02:52:14 +02:00
Gergely Nagy
97bc54602c
Allow non-semver packages in the Conan package registry ( #20412 )
...
A lot of existing packages do not conform to SemVer, yet, they should be allowed
in the Conan package registry as-is. To achieve this, remove the SemVer check
from `NewRecipeReference`, and replace it with a simple empty string check.
A unit test with a non-semver version is also included.
Fixes #20405 .
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu >
Co-authored-by: KN4CK3R <admin@oldschoolhack.me >
2022-07-22 22:54:02 +01:00
Wim
f481b601d6
Add more linters to improve code readability ( #19989 )
...
Add nakedret, unconvert, wastedassign, stylecheck and nolintlint linters to improve code readability
- nakedret - https://github.com/alexkohler/nakedret - nakedret is a Go static analysis tool to find naked returns in functions greater than a specified function length.
- unconvert - https://github.com/mdempsky/unconvert - Remove unnecessary type conversions
- wastedassign - https://github.com/sanposhiho/wastedassign - wastedassign finds wasted assignment statements.
- notlintlint - Reports ill-formed or insufficient nolint directives
- stylecheck - https://staticcheck.io/docs/checks/#ST - keep style consistent
- excluded: [ST1003 - Poorly chosen identifier](https://staticcheck.io/docs/checks/#ST1003 ) and [ST1005 - Incorrectly formatted error string](https://staticcheck.io/docs/checks/#ST1005 )
2022-06-20 12:02:49 +02:00
KN4CK3R
da5e38778a
Add Helm Chart registry ( #19406 )
2022-04-19 12:55:35 -04:00