mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-17 15:34:18 +08:00
Add make target to set a recipe rule to local or ignore
This commit is contained in:
parent
114833df68
commit
0ea9983bf9
36
mk/repo.mk
36
mk/repo.mk
@ -284,6 +284,22 @@ else
|
|||||||
$(REPO_BIN) change-rule --set-rule=source $(foreach f,$(subst $(comma), ,$*),$(f)) --with-package-deps
|
$(REPO_BIN) change-rule --set-rule=source $(foreach f,$(subst $(comma), ,$*),$(f)) --with-package-deps
|
||||||
endif
|
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
|
# Reset recipe rule then invoke clean
|
||||||
cc.%: $(FSTOOLS_TAG) FORCE
|
cc.%: $(FSTOOLS_TAG) FORCE
|
||||||
ifeq ($(PODMAN_BUILD),1)
|
ifeq ($(PODMAN_BUILD),1)
|
||||||
@ -302,6 +318,26 @@ scr.%: $(FSTOOLS_TAG) FORCE
|
|||||||
$(MAKE) sc.$*
|
$(MAKE) sc.$*
|
||||||
$(MAKE) r.$*,--with-package-deps
|
$(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
|
# Save current git rev for next recipe fetch, locking git recipes frozen in time
|
||||||
repo-lock: $(FSTOOLS_TAG) FORCE
|
repo-lock: $(FSTOOLS_TAG) FORCE
|
||||||
ifeq ($(PODMAN_BUILD),1)
|
ifeq ($(PODMAN_BUILD),1)
|
||||||
|
|||||||
@ -57,6 +57,7 @@ const REPO_HELP_STR: &str = r#"
|
|||||||
push-tree show tree of recipe packages
|
push-tree show tree of recipe packages
|
||||||
capture-rev write lock to git recipes
|
capture-rev write lock to git recipes
|
||||||
change-rule override rule to recipes
|
change-rule override rule to recipes
|
||||||
|
change-rule-local override rule to specific recipes
|
||||||
|
|
||||||
common flags:
|
common flags:
|
||||||
--cookbook=<cookbook_dir> the "recipes" folder, default to $PWD/recipes
|
--cookbook=<cookbook_dir> the "recipes" folder, default to $PWD/recipes
|
||||||
@ -115,6 +116,7 @@ enum CliCommand {
|
|||||||
Find,
|
Find,
|
||||||
CaptureRev,
|
CaptureRev,
|
||||||
ChangeRule,
|
ChangeRule,
|
||||||
|
ChangeRuleLocal,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CliCommand {
|
impl CliCommand {
|
||||||
@ -154,6 +156,7 @@ impl FromStr for CliCommand {
|
|||||||
"find" => Ok(CliCommand::Find),
|
"find" => Ok(CliCommand::Find),
|
||||||
"capture-rev" => Ok(CliCommand::CaptureRev),
|
"capture-rev" => Ok(CliCommand::CaptureRev),
|
||||||
"change-rule" => Ok(CliCommand::ChangeRule),
|
"change-rule" => Ok(CliCommand::ChangeRule),
|
||||||
|
"change-rule-local" => Ok(CliCommand::ChangeRuleLocal),
|
||||||
_ => bail_options_err!("Unknown command {:?}", s),
|
_ => bail_options_err!("Unknown command {:?}", s),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,6 +176,7 @@ impl ToString for CliCommand {
|
|||||||
CliCommand::Find => "find".to_string(),
|
CliCommand::Find => "find".to_string(),
|
||||||
CliCommand::CaptureRev => "capture-rev".to_string(),
|
CliCommand::CaptureRev => "capture-rev".to_string(),
|
||||||
CliCommand::ChangeRule => "change-rule".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 {
|
if command == CliCommand::Push {
|
||||||
return handle_push(&recipes, &config);
|
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);
|
return handle_change_rule(&recipes, &config, &command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,7 +982,10 @@ fn handle_change_rule(
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut lock = get_config().recipe_lock.clone();
|
let mut lock = get_config().recipe_lock.clone();
|
||||||
let cookbook_date = get_git_commit_date(&PathBuf::from("."))?;
|
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);
|
let is_capture_rev = matches!(command, CliCommand::CaptureRev);
|
||||||
for recipe in recipes {
|
for recipe in recipes {
|
||||||
if is_change_rule && recipe.name.is_host() {
|
if is_change_rule && recipe.name.is_host() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user