Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,8 @@ verify-raster-drivers:
verify-packaged-drivers:
tests/packaged-drivers.sh

verify-stateful-drivers:
tests/stateful-drivers.sh

verify-cups-patch-chain:
tests/cups-patch-chain.sh
35 changes: 35 additions & 0 deletions docs/superpowers/plans/2026-09-16-fsdk-stateful-profile-drivers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# FSDK Stateful Profile Drivers Implementation Plan

**Goal:** Restore HPIJS, foo2zjs, and m2300w with immutable builds, valid OCI paths, discoverable driver data, and persistent user-editable configuration/profile state.

**Architecture:** Add one pinned BuildStream element per upstream source. Build HPLIP in its minimal HPIJS-only configuration and keep its mutable `hplip.conf` under `/var/lib/ghostscript-printer-app/hplip`, reached through `/etc/hp/hplip.conf`. Build foo2zjs and m2300w against the existing FSDK CUPS/Ghostscript graph and the single repository-owned JBIG artifact. Their wrappers use `/usr` for executables and `/var/lib/ghostscript-printer-app/{foo2zjs,m2300w}` for profile data. Immutable defaults live under `/usr/share/ghostscript-printer-app/defaults`; the entrypoint copies only missing files into persistent state before starting the application.

## Task 1: Build immutable driver artifacts

- [x] Add HPLIP from `debian/3.26.4+dfsg0-3-0-gf27f786d5f1060cce7c92e42488bd5e5d00ba135`, configured for HPIJS only, and install only `hpijs`, its required libraries, and a valid default `hplip.conf` seed.
- [x] Add foo2zjs from `debian/20200505dfsg0-5-0-g816bcd01d5fa0b3171fe6d09c093a9290ccf7c25`, sharing the existing JBIG owner and installing only runtime encoders, wrappers, command filter, immutable profile defaults, and a pyppd archive.
- [x] Exclude foo2zjs models that require per-boot firmware loading, preserving the existing container contract.
- [x] Add m2300w from `debian/0.51-15-0-gf4ebe31fe93e8f2f56ecce2f927e59bb41432d53`, installing its encoder, wrapper, PostScript resources, and four generated PPDs in a pyppd archive.
- [x] Install all CUPS filters at `/usr/lib/cups/filter`; use `/usr/bin` for wrapper helpers and real `/usr`, `/etc`, and `/var/lib/ghostscript-printer-app` paths only.

## Task 2: Initialize persistent state

- [x] Store immutable HPLIP, foo2zjs, and m2300w defaults under `/usr/share/ghostscript-printer-app/defaults`.
- [x] Point `/etc/hp/hplip.conf` at `/var/lib/ghostscript-printer-app/hplip/hplip.conf` while keeping HPIJS compiled for `/etc/hp`.
- [x] Extend `container-entrypoint.sh` to create the three state directories and copy default files only when their destination is absent.
- [x] Preserve existing user files byte-for-byte across container restarts while allowing newly added defaults to seed later images.

## Task 3: Compose and verify

- [x] Add the three artifacts to `core-stack.bst` without adding a second CUPS, Ghostscript, JBIG, or Foomatic owner.
- [x] Add `just verify-stateful-drivers` and `tests/stateful-drivers.sh`.
- [x] Assert executable, shebang, and ELF closure for HPIJS, foo2zjs, and m2300w plus every wrapper helper they invoke.
- [x] Require representative HPIJS/IJS, foo2zjs, and m2300w conversions to emit non-empty, repeatable printer-language output with stable protocol signatures.
- [x] Start the real appliance with persistent state, modify one seeded HPLIP configuration/profile file per state family, restart, and prove the modifications survive.
- [x] Require representative HPIJS, foo2zjs, and m2300w entries in the live Printer Application driver catalog.

## Task 4: Verify and publish

