summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-07-14 16:55:44 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-07-14 16:55:44 (EDT)
commit850f2d8c79cfe48032ac6c2620d862ab124061ec (patch)
tree513162b1d72ea772b8a84335f34998d896a71507
parent57db596822c4d3727374b258d218e8986cf3a92a (diff)
Add mkpkgs and rmpkgs utilities
-rwxr-xr-xbuild5
-rw-r--r--src/1/ppt-mkpkgs75
-rw-r--r--src/1/ppt-rmpkgs10
-rw-r--r--src/ppt-mkpkgs4
-rw-r--r--src/ppt-rmpkgs4
5 files changed, 98 insertions, 0 deletions
diff --git a/build b/build
index 4d73d41..aa6bfaf 100755
--- a/build
+++ b/build
@@ -1,6 +1,7 @@
#!/usr/bin/make -f
pkgdatadir = platconf-pkg-tools.data/usr/share/platconf-pkg-tools
+bindir = platconf-pkg-tools.data/usr/bin
nop:
@:
@@ -12,3 +13,7 @@ build:
install: build
install -D -m 0644 src/build.mk $(pkgdatadir)/build.mk
install -D -m 0644 src/1/build.mk $(pkgdatadir)/1/build.mk
+ install -D -m 0755 src/ppt-mkpkgs $(bindir)/ppt-mkpkgs
+ install -D -m 0644 src/1/ppt-mkpkgs $(pkgdatadir)/1/ppt-mkpkgs
+ install -D -m 0755 src/ppt-rmpkgs $(bindir)/ppt-rmpkgs
+ install -D -m 0644 src/1/ppt-rmpkgs $(pkgdatadir)/1/ppt-rmpkgs
diff --git a/src/1/ppt-mkpkgs b/src/1/ppt-mkpkgs
new file mode 100644
index 0000000..b114a74
--- /dev/null
+++ b/src/1/ppt-mkpkgs
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+set -eu
+
+PLAT=
+
+main()
+{
+ PLAT="$(sed '1{s/^config-\([^ ][^ ]*\) (.*$/\1/;};1!q;' changelog)"
+
+ make_common_pkg
+ make_build_time_pkgs
+ make_run_time_pkgs
+}
+
+info()
+{
+ local fmt="${1}"
+ shift 1
+
+ printf "ppt-mkpkgs: ${fmt}\n" "${@}"
+}
+
+make_common_pkg()
+{
+ # Make "-common" package to provide source package documentation files.
+ mkdir -p "config-${PLAT}-common.pkg"
+ cat >"config-${PLAT}-common.pkg/control" <<-EOF
+ Architecture: all
+ Platform: all
+ Description: "${PLAT}" platform configuration - common files
+ EOF
+ >"config-${PLAT}-common.pkg/docs"
+ info 'Metadata for package "%s" generated.' "config-${PLAT}-common"
+}
+
+make_build_time_pkgs()
+{
+ local pkg=
+
+ # Make each config-*-* package.
+ for pkg in src/build/*; do
+ pkg="${pkg#src/build/}"
+ mkdir -p "config-${pkg}-${PLAT}.pkg"
+ cat >"config-${pkg}-${PLAT}.pkg/control" <<-EOF
+ Architecture: all
+ Platform: all
+ Depends: config-${PLAT}-common (= \${Binary-Version})
+ Description: "${PLAT}" platform configuration for ${pkg}
+ EOF
+ info 'Metadata for package "%s" generated.' \
+ "config-${pkg}-${PLAT}"
+ done
+}
+
+make_run_time_pkgs()
+{
+ local pkg=
+
+ # Make each config-* package.
+ for pkg in src/run/*; do
+ pkg="${pkg#src/run/}"
+ mkdir -p "config-${pkg}.pkg"
+ cat >"config-${pkg}.pkg/control" <<-EOF
+ Architecture: all
+ Platform: ${PLAT}
+ Depends: config-${PLAT}-common (= \${Binary-Version})
+ Description: "${PLAT}" platform configuration for ${pkg}
+ EOF
+ info 'Metadata for package "%s" generated.' \
+ "config-${pkg}"
+ done
+}
+
+main "${@}"
diff --git a/src/1/ppt-rmpkgs b/src/1/ppt-rmpkgs
new file mode 100644
index 0000000..7e7fbc4
--- /dev/null
+++ b/src/1/ppt-rmpkgs
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -eu
+
+main()
+{
+ rm -Rf config-*.pkg/
+}
+
+main "${@}"
diff --git a/src/ppt-mkpkgs b/src/ppt-mkpkgs
new file mode 100644
index 0000000..c3d82fc
--- /dev/null
+++ b/src/ppt-mkpkgs
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+. ../ppt-version
+. /usr/share/platconf-pkg-tools/${ppt_version}/ppt-mkpkgs
diff --git a/src/ppt-rmpkgs b/src/ppt-rmpkgs
new file mode 100644
index 0000000..c3d82fc
--- /dev/null
+++ b/src/ppt-rmpkgs
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+. ../ppt-version
+. /usr/share/platconf-pkg-tools/${ppt_version}/ppt-mkpkgs