innobead / huber

Huber 📦, Package Install Manager for GitHub repos
Apache License 2.0
185 stars 16 forks source link

Automatically update package manifests for PRs #135

Open innobead opened 7 months ago

innobead commented 7 months ago
          > here's a PR for `terraform` on Apple Silicon that includes the output from `make generate`.

is there room for improvement or automation or Github Action-ing of the make generate step? I hit a number of small issues with it, the most annoying being that make generate detected my personal huber repo and included all my tools in the diff. I'm also lazy and paranoid and don't really want to deal with a GITHUB_TOKEN, nor do I want to accidentally run the make publish action, or generally run any destructive action with an API Token.

It is feasible surely. Let's create a ticket first.

Originally posted by @innobead in https://github.com/innobead/huber/issues/134#issuecomment-1842763764

DanceMore commented 7 months ago

I was attempting to bulk update the repo via vim *; however it did not seem like I was getting consistent or 100% of the output I expected during make generate. I checked in generator/src/build.rs and saw impacted elements listed, not commented out or something. I tried with FORCE_GENERATE=true, as well as rm-ing files to see if they'd be put back from scratch; again with somewhat confusing or incomplete behavior.

so I'm not sure what's missing in my dev environment, or what I might be doing wrong, or what assumption the generator might be making that I've missed (for example, I've seen file modification times moving backwards in time cause tools to break).

in fact, a closer reading of FORCE_GENERATE makes me unsure what it's intention is => https://github.com/innobead/huber/blob/main/crates/generator/src/build.rs#L75-L76

I'm definitely going to experiment a little more before I have anything concrete to propose.

DanceMore commented 7 months ago
diff --git a/crates/generator/src/pkg/arkade.rs b/crates/generator/src/pkg/arkade.rs
index 383e71f..b579941 100644
--- a/crates/generator/src/pkg/arkade.rs
+++ b/crates/generator/src/pkg/arkade.rs
@@ -40,6 +40,16 @@ pub fn release() -> Package {
                 tag_version_regex_template: None,
                 scan_dirs: None,
             }),
+            PackageTargetType::MacOSArm64(PackageManagement {
+                artifact_templates: vec!["{version}/arkade-darwin-arm64".to_string()],
+                executable_templates: None,
+                executable_mappings: None,
+                install_commands: None,
+                uninstall_commands: None,
+                upgrade_commands: None,
+                tag_version_regex_template: None,
+                scan_dirs: None,
+            }),
             PackageTargetType::Windows(PackageManagement {
                 artifact_templates: vec!["{version}/arkade.exe".to_string()],
                 executable_templates: None,

make generate does nothing on my machine with this patch applied.... rm generated/packages/arkade.yaml does not help.

here it is being added to the generator .release() calls => https://github.com/innobead/huber/blob/main/crates/generator/src/build.rs#L246

I am not sure what to investigate next 🤔 if I do not understand the generator, I cannot automate the generator :(

innobead commented 7 months ago

in fact, a closer reading of FORCE_GENERATE makes me unsure what it's intention is => main/crates/generator/src/build.rs#L75-L76

This is only for generating the manifest of the updated package. If there are no changes locally, no manifests will be regenerated.

innobead commented 7 months ago

make generate does nothing on my machine with this patch applied.... rm generated/packages/arkade.yaml does not help.

here it is being added to the generator .release() calls => main/crates/generator/src/build.rs#L246

I am not sure what to investigate next 🤔 if I do not understand the generator, I cannot automate the generator :(

Your observation is correct. make generate does not work consistently. I made the change at https://github.com/innobead/huber/commit/166145c5c1ae8bb7cb5bb82bb74991c5311ab176 to improve that. Also, arkade has been updated for darwin arm64 as well at https://github.com/innobead/huber/commit/1bb5c32995f651d8b56d81191e89f33838c31e9c.

DanceMore commented 7 months ago

I really wanted to use the "Github Suggestions" feature so a human could interactively approve or deny the generated changes but for $reasons, the Suggestions API isn't particularly useful for doing that.

so I might relax my desire to have automatic generator updates :(

I do think there are still some packages out of date, unpublished entirely (renote??), or missing now-supported architectures.