Closed AeliusSaionji closed 7 years ago
@Link-Satonaka thanks for letting me know about this. Not sure when I will get to this, but at some point, I will.
Unless @Redsandro can shed any light on what is going on. I think he created the script originally.
It's getting harder. There's some new randomization included. If you try the steps to get the link in the developer console, it works. But when automated, it doesn't (for me). Didn't spend too much time on it. Just got back from California. Jetlag's a female dog. But if you can figure out how to do it, it would be a good opportunity to turn the fosshub link grabber into a helper module dependency.
I still think helpers should have a certain format, and they should be packages that can be referenced as dependencies.
One change means one package to fix, and all packages that depend on it will work again.
@Redsandro Yip, I agree, we should make this into a package that can be easily re-used across all packages that take a dependency on it. Not sure when I will have a chance to look at this, but I will keep it on my list, and see if I can get to it.
@gep13
Apart from reversing the new url obfuscation, I'd like to hear your input on a package name template that we can adhere to for different sites. E.g.:
choco-helper-fosshub
choco-helper-cnet
We need some semantics and do it right from the start, but I'm not a big fan of long names such as choco-helper-get-urlfromfosshub
.
They would need to be installed inside %path%
for the install script that depends on them to use them. Technically, they don't necessarily need to be posh.
The name of the package must end in .extension
. You should put the ps1 function files in the extensions
folder of the package.
The helper name could be Get-FossHubDownloadUrl
Proposed | . |
---|---|
package id | chocolatey-fosshub.extension |
extension/module name | Get-UrlFromFosshub |
module filename | Get-UrlFromFosshub.psm1 |
nupkg full path | extensions/chocolatey-fosshub.extension/extensions/Get-UrlFromFosshub.psm1 |
Maintaining many packages has given me a good exposure to various code conditions that would benefit to being translated into extensions. These would be code blocks in the chocolatey*.ps1
files.
I'll try to catalog them and document them here so we might discover a best naming practice that can be applied.
Technically, they don't necessarily need to be posh.
@Redsandro Can you provide some examples that would not be posh? I can't think of any.
@dtgm
@Redsandro Can you provide some examples that would not be posh? I can't think of any.
Anything you (as in anyone making a helper) feel comfortable with.
Imagine you have weirdChocoPackage
, only downloadable from weirdSite
. Then you have a dependency on weirdSiteDownloadHelper
which in turn has a dependency on python
. Now the helper can be written in python rather than posh, and weirdChocoPackage
can use the python script to get the download link.
There are also a lot of bash-like components (like sed
) that can be used as dependencies. I'm sure there are more examples, but those are outside the scope of my personal interest.
Ideally you'll want everything in posh, but I'm just bringing it up because posh is the most unfriendly backwards syntactic horror excuse for a scripting language I've ever seen. So in case that's holding anyone back to write something clever, a python helper in the gallery is worth two posh helpers in the bush.
@Redsandro as you will see from my recent commits, I have gone for chocolatey-fosshub.extension
as the package name. The idea being that this package will contain all functions related to interacting with fosshub from chocolatey. Contained within it, currently there is only one powershell file, but this can grow to as many as you want. I think this level of granularity is one that gives us enough flexiblity going forward. Thoughts?
Assuming everyone is ok with what i have proposed (and by that I mean "borrowing" the current FossHub script from @dtgm), I was planning on updating the existing packages in this repo to take the new package dependency.
@gep13 so far so good. Although some helpers will need something extra. Like the name of a link on a page and a regex for that specific software.
Check out this helper I created for foobar and renamemaster. Some sites will structurally need something like that.
@Redsandro but equally, we could just be chocolatey-foobar.extension
, right? Granted, that is a package specific extension, rather than a package source extension, but the same reasoning exists behind it. i.e. allowing the extraction of pieces of information for the package/source that is external to the actual installation of it.
@gep13 perhaps that was a bad example. If it's just for one package, it can just be in the package installer. I mean that there are certain services that have websites embed an unidentifiable link with a random token. The correct link + token can only be found when regexing for the software name in their preferred spelling. I can't remember where, but I have seen this before.
Look at this (outdated) helper I wrote: Get-UrlFromCnet.ps1
I'm just saying, we might need 2 or 3 parameters for some helpers, so better make sure we have some degree of standardization in the way and the order of passing arguments.
Helpers I've sort of encountered in packages so far, though they don't exist in this way yet:
Although secretly we're cross-discussing https://github.com/chocolatey/chocolatey/issues/377 now. :wink:
SourceForge doesn't need a helper - the /download
at the end of the normal path that picks the appropriate mirror works just fine when using Chocolatey.
For "fun", here's a list-vomit of packages on Chocolatey (as of 20 feb) containing psm1
files.
While a lot of these are package specific, I should dig deeper to check for shared function names across packages...
Going to call this one done.
If anyone thinks different, let me know.
https://github.com/chocolatey/chocolatey-coreteampackages/blob/553cdc3ef1f75b537c5b08f9e6b513a3cc9b480b/automatic/palemoon/tools/Get-UrlFromFosshub.ps1
Search the repository for fosshub to see affected packages. There is a similar script by a slightly different name that is probably also broken by fosshub site changes.