3 m4_pattern_forbid([^DPKG_])
4 m4_pattern_allow([^DPKG_DEBUG$])
5 m4_pattern_allow([^DPKG_ROOT$])
6 m4_pattern_allow([^DPKG_ADMINDIR$])
7 m4_pattern_allow([^DPKG_DATADIR$])
13 m4_define([DPKG_DIR_INST], [dpkginst])
14 m4_define([DPKG_DIR_ADMIN], [dpkgdb])
17 m4_define([DPKG_OPTIONS_COMMON], [dnl
18 --admindir=DPKG_DIR_ADMIN dnl
22 m4_define([DPKG_DIVERT_OPTIONS], [dnl
23 --instdir=DPKG_DIR_INST dnl
27 m4_define([DPKG_DIVERT],
28 [dpkg-divert DPKG_OPTIONS_COMMON DPKG_DIVERT_OPTIONS])
30 # DPKG_DIVERT_ADD(...)
31 m4_define([DPKG_DIVERT_ADD], [DPKG_DIVERT --add])
33 # DPKG_DIVERT_DEL(...)
34 m4_define([DPKG_DIVERT_DEL], [DPKG_DIVERT --remove])
41 m4_define([DPKG_SEQ], [dnl
42 m4_for([i], [1], [$1], [], [i ])dnl
46 m4_define([DPKG_CWD], [dnl
47 $PERL -MCwd=realpath,getcwd -E 'say realpath(getcwd())'dnl
50 # DPKG_FILE_SIZE($filename)
51 m4_define([DPKG_FILE_SIZE], [
52 $PERL -E 'say -s shift' "$1" dnl
56 m4_define([DPKG_AR_GEN], [
61 m4_define([DPKG_AR_LIST], [
66 m4_define([DPKG_AR_EXTRACT], [
70 # DPKG_CHECK_DIFF($file_out, $file_exp)
71 m4_define([DPKG_CHECK_DIFF], [
73 AT_CHECK([cat "$1"], [], [expout])
77 m4_define([DPKG_GEN_DB], [
78 mkdir -p DPKG_DIR_INST
81 # DPKG_GEN_FSYS_DIR([$dirname])
82 m4_define([DPKG_GEN_FSYS_DIR], [
83 mkdir -p "DPKG_DIR_INST/$1"
86 # DPKG_GEN_FSYS_FILE([$filename], [$contents])
87 m4_define([DPKG_GEN_FSYS_FILE], [
88 mkdir -p "DPKG_DIR_INST/$(dirname '$1')"
89 AT_DATA([DPKG_DIR_INST/$1], [$2])
92 # DPKG_GEN_FSYS_LINK([$pathname], [$target])
93 m4_define([DPKG_GEN_FSYS_LINK], [
94 ln "DPKG_DIR_INST/$1" "DPKG_DIR_INST/$2"
97 # DPKG_CHECK_FSYS_PATH_EXISTS([$pathname])
98 m4_define([DPKG_CHECK_FSYS_PATH_EXISTS], [
99 AT_CHECK([test -e "DPKG_DIR_INST/$1"])
102 # DPKG_CHECK_FSYS_PATH_MISSING([$pathname])
103 m4_define([DPKG_CHECK_FSYS_PATH_MISSING], [
104 AT_CHECK([test -e "DPKG_DIR_INST/$1"], [1])
107 # DPKG_MOD_FSYS_MODE([$mode], [$pathname])
108 m4_define([DPKG_MOD_FSYS_MODE], [
109 chmod $1 "DPKG_DIR_INST/$2"
112 # DPKG_TMPL_CONTROL([$pkgname])
113 m4_define([DPKG_TMPL_CONTROL],
118 Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
120 Description: test package])
122 # DPKG_GEN_DB_STATUS([$contents])
123 m4_define([DPKG_GEN_DB_STATUS], [
124 mkdir -p "DPKG_DIR_ADMIN"
125 AT_DATA([DPKG_DIR_ADMIN/status], [$1])
128 # DPKG_GEN_DB_DIVERSIONS([$contents])
129 m4_define([DPKG_GEN_DB_DIVERSIONS], [
130 mkdir -p "DPKG_DIR_ADMIN"
131 AT_DATA([DPKG_DIR_ADMIN/diversions], [$1])
134 # DPKG_GEN_DB_INFO_FILE([$pkg], [$file], [$contents])
135 m4_define([DPKG_GEN_DB_INFO_FILE], [
136 mkdir -p "DPKG_DIR_ADMIN/info"
137 AT_DATA([DPKG_DIR_ADMIN/info/$1.$2], [$3])
140 # DPKG_MOD_DB_MODE([$mode], [$pathname])
141 m4_define([DPKG_MOD_DB_MODE], [
142 chmod $1 "DPKG_DIR_ADMIN/$2"
145 # DPKG_GEN_CTRL_FILE([$pkgname], [$file], [$contents])
146 m4_define([DPKG_GEN_CTRL_FILE], [
149 cat >'$1/DEBIAN/$2' <<CTRL_TEMPL
154 # DPKG_GEN_CONTROL([$pkgname])
155 m4_define([DPKG_GEN_CONTROL], [
156 DPKG_GEN_CTRL_FILE([$1], [control], [DPKG_TMPL_CONTROL([$1])])
159 # DPKG_MOD_CONTROL([$pkgname], [$perlexpr])
160 m4_define([DPKG_MOD_CONTROL], [
161 $PERL -p -i -E '$2' '$1/DEBIAN/control'