- [x] Run `just validate`, all prior slice gates, `just verify-stateful-drivers`, workflow lint, shell syntax checks, and `git diff --check`.
- [x] Review the full diff from `feat/fsdk-packaged-drivers` and resolve all blocking findings.
- [x] Resolve issue 06, commit and push `feat/fsdk-stateful-drivers`, and open a stacked PR based on `feat/fsdk-packaged-drivers`.
3 changes: 3 additions & 0 deletions elements/printer-app/core-stack.bst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ depends:
- printer-app/pxljr.bst
- printer-app/rastertosag-gdi.bst
- printer-app/splix.bst
- printer-app/foo2zjs.bst
- printer-app/hpijs.bst
- printer-app/m2300w.bst
- freedesktop-sdk.bst:public-stacks/runtime-gnu.bst
- freedesktop-sdk.bst:components/avahi.bst
- freedesktop-sdk.bst:components/ca-certificates.bst
Expand Down
85 changes: 85 additions & 0 deletions elements/printer-app/foo2zjs.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
kind: manual
description: Build foo2zjs drivers with persistent color-profile paths.

sources:
- kind: git_repo
url: salsa:printing-team/foo2zjs.git
track: debian/20200505dfsg0-5
ref: debian/20200505dfsg0-5-0-g816bcd01d5fa0b3171fe6d09c093a9290ccf7c25

build-depends:
- printer-app/pyppd.bst
- freedesktop-sdk.bst:public-stacks/buildsystem-make.bst

depends:
- printer-app/jbigkit.bst
- printer-app/psutils.bst
- freedesktop-sdk.bst:components/bc.bst
- freedesktop-sdk.bst:components/cups.bst
- freedesktop-sdk.bst:components/cups-filters.bst
- freedesktop-sdk.bst:components/ghostscript.bst
- freedesktop-sdk.bst:components/file.bst
- freedesktop-sdk.bst:components/grep.bst
- freedesktop-sdk.bst:components/lcms.bst
- freedesktop-sdk.bst:components/python3.bst
- freedesktop-sdk.bst:components/sed.bst
- freedesktop-sdk.bst:public-stacks/runtime-gnu.bst

config:
build-commands:
- |
for wrapper in *-wrapper.in; do
sed -i \
-e 's|$PREFIX/share/foo2|/var/lib/ghostscript-printer-app/foo2zjs/foo2|g' \
-e 's|ICC2PS=$PREFIX/bin/foo2zjs-icc2ps|ICC2PS=/usr/bin/psicc|' \
-e 's|/tmp|${TMPDIR:-/tmp}|g' \
-e 's|dNOPAUSE|dNOPAUSE -dNOINTERPOLATE|g' \
"$wrapper"
done
- >-
make -j2
foo2zjs zjsdecode arm2hpdl
foo2hp foo2xqx xqxdecode
foo2lava lavadecode foo2qpdl qpdldecode opldecode
foo2oak oakdecode foo2slx slxdecode
foo2hiperc hipercdecode foo2hbpl2 hbpldecode
gipddecode foo2ddst ddstdecode usb_printerid
foo2zjs-wrapper foo2oak-wrapper foo2hp2600-wrapper
foo2xqx-wrapper foo2lava-wrapper foo2qpdl-wrapper
foo2slx-wrapper foo2hiperc-wrapper foo2hbpl2-wrapper
foo2ddst-wrapper foo2zjs-pstops
CUPS_SERVERBIN=/usr/lib/cups CUPS_DEVEL=1 CUPS_GOODAPI=1
- make command2foo2lava-pjl CUPS_SERVERBIN=/usr/lib/cups CUPS_DEVEL=1 CUPS_GOODAPI=1
- |
cp -a PPD ppd
for model in 1000 1005 1018 1020 P1005 P1006 P1007 P1008 P1505; do
rm -f "ppd/HP-LaserJet_${model}.ppd"
done
pyppd -v -o foo2zjs-ppds ppd
install-commands:
- |
install -d "%{install-root}/usr/bin"
for file in \
foo2zjs zjsdecode arm2hpdl \
foo2hp foo2xqx xqxdecode \
foo2lava lavadecode foo2qpdl qpdldecode opldecode \
foo2oak oakdecode foo2slx slxdecode \
foo2hiperc hipercdecode foo2hbpl2 hbpldecode \
gipddecode foo2ddst ddstdecode usb_printerid \
foo2zjs-wrapper foo2oak-wrapper foo2hp2600-wrapper \
foo2xqx-wrapper foo2lava-wrapper foo2qpdl-wrapper \
foo2slx-wrapper foo2hiperc-wrapper foo2hbpl2-wrapper \
foo2ddst-wrapper foo2zjs-pstops; do
install -m 0755 "$file" "%{install-root}/usr/bin/$file"
done
- install -D -m 0755 command2foo2lava-pjl "%{install-root}/usr/lib/cups/filter/command2foo2lava-pjl"
- install -D -m 0755 foo2zjs-ppds "%{install-root}/usr/share/ppd/foo2zjs-ppds"
- |
defaults="%{install-root}/usr/share/ghostscript-printer-app/defaults/foo2zjs"
for directory in foo2zjs foo2oak foo2hp foo2xqx foo2lava foo2qpdl foo2slx foo2hiperc foo2hbpl foo2ddst; do
install -d "$defaults/$directory/icm"
done
install -m 0644 gamma.ps gamma-lookup.ps "$defaults/foo2zjs/"
install -d "$defaults/foo2zjs/crd" "$defaults/foo2qpdl/crd"
cp -a crd/zjs/. "$defaults/foo2zjs/crd/"
cp -a crd/qpdl/. "$defaults/foo2qpdl/crd/"
64 changes: 64 additions & 0 deletions elements/printer-app/hpijs.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
kind: manual
description: Build the HPLIP HPIJS driver with persistent appliance configuration.

