From d3da3bdb907801d77ef4cf8405c3703fb9374a5f Mon Sep 17 00:00:00 2001
From: P. J. McDermott <pj@pehjota.net>
Date: Sat, 16 Aug 2014 20:27:06 -0400
Subject: notes.txt: New file

---
diff --git a/notes.txt b/notes.txt
new file mode 100644
index 0000000..7e2f041
--- /dev/null
+++ b/notes.txt
@@ -0,0 +1,151 @@
+host arch is determined at build time
+
+
+prokit install [-a <arch>] [-P <plat>] <suite> <chroot>
+	<suite>
+		e.g. rs1, dev/trunk, or proteanos:dev/trunk
+	if <arch> != host-arch
+		install host-arch base packages to /inst
+prokit shell <chroot>
+prokit opkg <chroot> [<option> ...] <command> [<argument> ...]
+prokit opkbuild <chroot> [<option> ...] <pkgdir>
+	gets build deps, makes and installs metapackage, opkbuilds
+	removes metapackage, autoremoves cruft
+
+
+developer:
+
+    host$ prokit install -a core-linux-eglibc -P dev proteanos:dev/trunk chroot
+    host$ prokit opkbuild chroot .
+
+buildd:
+
+    host$ prokit opkg chroot install src-expat
+    host$ prokit opkbuild chroot chroot/usr/src/expat_*/
+
+
+TODO:
+
+profiles, e.g. proteanos
+each profile has its own tests for host arch/plat
+also, how does debootstrap determine host arch on non-Debian hosts?
+	apparently it doesn't
+	(must pass --arch, then debootstrap can't detect if host != target)
+
+configure
+	--with-profile=proteanos
+	--with-arch=core-linux-eglibc
+	--with-plat=dev
+
+profiles/
+  +- proteanos
+      +- archtab
+      +- plattab
+      +- feedtab
+
+should profiles be left to run time?
+Debian/etc. packaging: proinst-proteanos? proinst with all profiles? arch:any?
+
+m4_include profiles/profiles.m4
+PI_PROFILE
+
+configure
+	--with-proteanos-arch
+
+maybe better: at run time:
+	look in sysconfdir for host arch value
+		in-place: etc/proinst_arch?
+		distributions can make this file in postinst
+	otherwise, autodetect
+
+or just autodetect and "cache":
+	`prokit install` detects host arch
+		profile-specific config.guess-like function
+	`prokit shell` and `prokit opkg` look for /inst
+		add /inst to PATH and run /inst/bin/sh and /inst/usr/bin/opkg
+	`prokit build` looks for /inst
+		screams something about "unsupported" and "cross install"
+		then bails
+		if no /inst, opkbuild
+		opkbuild will find /etc/proteanos_{arch,plat} and do magics
+
+
+run_cmd()
+{
+	if $# lt cmd_$cmd_min_args
+		help $cmd
+		exit 1
+	if cmd_$cmd_max_args is set and $# gt cmd_$cmd_max_args
+		help $cmd
+		exit
+	i=0; args=
+	while i lt cmd_$cmd_exp_args
+		args="$args ''"
+	eval cmd_$cmd_main $@ $args
+}
+
+cmd_install_min_args=2
+cmd_install_exp_args=2
+cmd_install_max_args=2
+
+opkg cmd?  parses opts after <chroot>?
+maybe <chroot> itself should be an option?
+
+
+ask profile for arch and feed index URIs
+for each feed
+	download feed index
+	control=
+	for each line in feed index
+		if line not empty
+			control="$control$line$LF"
+		else
+			pkg=`echo $control | sed -n 's/^Package: *//p'`
+			run profile callback
+			if $pkg should be installed
+				pkgs="$pkgs $pkg"
+			for each field in $install_dep_fields $host_dep_fields
+				deps=`echo $control | sed -n
+					"s/^$field: *//p"`
+				new_deps=
+				IFS=', '; for each dep in $deps
+					dep=`echo $dep | sed
+						's/ *|.*$//; s/ *(.*$/;'`
+						# or maybe `echo $dep |
+							cut -d ' ' -f 1`
+					new_deps="$new_deps $dep"
+				echo "$pkg$new_deps" >$field.list
+all_deps=
+while $new_pkgs not empty
+	all_deps="$all_deps $new_pkgs"
+	new_deps=
+	for each pkg in $new_pkgs
+		new_deps=`grep "^$pkg " *depends.list | cut -d ' ' -f 2-`
+	new_deps=`printf '%s\n' $new_deps | sort -u`
+	new_pkgs=
+	for each pkg in $new_deps
+		if $pkg not in $all_deps
+			new_pkgs="$new_pkgs $pkg"
+
+
+	for each line in feed index
+		if line not empty
+			parse control fields
+		else
+			run profile callback
+			if $pkg should be installed
+				pkgs="$pkgs $pkg"
+				unresolved="$deps"
+	while $unresolved not empty
+		for each line in feed index
+			if line not empty
+				parse control fields
+			else
+				if $unresolved starts with $pkg
+					
+
+allpkgs='base'
+newpkgs='busybox linux-image opkg'
+foreach pkg
+	if $pkg in $newpkgs
+		
--
cgit v0.9.1