diff --git a/mk/repo.mk b/mk/repo.mk index dba690c9..7dc9ff80 100644 --- a/mk/repo.mk +++ b/mk/repo.mk @@ -284,6 +284,22 @@ else $(REPO_BIN) change-rule --set-rule=source $(foreach f,$(subst $(comma), ,$*),$(f)) --with-package-deps endif +# Set specific recipe rule to "local" then invoke clean +lc.%: $(FSTOOLS_TAG) FORCE +ifeq ($(PODMAN_BUILD),1) + $(PODMAN_RUN) make $@ +else + $(REPO_BIN) change-rule-local --set-rule=local $(foreach f,$(subst $(comma), ,$*),$(f)) +endif + +# Set specific recipe rule to "ignore" then invoke clean +nc.%: $(FSTOOLS_TAG) FORCE +ifeq ($(PODMAN_BUILD),1) + $(PODMAN_RUN) make $@ +else + $(REPO_BIN) change-rule-local --set-rule=ignore $(foreach f,$(subst $(comma), ,$*),$(f)) +endif + # Reset recipe rule then invoke clean cc.%: $(FSTOOLS_TAG) FORCE ifeq ($(PODMAN_BUILD),1) @@ -302,6 +318,26 @@ scr.%: $(FSTOOLS_TAG) FORCE $(MAKE) sc.$* $(MAKE) r.$*,--with-package-deps +# Set specific recipe rule to "local" then invoke clean and rebuild +lcr.%: $(FSTOOLS_TAG) FORCE + $(MAKE) lc.$* + $(MAKE) r.$* + +# Set specific recipe rule to "ignore" then invoke clean and rebuild +ncr.%: $(FSTOOLS_TAG) FORCE + $(MAKE) nc.$* + $(MAKE) r.$* + +# Set recipe rule to "binary" then invoke clean, rebuild and push +bcrp.%: $(FSTOOLS_TAG) FORCE + $(MAKE) bcr.$* + $(MAKE) p.$* + +# Set recipe rule to "source" then invoke clean, rebuild and push +scrp.%: $(FSTOOLS_TAG) FORCE + $(MAKE) scr.$* + $(MAKE) p.$* + # Save current git rev for next recipe fetch, locking git recipes frozen in time repo-lock: $(FSTOOLS_TAG) FORCE ifeq ($(PODMAN_BUILD),1) diff --git a/src/bin/repo.rs b/src/bin/repo.rs index b54a3cf5..2ef35bc9 100644 --- a/src/bin/repo.rs +++ b/src/bin/repo.rs @@ -57,6 +57,7 @@ const REPO_HELP_STR: &str = r#" push-tree show tree of recipe packages capture-rev write lock to git recipes change-rule override rule to recipes + change-rule-local override rule to specific recipes common flags: --cookbook= the "recipes" folder, default to $PWD/recipes @@ -115,6 +116,7 @@ enum CliCommand { Find, CaptureRev, ChangeRule, + ChangeRuleLocal, } impl CliCommand { @@ -154,6 +156,7 @@ impl FromStr for CliCommand { "find" => Ok(CliCommand::Find), "capture-rev" => Ok(CliCommand::CaptureRev), "change-rule" => Ok(CliCommand::ChangeRule), + "change-rule-local" => Ok(CliCommand::ChangeRuleLocal), _ => bail_options_err!("Unknown command {:?}", s), } } @@ -173,6 +176,7 @@ impl ToString for CliCommand { CliCommand::Find => "find".to_string(), CliCommand::CaptureRev => "capture-rev".to_string(), CliCommand::ChangeRule => "change-rule".to_string(), + CliCommand::ChangeRuleLocal => "change-rule-local".to_string(), } } } @@ -263,7 +267,10 @@ fn main_inner() -> Result<()> { if command == CliCommand::Push { return handle_push(&recipes, &config); } - if matches!(command, CliCommand::ChangeRule | CliCommand::CaptureRev) { + if matches!( + command, + CliCommand::ChangeRule | CliCommand::ChangeRuleLocal | CliCommand::CaptureRev + ) { return handle_change_rule(&recipes, &config, &command); } @@ -975,7 +982,10 @@ fn handle_change_rule( ) -> Result<()> { let mut lock = get_config().recipe_lock.clone(); let cookbook_date = get_git_commit_date(&PathBuf::from("."))?; - let is_change_rule = matches!(command, CliCommand::ChangeRule); + let is_change_rule = matches!( + command, + CliCommand::ChangeRule | CliCommand::ChangeRuleLocal + ); let is_capture_rev = matches!(command, CliCommand::CaptureRev); for recipe in recipes { if is_change_rule && recipe.name.is_host() {