Write pkgar head when pushing

This commit is contained in:
Wildan M 2026-05-08 18:48:07 +07:00
parent 260f98467e
commit 65f68c0645
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79

View File

@ -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