Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only show the latest version in the Arch index #33262

Merged
merged 29 commits into from
Feb 13, 2025

Conversation

ExplodingDragon
Copy link
Contributor

@ExplodingDragon ExplodingDragon commented Jan 14, 2025

Only show the latest version of the package in the arch repo.

closes #33534

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 14, 2025
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 14, 2025
@github-actions github-actions bot added modifies/go Pull requests that update Go code docs-update-needed The document needs to be updated synchronously labels Jan 14, 2025
@ExplodingDragon ExplodingDragon changed the title Feat(package): Keep only the latest version in Arch DB WIP: Keep only the latest version in Arch DB Jan 14, 2025
@ExplodingDragon ExplodingDragon changed the title WIP: Keep only the latest version in Arch DB Keep only the latest version in Arch Repo Jan 15, 2025
@ExplodingDragon ExplodingDragon marked this pull request as ready for review January 15, 2025 07:30
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 20, 2025
@wxiaoguang
Copy link
Contributor

Actually I have some questions about the design.

  • KEEP_LATEST_VERSION sounds like "only keep the package with latest version, and delete others"
  • After reading code, I think it means that "only show the package with latest version in the package index"

So the questions are:

  • Should we delete the old packages? Or not delete, just hide them from the index (this PR does)?
  • Could it ("deleting old packages" or "not-deleting but just hide old packages from index") be a general behavior for other package registries?
  • The config name sounds misleading: I think it should clarify what's the expected result in the name: deleting, or just hiding.

@ExplodingDragon ExplodingDragon changed the title Keep only the latest version in Arch Repo Only show the latest version in the Arch index Jan 21, 2025
@ExplodingDragon
Copy link
Contributor Author

Actually I have some questions about the design.

* `KEEP_LATEST_VERSION` sounds like "only keep the package with latest version, and delete others"

* After reading code, I think it means that "only show the package with latest version in the package index"

So the questions are:

* Should we delete the old packages? Or not delete, just hide them from the index (this PR does)?

* Could it ("deleting old packages" or "not-deleting but just hide old packages from index") be a general behavior for other package registries?

* The config name sounds misleading: I think it should clarify what's the expected result in the name: deleting, or just hiding.

@wxiaoguang Sorry, I misspoke. KEEP_LATEST_VERSION will change to SHOW_LATEST_VERSION.

@wxiaoguang
Copy link
Contributor

Are there some reference documents for the "only show latest version in index" behavior? (The question is why it is needed to be done on server side, since client could always figure out the latest version)

@ExplodingDragon
Copy link
Contributor Author

ExplodingDragon commented Jan 21, 2025

Are there some reference documents for the "only show latest version in index" behavior? (The question is why it is needed to be done on server side, since client could always figure out the latest version)

@wxiaoguang No, this comes from my subjective opinion. Having too many packages will make the index larger, and most of the time, there isn't much demand for downloading older versions of software packages. Other package registries are facing the same situation.

Just like Arch Linux's rolling release model, which only keeps the latest version.

@GiteaBot GiteaBot added the lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. label Feb 10, 2025
@wxiaoguang
Copy link
Contributor

@KN4CK3R do you have more suggestions for this change?

@lunny lunny added the backport/v1.23 This PR should be backported to Gitea 1.23 label Feb 10, 2025
@KN4CK3R
Copy link
Member

KN4CK3R commented Feb 10, 2025

services/packages/arch/vercmp.go

Not sure this is required. Just using the last uploaded package should be good (order by time of upload). This would also allow to revert back to older version by deleting and re-uploading old version.

I would go with that easy approach too because it will cover most (but sure, not all) use cases. To get the latest package version the SearchLatestVersions function can be used. But if you insist to replicate the full version comparison I will not block it.

@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 10, 2025
@wxiaoguang wxiaoguang marked this pull request as draft February 10, 2025 20:00
@wxiaoguang wxiaoguang removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 10, 2025
@wxiaoguang
Copy link
Contributor

To get the latest package version the SearchLatestVersions function can be used. But if you insist to replicate the full version comparison I will not block it.

@ExplodingDragon what do you think about it? Keep the current approach, or use SearchLatestVersions? If it replicates the version comparison, could there be some more comments about why not using SearchLatestVersions?

@ExplodingDragon
Copy link
Contributor Author

ExplodingDragon commented Feb 11, 2025

what do you think about it? Keep the current approach, or use SearchLatestVersions?

@wxiaoguang I still believe that comparing the complete versions makes more sense.

Simply using the last uploaded version goes against intuition. Reverting to a previous version should involve deleting the new version, rather than uploading the old version to overwrite the index of the new one.

Just like Arch Wiki Downgrading packages said, randomly downgrading can mess up dependencies:

If a downgrade involves a soname change, all dependencies may need downgrading or rebuilding too.


Downgrading is a risky move and shouldn't be taken lightly or handled in a simplistic manner.

@wxiaoguang wxiaoguang marked this pull request as ready for review February 11, 2025 10:41
@KN4CK3R
Copy link
Member

KN4CK3R commented Feb 11, 2025

Simply using the last uploaded version goes against intuition. Reverting to a previous version should involve deleting the new version, rather than uploading the old version to overwrite the index of the new one.

That's not intended. As you said, you delete the new version which makes the previous version the newest. You don't upload an old version. Then the index contains the previous version again (which is now the new version). Therefore it's still not needed to parse every version to compare them.

@wxiaoguang wxiaoguang enabled auto-merge (squash) February 12, 2025 08:54
@wxiaoguang wxiaoguang merged commit fba365b into go-gitea:main Feb 13, 2025
26 checks passed
@ExplodingDragon ExplodingDragon deleted the feat-version-arch branch February 13, 2025 01:43
zjjhot added a commit to zjjhot/gitea that referenced this pull request Feb 13, 2025
* giteaofficial/main:
  Only show the latest version in the Arch index (go-gitea#33262)
  [skip ci] Updated translations via Crowdin
  Enable eslint for commonjs (go-gitea#33575)
  Fix various problems (artifact order, api empty slice, assignee check, fuzzy prompt, mirror proxy, adopt git) (go-gitea#33569)
  Switch to `@vitest/eslint-plugin` (go-gitea#33573)
  Avoid duplicate SetContextValue call (go-gitea#33564)
GiteaBot added a commit to GiteaBot/gitea that referenced this pull request Feb 13, 2025
Only show the latest version of the package in the arch repo.

closes go-gitea#33534

---------

Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Feb 13, 2025
wxiaoguang added a commit that referenced this pull request Feb 13, 2025
Backport #33262 by ExplodingDragon

Only show the latest version of the package in the arch repo.

closes #33534

Co-authored-by: Exploding Dragon <explodingfkl@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/done All backports for this PR have been created backport/v1.23 This PR should be backported to Gitea 1.23 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arch package registry: client error when two versions of a package are present
7 participants