#1300 rpmbulid: print human friendly error for nonexisting subdirectory
Merged 4 years ago by praiskup. Opened 4 years ago by frostyx.
copr/ frostyx/copr scm-wrong-subdir  into  master

@@ -118,6 +118,9 @@ 

              'tito_test': self.get_tito_test_command,

              'make_srpm': self.get_make_srpm_command,

          }[self.srpm_build_method]()

+         if not os.path.exists(self.repo_subpath):

+             raise RuntimeError("The user-defined SCM subdirectory `{}' doesn't exist within this repository {}"

+                                .format(self.repo_subdir, self.clone_url))

          return run_cmd(cmd, cwd=self.repo_subpath)

  

      def produce_sources(self):

Would you be against raising RuntimeError even for this? The
RuntimeError isn't the best choice tbh :-) per its python definition. We
should IMO have our own exception (or set of exceptions)... but being
consistent here will help us in future when we invent the new exception
mechanism.

Wording; can you make somehow clear that it is copr project configuration
problem, not some random internal one? E.g.
Subdirectory '{}' configured in package SCM web-UI doesn't exist in {}?
(... meh, I don't terribly like this wording either).

Also note this needs rebase.

rebased onto f138a7a9100f4c928cb9bf220bf84f110edeb3ea

4 years ago

Would you be against raising RuntimeError even for this?
Also note this needs rebase.

Ah, since you did 29e9679, using RuntimeError is the simplest thing ever. But yes, I agree that we should have custom exceptions in the future.

PTAL

I updated also the wording. I didn't particularly like "Subdirectory '{}' configured in package SCM web-UI doesn't exist in {}" either, because it implied that the build was submitted via web-UI (not CLI) and also that it was configured in a package (but it could be even one-time build).

Does it make sense now?

rebased onto d78149d

4 years ago

Pull-Request has been merged by praiskup

4 years ago