sources:
- kind: git_repo
url: salsa:printing-team/hplip.v2.git
track: debian/3.26.4+dfsg0-3
ref: debian/3.26.4+dfsg0-3-0-gf27f786d5f1060cce7c92e42488bd5e5d00ba135

build-depends:
- freedesktop-sdk.bst:public-stacks/buildsystem-autotools.bst
- freedesktop-sdk.bst:components/python3.bst
- freedesktop-sdk.bst:components/sed.bst

depends:
- freedesktop-sdk.bst:components/jpeg.bst
- freedesktop-sdk.bst:public-stacks/runtime-gnu.bst

config:
build-commands:
- sed -i 's|"/var/lib/hp|"/var/lib/ghostscript-printer-app/hplip|g' common/utils.c common/utils.h
- sh debian/autogen.sh
- >-
./configure
--build=%{gcc-triplet}
--prefix=/usr
--enable-hpijs-only-build
--enable-hpijs-install
--disable-foomatic-rip-hplip-install
--without-docdir
--without-htmldir
--without-hpppddir
--without-drvdir
--without-icondir
--disable-hpcups-install
--disable-cups-drv-install
--disable-cups-ppd-install
--disable-foomatic-drv-install
--disable-foomatic-ppd-install
--disable-network-build
--disable-pp-build
--disable-scan-build
--disable-gui-build
--disable-fax-build
--disable-dbus-build
--disable-qt3
--disable-qt4
--disable-qt5
--disable-policykit
- make -j2 hpijs
- |
sed -i \
-e 's|^home=.*|home=/usr/share/hplip|' \
-e 's|^run=.*|run=/var/lib/ghostscript-printer-app/hplip/run|' \
-e 's|^ppd=.*|ppd=/usr/share/ppd|' \
-e 's|^ppdbase=.*|ppdbase=/usr/share/ppd|' \
-e 's|^cupsbackend=.*|cupsbackend=/usr/lib/cups/backend|' \
-e 's|^cupsfilter=.*|cupsfilter=/usr/lib/cups/filter|' \
hplip.conf
install-commands:
- install -D -m 0755 hpijs "%{install-root}/usr/bin/hpijs"
- install -d "%{install-root}/usr/share/hplip"
- install -D -m 0644 hplip.conf "%{install-root}/usr/share/ghostscript-printer-app/defaults/hplip/hplip.conf"
- mkdir -p "%{install-root}/etc/hp" && ln -s /var/lib/ghostscript-printer-app/hplip/hplip.conf "%{install-root}/etc/hp/hplip.conf"
7 changes: 4 additions & 3 deletions elements/printer-app/ijs.bst
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ public:
bst:
split-rules:
devel:
- "%{includedir}"
- "%{includedir}/**"
- "%{libdir}/libijs.so"
(>):
- "%{includedir}"
- "%{includedir}/**"
- "%{libdir}/libijs.so"

