.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "dpt-lib.sh 5" .TH dpt-lib.sh 5 "2023-02-24" "pkg-perl-tools 0.75" "Debian Perl packaging Tools" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" dpt\-lib.sh \-\- dpt shell library .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBdpt\-lib.sh\fR is sourced by \fBdpt\fR\|(1) and contains a collection of shell functions and variables which can be used by dpt subcommands written in shell. As a side effect, it also sanity checks if the script is run from a source package directory with a \fI.git/\fR sub directory. .SH "USAGE" .IX Header "USAGE" Source the file at the beginning of the shell script as .PP .Vb 1 \& . "$DPT_\|_SCRIPTS/lib/dpt\-lib.sh" .Ve .SH "AVAILABLE FUNCTIONS" .IX Header "AVAILABLE FUNCTIONS" .ie n .IP """die""" 4 .el .IP "\f(CWdie\fR" 4 .IX Item "die" Parameters: \f(CW$message\fR .Sp Echos \*(L"E: \f(CW$message\fR\*(R" to \s-1STDERR\s0 and exits 1. .ie n .IP """warn""" 4 .el .IP "\f(CWwarn\fR" 4 .IX Item "warn" Parameters: \f(CW$message\fR .Sp Echos \*(L"W: \f(CW$message\fR\*(R" to \s-1STDERR.\s0 .ie n .IP """info""" 4 .el .IP "\f(CWinfo\fR" 4 .IX Item "info" Parameters: \f(CW$message\fR .Sp Echos \*(L"I: \f(CW$message\fR\*(R" to \s-1STDERR.\s0 .ie n .IP """header""" 4 .el .IP "\f(CWheader\fR" 4 .IX Item "header" Parameters: \f(CW$title\fR .Sp Outputs \f(CW$title\fR with an empty line before and underlined, kind of like a header. .ie n .IP """anykey""" 4 .el .IP "\f(CWanykey\fR" 4 .IX Item "anykey" Tells the user to press any key and waits for a keypress. .ie n .IP """is_command""" 4 .el .IP "\f(CWis_command\fR" 4 .IX Item "is_command" Parameters: \f(CW$command\fR, \f(CW$package\fR (optional) .Sp Checks if \f(CW$command\fR can be executed (running \*(L"command \-v\*(R"); returns false, outputs a warning (and optionally a hint to install \f(CW$package\fR). .ie n .IP """is_installed""" 4 .el .IP "\f(CWis_installed\fR" 4 .IX Item "is_installed" Parameters: \f(CW$package_name\fR, \f(CW$minimum_package_version\fR (optional) .Sp Checks if \f(CW$package_name\fR is installed, optionally at \&\f(CW$minimum_package_version\fR, and returns false with a warning otherwise. .ie n .IP """is_pkg_perl""" 4 .el .IP "\f(CWis_pkg_perl\fR" 4 .IX Item "is_pkg_perl" Checks if debian/control contains the Debian Perl Group email address. .ie n .IP """gitddiff""" 4 .el .IP "\f(CWgitddiff\fR" 4 .IX Item "gitddiff" Offers to show the diff against the last debian/ tag, if there is any. .ie n .IP """colored""" 4 .el .IP "\f(CWcolored\fR" 4 .IX Item "colored" Parameters: \f(CW$color\fR, \f(CW$text\fR .Sp Outputs \f(CW$text\fR in \f(CW$color\fR, unless the \s-1NO_COLOR\s0 environment variable is set. .Sp Available colors are (in capital letters): \&\f(CW\*(C`BLACK\*(C'\fR, \f(CW\*(C`RED\*(C'\fR, \f(CW\*(C`GREEN\*(C'\fR, \f(CW\*(C`YELLOW\*(C'\fR, \f(CW\*(C`BLUE\*(C'\fR, \f(CW\*(C`MAGENTA\*(C'\fR, \f(CW\*(C`CYAN\*(C'\fR, \f(CW\*(C`WHITE\*(C'\fR. .ie n .IP """extra_colored""" 4 .el .IP "\f(CWextra_colored\fR" 4 .IX Item "extra_colored" Parameters: \f(CW$color\fR, \f(CW$bgcolor\fR, \f(CW$text\fR .Sp Outputs \f(CW$text\fR in foreground \f(CW$color\fR on \f(CW$bgcolor\fR, unless the \s-1NO_COLOR\s0 environment variable is set. .Sp Available colors for both foreground and background are (in capital letters): \&\f(CW\*(C`BLACK\*(C'\fR, \f(CW\*(C`RED\*(C'\fR, \f(CW\*(C`GREEN\*(C'\fR, \f(CW\*(C`YELLOW\*(C'\fR, \f(CW\*(C`BLUE\*(C'\fR, \f(CW\*(C`MAGENTA\*(C'\fR, \f(CW\*(C`CYAN\*(C'\fR, \f(CW\*(C`WHITE\*(C'\fR. .SH "AVAILABLE VARIABLES" .IX Header "AVAILABLE VARIABLES" .ie n .IP """PKG""" 4 .el .IP "\f(CWPKG\fR" 4 .IX Item "PKG" Source package name, from \fIdebian/changelog\fR. .ie n .IP """VER""" 4 .el .IP "\f(CWVER\fR" 4 .IX Item "VER" Source package version, from \fIdebian/changelog\fR. .ie n .IP """UVER""" 4 .el .IP "\f(CWUVER\fR" 4 .IX Item "UVER" Upstream version, i.e. source package version (from \fIdebian/changelog\fR) without epoch and Debian revision. .ie n .IP """DIST""" 4 .el .IP "\f(CWDIST\fR" 4 .IX Item "DIST" Source package distribution, from \fIdebian/changelog\fR. .IP "Colors" 4 .IX Item "Colors" Cf. the \f(CW\*(C`colored()\*(C'\fR function above. .Sp For using colors directly, the following variables exist; .Sp \&\f(CW\*(C`C_BLACK\*(C'\fR, \f(CW\*(C`C_RED\*(C'\fR, \f(CW\*(C`C_GREEN\*(C'\fR, \f(CW\*(C`C_YELLOW\*(C'\fR, \f(CW\*(C`C_BLUE\*(C'\fR, \f(CW\*(C`C_MAGENTA\*(C'\fR, \f(CW\*(C`C_CYAN\*(C'\fR, \f(CW\*(C`C_WHITE\*(C'\fR, plus \f(CW\*(C`C_RESET\*(C'\fR to go back from coloring. .Sp For background colors, the same colors exist as \f(CW\*(C`BG_C_foo\*(C'\fR. .SH "ENVIRONMENT VARIABLES" .IX Header "ENVIRONMENT VARIABLES" .ie n .IP """OOT""" 4 .el .IP "\f(CWOOT\fR" 4 .IX Item "OOT" \&\s-1OOT\s0 (as in \*(L"out-of-tree\*(R"), if set, disables the check if a script is run in a source package directory and a Git repository. .Sp Can be used as .Sp .Vb 1 \& OOT=1 . "$DPT_\|_SCRIPTS/lib/dpt\-lib.sh" .Ve .Sp and is useful for scripts which are run on build results etc. .Sp This also means that the variables derived from \&\fIdebian/changelog\fR are not available. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBdpt\-config\fR\|(5) for discussion of \f(CW\*(C`$DPT_\|_SCRIPTS\*(C'\fR. .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright 2022 gregor herrmann gregoa@debian.org .PP Copyright 2022 Damyan Ivanov dmn@debian.org .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.