new: port the shell, empty, makefile and go templates to manifests
Move the four templates' static file bodies into .tpl files under
data/templates/<id>/, referenced by their manifests' files: lists —
the shell skeleton script (executable, {command}-named) with its
skeleton-only debian/install mapping, the empty template's stub README,
the makefile hello.c/Makefile skeleton with its skeleton-only install
mapping, and go's go.mod/main.go skeleton (the go directive of go.mod
stays a literal: nothing about it is answer-derived).
The empty template ends up hookless — zero Rust, its registry entry
points at no hooks — and src/new/templates/empty.rs is deleted. The
shell and go hooks shrink to their probes (plus go's {go_import_path}
context value); the makefile hooks keep only the existing-tree hint
probing the packaged Makefile for a phony install: target, since that
heuristic reads the tree and cannot be data.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{name} - empty base tree scaffolded by `pkh new`; there is intentionally no upstream build system here.
|
||||
@@ -1,6 +1,9 @@
|
||||
## The `empty` template: a metapackage (non-empty Depends list) or an
|
||||
## empty base package with no build system at all — pure `dh $@` plumbing
|
||||
## as a starting point for hand-written rules.
|
||||
## as a starting point for hand-written rules. Pure data: no hooks, the
|
||||
## metapackage Depends payload travels in the wizard answers, and the
|
||||
## only upstream file is the stub README marking the tree as
|
||||
## intentionally empty.
|
||||
##
|
||||
## Schema: see src/new/templates/mod.rs.
|
||||
|
||||
@@ -11,4 +14,6 @@ detect:
|
||||
build_depends: []
|
||||
architecture: all
|
||||
rules_dh_line: "dh $@"
|
||||
files: []
|
||||
files:
|
||||
- path: README
|
||||
template: README.tpl
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module {name}
|
||||
|
||||
go 1.21
|
||||
@@ -0,0 +1,8 @@
|
||||
// Placeholder for {name}, generated by `pkh new`.
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello from {command}!")
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
## The `go` template: a Go module built through dh-golang. The logic half
|
||||
## — the go.mod module-line probe and the `{go_import_path}` value below —
|
||||
## lives in src/new/templates/go.rs.
|
||||
## lives in src/new/templates/go.rs; the skeleton bodies are static data
|
||||
## (the `go` directive of go.mod stays a literal: nothing about it is
|
||||
## answer-derived, so it has no {placeholder}).
|
||||
##
|
||||
## Schema: see src/new/templates/mod.rs.
|
||||
|
||||
@@ -15,4 +17,8 @@ architecture: any
|
||||
rules_dh_line: "dh $@ --buildsystem=golang"
|
||||
source_fields:
|
||||
XS-Go-Import-Path: "{go_import_path}"
|
||||
files: []
|
||||
files:
|
||||
- path: go.mod
|
||||
template: go.mod.tpl
|
||||
- path: main.go
|
||||
template: main.go.tpl
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
CC ?= cc
|
||||
CFLAGS ?= -O2 -Wall -Wextra
|
||||
PREFIX ?= /usr
|
||||
|
||||
all: {command}
|
||||
|
||||
{command}: hello.c
|
||||
$(CC) $(CFLAGS) -o $@ hello.c
|
||||
|
||||
install: {command}
|
||||
install -Dm755 {command} $(DESTDIR)$(PREFIX)/bin/{command}
|
||||
|
||||
clean:
|
||||
rm -f {command}
|
||||
|
||||
.PHONY: all install clean
|
||||
@@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/* Placeholder for {name}, generated by `pkh new`. */
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello from {command}!\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{command} usr/bin/{command}
|
||||
@@ -2,7 +2,11 @@
|
||||
## debhelper's makefile buildsystem runs `make` for the build and
|
||||
## `make install DESTDIR=...` when the Makefile carries an `install:`
|
||||
## target (missing targets are skipped gracefully), so plain `dh $@`
|
||||
## plumbing is enough here.
|
||||
## plumbing is enough here. The phony-install hint of
|
||||
## src/new/templates/makefile.rs (whether dh_auto_install will run
|
||||
## `make install` for an existing tree) is the only logic; the skeleton
|
||||
## bodies below are static data (the install mapping is rendered for
|
||||
## skeletons only, whose phony install target is known by construction).
|
||||
##
|
||||
## Schema: see src/new/templates/mod.rs.
|
||||
|
||||
@@ -14,4 +18,11 @@ build_depends:
|
||||
- build-essential
|
||||
architecture: any
|
||||
rules_dh_line: "dh $@"
|
||||
files: []
|
||||
files:
|
||||
- path: hello.c
|
||||
template: hello.c.tpl
|
||||
- path: Makefile
|
||||
template: Makefile.tpl
|
||||
- path: debian/install
|
||||
template: install.tpl
|
||||
skeleton_only: true
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{command}.sh usr/bin/{command}
|
||||
@@ -2,7 +2,10 @@
|
||||
## /usr/bin with plain `dh $@` plumbing. Detection is not marker-based: the
|
||||
## single-script heuristic of src/new/detect.rs (a lone *.sh or shebang
|
||||
## file) maps here. The probe pre-filling the wizard answers from the
|
||||
## script file name lives in src/new/templates/shell.rs.
|
||||
## script file name lives in src/new/templates/shell.rs; everything else
|
||||
## is the data below (the skeleton script is executable, the install
|
||||
## mapping exists for skeletons only — packaging an existing tree leaves
|
||||
## the mapping to the user).
|
||||
##
|
||||
## Schema: see src/new/templates/mod.rs.
|
||||
|
||||
@@ -13,4 +16,10 @@ detect:
|
||||
build_depends: []
|
||||
architecture: all
|
||||
rules_dh_line: "dh $@"
|
||||
files: []
|
||||
files:
|
||||
- path: "{command}.sh"
|
||||
template: script.tpl
|
||||
executable: true
|
||||
- path: debian/install
|
||||
template: install.tpl
|
||||
skeleton_only: true
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# Placeholder for {name}, generated by `pkh new`.
|
||||
echo "Hello from {command}!"
|
||||
Reference in New Issue
Block a user