config:
build-commands:
Expand Down
16 changes: 12 additions & 4 deletions elements/printer-app/jbigkit.bst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kind: manual
description: Build the minimal JBIG85 shared library required by SpliX.
description: Build the JBIG and JBIG85 shared libraries required by legacy drivers.

sources:
- kind: git_repo
Expand All @@ -14,17 +14,25 @@ public:
bst:
split-rules:
devel:
- "%{includedir}/jbig85.h"
- "%{includedir}/jbig_ar.h"
- "%{libdir}/libjbig85.so"
(>):
- "%{includedir}/jbig85.h"
- "%{includedir}/jbig.h"
- "%{includedir}/jbig_ar.h"
- "%{libdir}/libjbig85.so"
- "%{libdir}/libjbig.so"

config:
build-commands:
- cc $CFLAGS -fPIC -Ilibjbig -c libjbig/jbig85.c -o jbig85.o
- cc $CFLAGS -fPIC -Ilibjbig -c libjbig/jbig.c -o jbig.o
- cc $CFLAGS -fPIC -Ilibjbig -c libjbig/jbig_ar.c -o jbig_ar.o
- cc $LDFLAGS -shared -Wl,-soname,libjbig85.so.0 -o libjbig85.so.0 jbig85.o jbig_ar.o
- cc $LDFLAGS -shared -Wl,-soname,libjbig.so.0 -o libjbig.so.0 jbig.o jbig_ar.o
install-commands:
- install -D -m 0644 libjbig85.so.0 "%{install-root}%{libdir}/libjbig85.so.0"
- ln -s libjbig85.so.0 "%{install-root}%{libdir}/libjbig85.so"
- install -D -m 0644 libjbig.so.0 "%{install-root}%{libdir}/libjbig.so.0"
- ln -s libjbig.so.0 "%{install-root}%{libdir}/libjbig.so"
- install -D -m 0644 libjbig/jbig85.h "%{install-root}/usr/include/jbig85.h"
- install -D -m 0644 libjbig/jbig.h "%{install-root}/usr/include/jbig.h"
- install -D -m 0644 libjbig/jbig_ar.h "%{install-root}/usr/include/jbig_ar.h"
56 changes: 56 additions & 0 deletions elements/printer-app/m2300w.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
kind: manual
description: Build the m2300w drivers with persistent color-profile paths.

sources:
- kind: git_repo
url: salsa:printing-team/m2300w.git
track: debian/0.51-15
ref: debian/0.51-15-0-gf4ebe31fe93e8f2f56ecce2f927e59bb41432d53

build-depends:
- printer-app/pyppd.bst
- freedesktop-sdk.bst:public-stacks/buildsystem-autotools.bst
- freedesktop-sdk.bst:components/cups.bst
- freedesktop-sdk.bst:components/ghostscript.bst
- freedesktop-sdk.bst:components/perl.bst

depends:
- printer-app/psutils.bst
- freedesktop-sdk.bst:components/cups-filters.bst
- freedesktop-sdk.bst:components/ghostscript.bst
- freedesktop-sdk.bst:components/python3.bst
- freedesktop-sdk.bst:components/sed.bst
- freedesktop-sdk.bst:public-stacks/runtime-gnu.bst

