# Dpkg helper macros m4_pattern_forbid([^DPKG_]) m4_pattern_allow([^DPKG_DEBUG$]) m4_pattern_allow([^DPKG_ROOT$]) m4_pattern_allow([^DPKG_ADMINDIR$]) m4_pattern_allow([^DPKG_DATADIR$]) # # Options. # m4_define([DPKG_DIR_INST], [dpkginst]) m4_define([DPKG_DIR_ADMIN], [dpkgdb]) # DPKG_OPTIONS_COMMON m4_define([DPKG_OPTIONS_COMMON], [dnl --admindir=DPKG_DIR_ADMIN dnl ]) # DPKG_DIVERT_OPTIONS m4_define([DPKG_DIVERT_OPTIONS], [dnl --instdir=DPKG_DIR_INST dnl ]) # DPKG_DIVERT(...) m4_define([DPKG_DIVERT], [dpkg-divert DPKG_OPTIONS_COMMON DPKG_DIVERT_OPTIONS]) # DPKG_DIVERT_ADD(...) m4_define([DPKG_DIVERT_ADD], [DPKG_DIVERT --add]) # DPKG_DIVERT_DEL(...) m4_define([DPKG_DIVERT_DEL], [DPKG_DIVERT --remove]) # # Macros. # # DPKG_SEQ($max) m4_define([DPKG_SEQ], [dnl m4_for([i], [1], [$1], [], [i ])dnl ]) # DPKG_CWD() m4_define([DPKG_CWD], [dnl $PERL -MCwd=realpath,getcwd -E 'say realpath(getcwd())'dnl ]) # DPKG_FILE_SIZE($filename) m4_define([DPKG_FILE_SIZE], [ $PERL -E 'say -s shift' "$1" dnl ]) # DPKG_GEN_FSYS() m4_define([DPKG_GEN_DB], [ mkdir -p DPKG_DIR_INST ]) # DPKG_GEN_FSYS_DIR([$dirname]) m4_define([DPKG_GEN_FSYS_DIR], [ mkdir -p "DPKG_DIR_INST/$1" ]) # DPKG_GEN_FSYS_FILE([$filename], [$contents]) m4_define([DPKG_GEN_FSYS_FILE], [ mkdir -p "DPKG_DIR_INST/$(dirname '$1')" AT_DATA([DPKG_DIR_INST/$1], [$2]) ]) # DPKG_GEN_FSYS_LINK([$pathname], [$target]) m4_define([DPKG_GEN_FSYS_LINK], [ ln "DPKG_DIR_INST/$1" "DPKG_DIR_INST/$2" ]) # DPKG_CHECK_FSYS_PATH_EXISTS([$pathname]) m4_define([DPKG_CHECK_FSYS_PATH_EXISTS], [ AT_CHECK([test -e "DPKG_DIR_INST/$1"]) ]) # DPKG_CHECK_FSYS_PATH_MISSING([$pathname]) m4_define([DPKG_CHECK_FSYS_PATH_MISSING], [ AT_CHECK([test -e "DPKG_DIR_INST/$1"], [1]) ]) # DPKG_MOD_FSYS_MODE([$mode], [$pathname]) m4_define([DPKG_MOD_FSYS_MODE], [ chmod $1 "DPKG_DIR_INST/$2" ]) # DPKG_TMPL_CONTROL([$pkgname]) m4_define([DPKG_TMPL_CONTROL], [Package: $1 Version: 0.0-1 Section: test Priority: extra Maintainer: Dpkg Developers Architecture: all Description: test package]) # DPKG_GEN_DB_STATUS([$contents]) m4_define([DPKG_GEN_DB_STATUS], [ mkdir -p "DPKG_DIR_ADMIN" AT_DATA([DPKG_DIR_ADMIN/status], [$1]) ]) # DPKG_GEN_DB_DIVERSIONS([$contents]) m4_define([DPKG_GEN_DB_DIVERSIONS], [ mkdir -p "DPKG_DIR_ADMIN" AT_DATA([DPKG_DIR_ADMIN/diversions], [$1]) ]) # DPKG_GEN_DB_INFO_FILE([$pkg], [$file], [$contents]) m4_define([DPKG_GEN_DB_INFO_FILE], [ mkdir -p "DPKG_DIR_ADMIN/info" AT_DATA([DPKG_DIR_ADMIN/info/$1.$2], [$3]) ]) # DPKG_MOD_DB_MODE([$mode], [$pathname]) m4_define([DPKG_MOD_DB_MODE], [ chmod $1 "DPKG_DIR_ADMIN/$2" ]) # DPKG_GEN_CTRL_FILE([$pkgname], [$file], [$contents]) m4_define([DPKG_GEN_CTRL_FILE], [ mkdir -p '$1/DEBIAN' cat >'$1/DEBIAN/$2' <