commit 93b6598

hovercats  ·  2026-09-10 22:48:01 +0000 UTC
parent 113e719
compare manifests on install.
this way, we can avoid having orphaned files leftover on rebuilds/updates
1 files changed,  +25, -4
M rcpm
M rcpm
+25, -4
 1@@ -109,6 +109,14 @@ fn gen_manifest {
 2 		sort -ru >./$rcpm_db/$pkg/manifest
 3 }
 4 
 5+fn is_installed {test -d $rcpm_root/$rcpm_db/$pkg}
 6+
 7+fn push_pkg {
 8+	cd $rcpm_root
 9+	$tool -dc $rcpm_cache/$pkg@$ver-$rev.tar.$ext | pax -r
10+	log $pkg installed successfully
11+}
12+
13 fn install_pkg {
14 	cd $rcpm_root
15 	get_ver || status=()
16@@ -119,9 +127,22 @@ fn install_pkg {
17 		mv -f ./$rcpm_db/$pkg/manifest ..
18 		gen_manifest
19 		if (cmp -s ../manifest ./$rcpm_db/$pkg/manifest) {
20-			cd $rcpm_root
21-			$tool -dc $rcpm_cache/$pkg@$ver-$rev.tar.$ext | pax -r
22-			log $pkg installed successfully
23+			if (is_installed) {
24+				if (cmp -s $rcpm_root/$rcpm_db/$pkg/manifest ./$rcpm_db/$pkg/manifest) {
25+					push_pkg
26+				}
27+				if not {
28+					filelist=`{grep -Fxvf ./$rcpm_db/$pkg/manifest $rcpm_root/$rcpm_db/$pkg/manifest}
29+					for (files in $filelist) {
30+						rmdir $rcpm_root/$files >[2=] || \
31+							rm -f $rcpm_root/$files >[2=]
32+					}
33+					push_pkg
34+				}
35+			}
36+			if not {
37+					push_pkg
38+			}
39 		}
40 		if not errexit Error: Manifest does not match!
41 	}
42@@ -162,7 +183,7 @@ fn get_local_ver {
43 }
44 
45 fn rm_pkg {
46-	if (! test -d $rcpm_root/$rcpm_db/$pkg) {
47+	if (! is_installed) {
48 		errexit Error: Package not installed!
49 	}
50 	filelist=`{cat $rcpm_root/$rcpm_db/$pkg/manifest}