From 65f68c0645503c6019b13e9916871e54fc005ece Mon Sep 17 00:00:00 2001 From: Wildan M Date: Fri, 8 May 2026 18:48:07 +0700 Subject: [PATCH] Write pkgar head when pushing --- src/cook/package.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cook/package.rs b/src/cook/package.rs index 29ff9ca8..4d43e572 100644 --- a/src/cook/package.rs +++ b/src/cook/package.rs @@ -4,8 +4,9 @@ use std::{ }; use pkg::{InstallState, Package, PackageName, PackagePrefix, PackageState}; -use pkgar::ext::PackageSrcExt; +use pkgar::{PackageFile, Transaction, ext::PackageSrcExt}; use pkgar_core::HeaderFlags; +use pkgar_keys::PublicKeyFile; use crate::{ Error, Result, @@ -264,7 +265,14 @@ pub fn package_handle_push( if let Some((manual, dependents)) = pstate { if archive_path.is_file() { - pkgar::extract(pkey_path, &archive_path, sysroot_dir)?; + let pkey = PublicKeyFile::open(pkey_path)?.pkey; + let mut package = PackageFile::new(archive_path, &pkey)?; + Transaction::install(&mut package, sysroot_dir)?.commit()?; + let head_path = sysroot_dir.join(format!( + "var/lib/packages/{}.pkgar_head", + pkg_toml.name.as_str() + )); + package.split(&head_path, None::<&Path>)?; } // TODO: Check if we need to inject remote key