#2950 kojira: Do not ever clean up repositories where 'latest' points to
Merged 9 months ago by tkopecek. Opened 10 months ago by ignatenkobrain.
ignatenkobrain/koji dist-clean  into  master

file modified
+13 -2
@@ -661,9 +661,17 @@ 

              if not os.path.isdir(tagdir):

                  self.logger.debug("%s is not a directory, skipping", tagdir)



+             # Remember where latest symlink points to (if exists)

+             repo_latest_path = "%s/latest" % tagdir

+             repo_latest_id = (

+                 os.readlink(repo_latest_path)

+                 if os.path.isdir(repo_latest_path)

+                 else None

+             )

              for repo_id in os.listdir(tagdir):

-                 if repo_id == 'latest':

-                     # ignore latest symlinks

+                 if repo_id == 'latest' or repo_id == repo_latest_id:

+                     # ignore latest symlinks or repo where one points to



                      repo_id = int(repo_id)
@@ -931,6 +939,9 @@ 

              if tag_id not in build_tags and tag_id not in ignored_build_tags:

                  # repos for these tags are no longer required

                  for repo in repolist:

+                     if repo.dist:

+                         # Dist repos should expire only basd on the time

+                         continue

                      if repo.ready():



We don't want to leave symlink broken… Ideally we would find out stuff
where we should even remove "latest" but it is not straightforward and I
believe this simple check is good enough for the time being.

Fixes: https://pagure.io/koji/issue/2832
Signed-off-by: Igor Raits igor.raits@gmail.com

Just flake8 is failin on too-long line. Otherwise :thumbsup:

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

10 months ago

rebased onto 611c132b3659710401b234f26b6fd970339c308b

10 months ago

Metadata Update from @tkopecek:
- Pull-request untagged with: testing-ready

10 months ago

Hmm, found some problems with this. If that tag is "build" or "ignored" tag it will work. Otherwise there is other part of code which will delete it in another thread. It makes sense to me to skip distrepos there. They should expire only based on time.


@tkopecek let me add there some if

rebased onto 4f59d31

10 months ago

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

10 months ago

Nothing :-) It is waiting for QE recheck and then I'll merge it. Will be part of next release (1.26).

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

9 months ago

Commit 6ec2a17 fixes this pull-request

Pull-Request has been merged by tkopecek

9 months ago