config:
build-commands:
- autoreconf --install
- ./configure --prefix=/usr
- make -j2
- make INSTROOT="$PWD/stage" install
- |
for wrapper in stage/usr/bin/*-wrapper; do
sed -i \
-e 's|^PREFIX=.*|PREFIX=/usr|' \
-e 's|^SHARE=.*|SHARE=/var/lib/ghostscript-printer-app/m2300w/0.51|' \
-e 's|/tmp|${TMPDIR:-/tmp}|g' \
-e 's|^$((resX\*=$RESMUL));|resX=$((resX * RESMUL))|' \
"$wrapper"
done
- rm -rf stage/usr/share/m2300w/0.51/foomatic
- |
mkdir packaged-ppd
for model in 2300 2400; do
source="stage/usr/share/cups/model/Minolta/magicolor_${model}W-m${model}w.ppd"
target="packaged-ppd/Minolta-magicolor_${model}W-m2300w.ppd"
cp "$source" "$target"
sed 's/Minolta/KONICA MINOLTA/g' "$target" > "packaged-ppd/KONICA_MINOLTA-magicolor_${model}W-m2300w.ppd"
sed -i 's/KONICA MINOLTA/Minolta/g' "$target"
done
pyppd -v -o m2300w-ppds packaged-ppd
install-commands:
- install -D -m 0755 stage/usr/bin/m2300w "%{install-root}/usr/bin/m2300w"
- install -D -m 0755 stage/usr/bin/m2400w "%{install-root}/usr/bin/m2400w"
- install -D -m 0755 stage/usr/bin/m2300w-wrapper "%{install-root}/usr/bin/m2300w-wrapper"
- install -D -m 0755 m2300w-ppds "%{install-root}/usr/share/ppd/m2300w-ppds"
- mkdir -p "%{install-root}/usr/share/ghostscript-printer-app/defaults/m2300w" && cp -a stage/usr/share/m2300w/. "%{install-root}/usr/share/ghostscript-printer-app/defaults/m2300w/"
18 changes: 18 additions & 0 deletions elements/printer-app/psutils.bst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
kind: manual
description: Build the legacy psnup helper required by stateful driver wrappers.

sources:
- kind: git_repo
url: salsa:debian/psutils.git
track: debian/1.17.dfsg-5
ref: debian/1.17.dfsg-5-0-gafa3fccb4b77165a22b783f21feac35a082d8137

build-depends:
- freedesktop-sdk.bst:public-stacks/buildsystem-make.bst

config:
build-commands:
- sed -i 's/^CFLAGS = /CFLAGS = -std=gnu89 /' Makefile.unix
- make -f Makefile.unix -j2 psnup CC=cc PAPER=a4
install-commands:
- install -D -m 0755 psnup "%{install-root}/usr/bin/psnup"
7 changes: 6 additions & 1 deletion files/container-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ if [[ -n "${PORT:-}" && ! "$PORT" =~ ^[0-9]+$ ]]; then
fi

state_dir=/var/lib/ghostscript-printer-app
mkdir -p "$state_dir/ppd" "$state_dir/spool" "$state_dir/usb" "$state_dir/cups/ssl" "$state_dir/pnm2ppa" /run/dbus /run/avahi-daemon /run/ghostscript-printer-app
mkdir -p "$state_dir/ppd" "$state_dir/spool" "$state_dir/usb" "$state_dir/cups/ssl" "$state_dir/pnm2ppa" "$state_dir/hplip/run" "$state_dir/foo2zjs" "$state_dir/m2300w" /run/dbus /run/avahi-daemon /run/ghostscript-printer-app
if [[ ! -e "$state_dir/cups/snmp.conf" ]]; then
cp /etc/cups/snmp.conf "$state_dir/cups/snmp.conf"
fi
if [[ ! -e "$state_dir/pnm2ppa/pnm2ppa.conf" ]]; then
cp /usr/share/ghostscript-printer-app/pnm2ppa.conf "$state_dir/pnm2ppa/pnm2ppa.conf"
fi
if [[ ! -e "$state_dir/hplip/hplip.conf" ]]; then
cp /usr/share/ghostscript-printer-app/defaults/hplip/hplip.conf "$state_dir/hplip/hplip.conf"
fi
cp -a --no-clobber /usr/share/ghostscript-printer-app/defaults/foo2zjs/. "$state_dir/foo2zjs/"
cp -a --no-clobber /usr/share/ghostscript-printer-app/defaults/m2300w/. "$state_dir/m2300w/"

export BACKEND_DIR=/usr/lib/ghostscript-printer-app/backend
export CUPS_SERVERBIN=/usr/lib/ghostscript-printer-app
Expand Down
Loading