Looking for assistance with fixing an app's metadata

First time I’ve ever contributed to F-Droid, written metadata, or worked with linux utilities like sed so I’m a little out of my comfort zone here. I’ve opened an issue at this point, and have dove in to see if I can learn anything. As you can probably tell from the history, I’m struggling a little to come up with a solution.

From discussions in the F-Droid Matrix server, my understanding is that I need to somehow get the versionName and Code information into the Gradle build. The suggested method for this was using sed to edit the build file and put in the static information prior to build. Using sed beyond a quick and basic string manipulation was beyond me, so I’ve been going down a path of providing a patch file that patches out the multiline code the upstream author created, replaces it with simple tokens which I then use sed to replace with the static version info. This is turning out to be problematic, because as I’ve discovered, the patch command may fail or succeed depending on the current working directory of its command. In a test run, I’m able to confirm that the patch succeeds so long as the working directory is within the app subfolder of the upstream’s code (which is also specified in the build metadata.) However, if I try to use the patch: key in build metadata, this fails, I can only assume because the patch command is running from a different working directory, and I’m not sure how to manipulate the diff/patch file to make it succeed here.

Any suggestions to make this succeed would be greatly appreciated!

UpdateCheckData: with https://github.com/F0x1d/LogFox/releases/latest and extract versionName and versionCode from those

Then in prebuild: you can sed replace versionName = .* with versionName = $$VERSION$$ and $$VERCODE$$ for Code

1 Like

What I was struggling with before was that it appeared we’d have to replace more than one line, given for example:

versionCode = providers
.environmentVariable(“VERSION_CODE”)
.orNull
?.toIntOrNull()
?: Int.MAX_VALUE

But the author of the current pull request did a crafty $$VERCODE$$ ?:replacement, which I assume is Gradle SDL for taking the first parameter by default and ignores the remainder of the code block. I learned a lot on this journey and greatly appreciate everyone’s work to simplify this.

If I could ask a follow up question, do we need/want another pull request to fill in the remaining releases between 2.1.0 and the current release that was PRed in?

That’s part of our tooling: Build Metadata Reference | F-Droid - Free and Open Source Android App Repository not gradle

We don’t care about older versions in between, users will update to the latest anyway

Sorry, do you have a specific part of the documentation that describes the ?: syntax? I didn’t see anything before about replacing a multiline block like that.

Look up “regex” I guess :slight_smile: it’s not special

All of that makes sense and sorry if I was unclear; it was that ?: substitution specifically that I was interested in. I just learned that it’s called an Elvis operator, basically like a shorthand if. I just thought it was neat trick using sed to avoid having to replace the lines of code afterwards. Thank you for humoring my questions and helping out with this.