Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix removing some packages will result dirty data#34709

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
lunny wants to merge1 commit intogo-gitea:main
base:main
Choose a base branch
Loading
fromlunny:lunny/fix_remove_package

Conversation

lunny
Copy link
Member

Fix#32830

Inspired by#22810 and replace it.

When deleting alphe, cargo, debian, rpm packages, some extra actions should be taken which was missed. It will result in dirty data and inconsistent. This PR fix it. To avoid recycle dependencies, this is a quick patch. Like#22810 (comment) said, this might need a new design for such more packages types.

@GiteaBotGiteaBot added the lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelJun 12, 2025
@lunnylunny added type/bug backport/v1.24This PR should be backported to Gitea 1.24 and removed lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelsJun 12, 2025
@github-actionsgithub-actionsbot added lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. modifies/apiThis PR adds API routes or modifies them modifies/goPull requests that update Go code and removed type/bug backport/v1.24This PR should be backported to Gitea 1.24 labelsJun 12, 2025
@lunnylunny added type/bug backport/v1.24This PR should be backported to Gitea 1.24 labelsJun 12, 2025
@lunnylunny requested a review fromKN4CK3RJune 13, 2025 06:32
@KN4CK3R
Copy link
Member

I don't think this is cleaner than my PR. With this change some package types must call the remove method from the router, other types must call the remove method from the service.

@lunny
Copy link
MemberAuthor

lunny commentedJun 18, 2025
edited
Loading

I don't think this is cleaner than my PR. With this change some package types must call the remove method from the router, other types must call the remove method from the service.

Your implementation will still have a chance to fail with dirty data. Thealpine_service.BuildAllRepositoryFiles(ctx, pd.Owner.ID) should be invoked in the same transaction insideRemovePackageVersion and the notification should not be invoked before all cleanup succeed. Currently, only routers invoke these functions, a new service package could be introduced if it will be invoked from command or other packages. As a quick patch, I think it's enough.

@@ -144,7 +145,7 @@ func UploadPackage(ctx *context.Context) {

// DeletePackage deletes the specific generic package.
func DeletePackage(ctx *context.Context) {
err :=packages_service.RemovePackageVersionByNameAndVersion(
err :=common.RemovePackageVersionByNameAndVersion(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why thecommon is in "routers" package but not "services"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If you need to resolve the dependency problem, it should be something likeservices/packagemanager to manage all packages.

@@ -393,7 +394,7 @@ func DeletePackage(ctx *context.Context) {
}

for _, pv := range pvs {
if err :=packages_service.RemovePackageVersion(ctx, ctx.Doer, pv); err != nil {
if err :=common.RemovePackageVersion(ctx, ctx.Doer, pv); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It callsRemovePackageVersion mutiple times and "build" again and again. It doesn't seem right.

It should introduce a final step to rebuild when the removal finishes.

lunny reacted with thumbs up emoji
@wxiaoguangwxiaoguang removed the backport/v1.24This PR should be backported to Gitea 1.24 labelJun 21, 2025
@wxiaoguang
Copy link
Contributor

Don't backport since the design still has problems and no test.

@lunnylunny marked this pull request as draftJune 21, 2025 16:54
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@wxiaoguangwxiaoguangwxiaoguang left review comments

@KN4CK3RKN4CK3RAwaiting requested review from KN4CK3R

Assignees
No one assigned
Labels
lgtm/need 2This PR needs two approvals by maintainers to be considered for merging.modifies/apiThis PR adds API routes or modifies themmodifies/goPull requests that update Go codetype/bug
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Deleting a debian package does not remove it from the apt Packages list that clients see
4 participants
@lunny@KN4CK3R@wxiaoguang@GiteaBot

[8]ページ先頭

©2009-2025 Movatter.jp