diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:35:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:35:28 +0000 |
commit | ea314d2f45c40a006c0104157013ab4b857f665f (patch) | |
tree | 3ef2971cb3675c318b8d9effd987854ad3f6d3e8 /src/at/local.at | |
parent | Initial commit. (diff) | |
download | dpkg-ea314d2f45c40a006c0104157013ab4b857f665f.tar.xz dpkg-ea314d2f45c40a006c0104157013ab4b857f665f.zip |
Adding upstream version 1.22.4.upstream/1.22.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/at/local.at')
-rw-r--r-- | src/at/local.at | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/src/at/local.at b/src/at/local.at new file mode 100644 index 0000000..a49311c --- /dev/null +++ b/src/at/local.at @@ -0,0 +1,141 @@ +# 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 <debian-dpkg@lists.debian.org> +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' <<CTRL_TEMPL +$3 +CTRL_TEMPL +]) + +# DPKG_GEN_CONTROL([$pkgname]) +m4_define([DPKG_GEN_CONTROL], [ + DPKG_GEN_CTRL_FILE([$1], [control], [DPKG_TMPL_CONTROL([$1])]) +]) + +# DPKG_MOD_CONTROL([$pkgname], [$perlexpr]) +m4_define([DPKG_MOD_CONTROL], [ + $PERL -p -i -E '$2' '$1/DEBIAN/control' +]) |