#1146 frontend: revert wrong optimization in createrepo
Merged 4 years ago by praiskup. Opened 4 years ago by praiskup.
Unknown source fix-frontend-createrepo  into  master

@@ -70,21 +70,17 @@

          db.session.add(action)

  

      @classmethod

-     def send_createrepo(cls, copr, dirnames=None, main_only=True):

-         possible_dirnames = [copr_dir.name for copr_dir in copr.dirs

-                              if not main_only or copr_dir.main]

- 

+     def send_createrepo(cls, copr, dirnames=None):

+         possible_dirnames = [copr_dir.name for copr_dir in copr.dirs]

          if not dirnames:

              # by default we createrepo for all of them

              dirnames = possible_dirnames

          else:

              missing = set(dirnames) - set(possible_dirnames)

              if missing:

-                 # TODO: we should raise NotFoundException here

-                 #raise exceptions.NotFoundException(

-                 #    "Can't createrepo for {} in {}".format(

-                 #        missing, copr.full_name))

-                 pass

+                 raise exceptions.NotFoundException(

+                     "Can't createrepo for {} dirnames in {} project".format(

+                         missing, copr.full_name))

          data_dict = {

              "ownername": copr.owner_name,

              "projectname": copr.name,

@@ -526,7 +526,7 @@

          copr_dir = models.CoprDir(

              name=dirname, copr=copr, main=main)

  

-         ActionsLogic.send_createrepo(copr, dirnames=[dirname], main_only=False)

+         ActionsLogic.send_createrepo(copr, dirnames=[dirname])

  

          db.session.add(copr_dir)

          return copr_dir
@@ -701,15 +701,15 @@

          current_chroots = copr.mock_chroots

          new_chroots = cls.mock_chroots_from_names(names)

          # add non-existing

-         run_createrepo = []

+         run_createrepo = False

          for mock_chroot in new_chroots:

              if mock_chroot not in current_chroots:

                  db.session.add(

                      models.CoprChroot(copr=copr, mock_chroot=mock_chroot))

-                 run_createrepo.append(mock_chroot.name)

+                 run_createrepo = True

  

          if run_createrepo:

-             ActionsLogic.send_createrepo(copr, dirnames=run_createrepo)

+             ActionsLogic.send_createrepo(copr)

  

          # delete no more present

          to_remove = []

Remove the mistake in requesting dirnames named like chroot names. We
indeed need to run createrepo for all changes in CoprChroot's,

rebased onto 3d05c55a6fdddba42eb44c5db6da72d5868f67a0

4 years ago

I plan to merge this right after first LGTM, and create micro release with this.

rebased onto 4dcc1e9

4 years ago

Commit 99e008b fixes this pull-request

Pull-Request has been merged by praiskup

4 years ago

Thanks for the review!