gh-action-sdk icon indicating copy to clipboard operation
gh-action-sdk copied to clipboard

Add FIXUP option, for automatic package hash.

Open cmangla opened this issue 1 year ago • 14 comments

Fixes #18 Fixes #35

cmangla avatar Sep 03 '24 10:09 cmangla

It seems FIXUP=1 needs to be set when PKG_MIRROR_HASH:=skip is set. See: https://openwrt.org/docs/guide-developer/packages#use_source_repository

cmangla avatar Sep 03 '24 10:09 cmangla

@aparcar Please do "Squash and merge" if the PR is good and whenever it is convenient for you. Thanks!

cmangla avatar Sep 03 '24 13:09 cmangla

This PR worked perfect, THANKS!!!

qwerttvv avatar Sep 04 '24 17:09 qwerttvv

I think when FIXUP=1, package should not compile, or there can have another option to enable fixup-only action

EkkoG avatar Oct 29 '24 03:10 EkkoG

I don't understand the motivation for this PR. Could you please explain and add it to the commit message?

aparcar avatar Oct 29 '24 09:10 aparcar

I don't understand the motivation for this PR. Could you please explain and add it to the commit message?

Let me run the motivation by you for your feedback, before I update the commits.

The motivation behind adding the FIXUP option is to generalize my specific motivation, which is to be able to compile a single package that sets PKG_MIRROR_HASH=skip. Others have expressed similar desires, such as in Issue #35 .

When PKG_MIRROR_HASH=skip and the FIXUP option is not specified in the OpenWRT build system for make check, a message is generated in the logs. In this GH Action, that message is filtered-in (see this line) as an error, and the build fails.

When the FIXUP option is specified, and in the Makefile we have PKG_MIRROR_HASH=skip, no log message regarding a hash check failure is generated, so with that this GH action is able to subsequently compile the package. This succeeds because the FIXUP option also fixes the Makefile to contain the correct value of PKG_MIRROR_HASH.

This PR adds the ability to specify the FIXUP option to make check (over here). I have also added a second, a more brute-force, option of IGNORE_PKG_HASH_ISSUE. This option simply disables the exit 1 statement when a package has a mismatched hash (over here).

I welcome suggestions for changes to this PR.

cmangla avatar Oct 29 '24 10:10 cmangla

let me add an example https://github.com/qwerttvv/Router/blob/master/.github/workflows/smartdns.yml https://github.com/pymumu/smartdns/blob/master/package/openwrt/Makefile

this actions compiles the latest smartdns

qwerttvv avatar Oct 29 '24 15:10 qwerttvv

I don't understand the motivation for this PR. Could you please explain and add it to the commit message?

@aparcar Done. I kept only the FIXUP option in this PR for simplicity and clarity.

cmangla avatar Nov 01 '24 10:11 cmangla

@cmangla changes looks O.K. If you have extra time I would also check the diff in the package Makefile and if FIXUP enable also suggest the correct hash. Totally optional but would be welcome

An alternative solution might be "--nocheck" to disable package check entirely.

Ansuel avatar Nov 07 '24 14:11 Ansuel

@Ansuel I mostly use FIXUP to fix the hash in Makefile, not use it to avoid build failure. I think this is the right way use it, so I thinks when FIXUP=1, the compile should not happen.

EkkoG avatar Nov 07 '24 15:11 EkkoG

@Ansuel I mostly use FIXUP to fix the hash in Makefile, not use it to avoid build failure. I think this is the right way use it, so I thinks when FIXUP=1, the compile should not happen.

@EkkoG Presumably, when you do use FIXUP to fix the hash in the Makefile, you do eventually compile it, right? In other words, the eventual goal of fixing the Makefile is to then launch a build with it. Given that, I do not see the point on insisting that the build should not happen when FIXUP=1.

Anyway, if the merge of this PR is predicated on this alternative mode of operation, please do let me know.

I do agree with @Ansuel though, that ideally the fixed Makefile should be presented so that the fixes can be retrieved and then the subsequent checks can pass without the FIXUP option.

cmangla avatar Nov 07 '24 16:11 cmangla

Any reason to not merge this enhancement?

lars18th avatar Mar 06 '25 17:03 lars18th

Any reason to not merge this enhancement?

I suppose some people are of the opinion that this enhancement is not complete, in the sense that the internally generated corrected package hash is used to build the package, but that hash is not delivered to the end user. The end user may want to use the correct package hash to be able to build without the FIXUP option.

I am of the opinion that this PR could be merged as is, since it is useful on its own and currently in use by others, as is. And if there are people who really want the package hash to be delivered, either in the GH action logs or as an artifact, that could be done in a subsequent PR.

cmangla avatar Mar 06 '25 19:03 cmangla

I am of the opinion that this PR could be merged as is, since it is useful on its own and currently in use by others, as is. And if there are people who really want the package hash to be delivered, either in the GH action logs or as an artifact, that could be done in a subsequent PR.

I agree. However, perhaps you can include a parameter to generate optionally a text file with the hash. This could increase the likelihood of acceptance.

lars18th avatar Mar 07 '25 07:03 lars18th