Duplicated code in PackitAPI.run_copr_build() & packit-service/copr_build.py
See original GitHub issueWith 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 callPackitAPI.create_srpm()
, but accepts srpm path (so the caller has to callcreate_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 fromPackitAPI.run_copr_build()
to separate method which thenPackitAPI.run_copr_build()
and theCoprBuildJobHelper.run_build()
could call.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
This seems to be the cleanest option.
Could we have
PackitAPI.run_build(srpm_path)
and deprecaterun_copr_build()
sometime in the future? Is the build service configurable in Packit?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 callPackitAPI.run_copr_build()
fromCoprBuildJobHelper.run_build()
now. As a reporter I’m closing this explicitly.