Run fetch before capturing rollback, add unfetch target

This commit is contained in:
Wildan M 2026-05-09 19:37:00 +07:00
parent 66d336baff
commit b356334d14
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79
2 changed files with 14 additions and 2 deletions

View File

@ -47,6 +47,14 @@ else
$(REPO_BIN) fetch $(COOKBOOK_OPTS) --with-package-deps
endif
# Unfetch and clean all recipes source or binary from filesystem config
unfetch: prefix $(FSTOOLS_TAG) FORCE
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) make $@
else
$(REPO_BIN) unfetch $(COOKBOOK_OPTS) --with-package-deps
endif
# Fetch Cargo dependencies for the cookbook tool (needed for REPO_OFFLINE=1 builds)
cargo-fetch: FORCE
ifeq ($(PODMAN_BUILD),1)

View File

@ -1005,7 +1005,11 @@ fn handle_change_rule(
} else {
let source_dir = recipe.dir.join("source");
let rev = if config.with_rollback {
get_git_rev_before_date(&source_dir, &cookbook_date)
// invoke fetch as the git tracking can be different
match handle_fetch(recipe, config, false, &None) {
Ok(_) => get_git_rev_before_date(&source_dir, &cookbook_date),
Err(e) => Err(e),
}
} else {
get_git_head_rev(&source_dir).map(|r| r.0)
};
@ -1015,7 +1019,7 @@ fn handle_change_rule(
old_rev == Some(rev)
}
Err(e) => {
eprintln!("Skipped: {e}");
eprintln!("Skipping {}: {e}", recipe.name.as_str());
continue;
}
}