question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicated code in PackitAPI.run_copr_build() & packit-service/copr_build.py

See original GitHub issue

With https://github.com/packit-service/packit-service/pull/547 we duplicate PackitAPI.run_copr_build() content also in packit_service’s CoprBuildJobHelper.run_build(). The reason is that the method in PackitAPI builds SRPM as a first thing (which we don’t want to do in CoprBuildJobHelper.run_build()).

Can we either?:

  • Change PackitAPI.run_copr_build() so that it does not call PackitAPI.create_srpm(), but accepts srpm path (so the caller has to call create_srpm() themselves first). I know this changes the API (hey, is there any other API consumer besides us?), but what about taking it as an opportunity to release packit 1.0.0? 😃
  • Move all but the PackitAPI.create_srpm() call from PackitAPI.run_copr_build() to separate method which then PackitAPI.run_copr_build() and the CoprBuildJobHelper.run_build() could call.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
csomhcommented, May 19, 2020

I think we discussed something similar during the arch-meetings, but that might have been about splitting the task in Packit Service to SRPM build and build.

In any case, I’m for looking into something like this.

  • Change PackitAPI.run_copr_build() so that it does not call PackitAPI.create_srpm(), but accepts srpm path (so the caller has to call create_srpm() themselves first). I know this changes the API (hey, is there any other API consumer besides us?), but what about taking it as an opportunity to release packit 1.0.0? 😃

This seems to be the cleanest option.

Could we have PackitAPI.run_build(srpm_path) and deprecate run_copr_build() sometime in the future? Is the build service configurable in Packit?

0reactions
jpopelkacommented, Nov 27, 2020

I’ve been looking at this (aiming to implement https://github.com/packit/packit/issues/831#issuecomment-631011749) and the CoprBuildJobHelper.run_build() now does much more than just srpm build + PackitAPI.run_copr_build(). There’s lots of try: except: and I don’t see how to call PackitAPI.run_copr_build() from CoprBuildJobHelper.run_build() now. As a reporter I’m closing this explicitly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate Code - Refactoring.Guru
If the duplicate code is inside a constructor, use Pull Up Constructor Body. If the duplicate code is similar but not completely identical,...
Read more >
python - Which is worse - duplicated code or double try/except?
Is there a third option I haven't spotted that is better? Or is the duplicate code method better? Please note that the rollback()...
Read more >
Analyze duplicates | PyCharm Documentation - JetBrains
Detect duplicates on the fly. PyCharm enables spotting duplicates on the fly. The analysis is performed by means of the Duplicated code ......
Read more >
Duplicate code - Wikipedia
In computer programming, duplicate code is a sequence of source code that occurs more than once, either within a program or across different...
Read more >
platisd/duplicate-code-detection-tool - GitHub
How? The tool uses the gensim Python library to determine the similarity between source code files, supplied by the user. The default supported...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found