diff -Nru debhelper-11.1.6ubuntu1/autoscripts/postinst-init debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-init --- debhelper-11.1.6ubuntu1/autoscripts/postinst-init 2018-01-20 12:20:29.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-init 2018-12-18 19:49:57.000000000 +0000 @@ -1,6 +1,6 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "/etc/init.d/#SCRIPT#" ]; then update-rc.d #SCRIPT# #INITPARMS# >/dev/null - invoke-rc.d #SCRIPT# start || #ERROR_HANDLER# + invoke-rc.d #INVOKE_RCD_PARAMS##SCRIPT# start || #ERROR_HANDLER# fi fi diff -Nru debhelper-11.1.6ubuntu1/autoscripts/postinst-initramfs-hook debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-initramfs-hook --- debhelper-11.1.6ubuntu1/autoscripts/postinst-initramfs-hook 1970-01-01 00:00:00.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-initramfs-hook 2018-09-02 07:02:06.000000000 +0000 @@ -0,0 +1,5 @@ +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + if [ -x /usr/sbin/update-initramfs ] && [ -e /etc/initramfs-tools/initramfs.conf ]; then + update-initramfs -u + fi +fi diff -Nru debhelper-11.1.6ubuntu1/autoscripts/postinst-init-restart debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-init-restart --- debhelper-11.1.6ubuntu1/autoscripts/postinst-init-restart 2018-01-20 12:20:14.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-init-restart 2018-12-18 19:49:57.000000000 +0000 @@ -6,6 +6,6 @@ else _dh_action=start fi - invoke-rc.d #SCRIPT# $_dh_action || #ERROR_HANDLER# + invoke-rc.d #INVOKE_RCD_PARAMS##SCRIPT# $_dh_action || #ERROR_HANDLER# fi fi diff -Nru debhelper-11.1.6ubuntu1/autoscripts/postinst-systemd-restart debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-systemd-restart --- debhelper-11.1.6ubuntu1/autoscripts/postinst-systemd-restart 2018-02-14 21:06:28.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-systemd-restart 2018-12-18 19:49:57.000000000 +0000 @@ -2,7 +2,7 @@ if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then - _dh_action=restart + _dh_action=#RESTART_ACTION# else _dh_action=start fi diff -Nru debhelper-11.1.6ubuntu1/autoscripts/postinst-systemd-restartnostart debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-systemd-restartnostart --- debhelper-11.1.6ubuntu1/autoscripts/postinst-systemd-restartnostart 2018-01-20 12:18:58.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-systemd-restartnostart 2018-12-18 19:49:57.000000000 +0000 @@ -2,7 +2,7 @@ if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then - deb-systemd-invoke try-restart #UNITFILES# >/dev/null || true + deb-systemd-invoke #RESTART_ACTION# #UNITFILES# >/dev/null || true fi fi fi diff -Nru debhelper-11.1.6ubuntu1/autoscripts/postinst-systemd-user-dont-enable debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-systemd-user-dont-enable --- debhelper-11.1.6ubuntu1/autoscripts/postinst-systemd-user-dont-enable 1970-01-01 00:00:00.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-systemd-user-dont-enable 2018-12-18 19:49:57.000000000 +0000 @@ -0,0 +1,15 @@ +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + if deb-systemd-helper --user debian-installed #UNITFILE# ; then + # This will only remove masks created by d-s-h on package removal. + deb-systemd-helper --user unmask #UNITFILE# >/dev/null || true + + if deb-systemd-helper --quiet --user was-enabled #UNITFILE# ; then + # Create new symlinks, if any. + deb-systemd-helper --user enable #UNITFILE# >/dev/null || true + fi + fi + + # Update the statefile to add new symlinks (if any), which need to be cleaned + # up on purge. Also remove old symlinks. + deb-systemd-helper --user update-state #UNITFILE# >/dev/null || true +fi diff -Nru debhelper-11.1.6ubuntu1/autoscripts/postinst-systemd-user-enable debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-systemd-user-enable --- debhelper-11.1.6ubuntu1/autoscripts/postinst-systemd-user-enable 1970-01-01 00:00:00.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-systemd-user-enable 2018-12-18 19:49:57.000000000 +0000 @@ -0,0 +1,15 @@ +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + # This will only remove masks created by d-s-h on package removal. + deb-systemd-helper --user unmask #UNITFILE# >/dev/null || true + + # was-enabled defaults to true, so new installations run enable. + if deb-systemd-helper --quiet --user was-enabled #UNITFILE# ; then + # Enables the unit on first installation, creates new + # symlinks on upgrades if the unit file has changed. + deb-systemd-helper --user enable #UNITFILE# >/dev/null || true + else + # Update the statefile to add new symlinks (if any), which need to be + # cleaned up on purge. Also remove old symlinks. + deb-systemd-helper --user update-state #UNITFILE# >/dev/null || true + fi +fi diff -Nru debhelper-11.1.6ubuntu1/autoscripts/postinst-usrlocal debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-usrlocal --- debhelper-11.1.6ubuntu1/autoscripts/postinst-usrlocal 2018-01-20 12:18:29.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postinst-usrlocal 2018-06-30 11:01:59.000000000 +0000 @@ -1,12 +1,25 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ]; then ( + default_mode=0755 + default_user=root + default_group=root + if [ -e /etc/staff-group-for-usr-local ]; then + default_mode=02775 + default_group=staff + fi while read line; do set -- $line dir="$1"; mode="$2"; user="$3"; group="$4" + if [ "$mode" = "default" ]; then + mode="$default_mode" + user="$default_user" + group="$default_group" + fi if [ ! -e "$dir" ]; then if mkdir "$dir" 2>/dev/null; then - chown "$user":"$group" "$dir" - chmod "$mode" "$dir" + if chown "$user":"$group" "$dir" ; then + chmod "$mode" "$dir" || true + fi fi fi done diff -Nru debhelper-11.1.6ubuntu1/autoscripts/postrm-init debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postrm-init --- debhelper-11.1.6ubuntu1/autoscripts/postrm-init 2017-07-29 18:08:37.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postrm-init 2018-12-18 19:49:57.000000000 +0000 @@ -1,10 +1,3 @@ if [ "$1" = "purge" ] ; then update-rc.d #SCRIPT# remove >/dev/null fi - - -# In case this system is running systemd, we make systemd reload the unit files -# to pick up changes. -if [ -d /run/systemd/system ] ; then - systemctl --system daemon-reload >/dev/null || true -fi diff -Nru debhelper-11.1.6ubuntu1/autoscripts/postrm-initramfs-hook debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postrm-initramfs-hook --- debhelper-11.1.6ubuntu1/autoscripts/postrm-initramfs-hook 1970-01-01 00:00:00.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postrm-initramfs-hook 2018-09-02 07:02:06.000000000 +0000 @@ -0,0 +1,5 @@ +if [ "$1" = "remove" ]; then + if [ -x /usr/sbin/update-initramfs ] && [ -e /etc/initramfs-tools/initramfs.conf ]; then + update-initramfs -u + fi +fi diff -Nru debhelper-11.1.6ubuntu1/autoscripts/postrm-systemd-user debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postrm-systemd-user --- debhelper-11.1.6ubuntu1/autoscripts/postrm-systemd-user 1970-01-01 00:00:00.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/postrm-systemd-user 2018-12-18 19:49:57.000000000 +0000 @@ -0,0 +1,12 @@ +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ] ; then + deb-systemd-helper --user mask #UNITFILES# >/dev/null || true + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ] ; then + deb-systemd-helper --user purge #UNITFILES# >/dev/null || true + deb-systemd-helper --user unmask #UNITFILES# >/dev/null || true + fi +fi diff -Nru debhelper-11.1.6ubuntu1/autoscripts/prerm-init debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/prerm-init --- debhelper-11.1.6ubuntu1/autoscripts/prerm-init 2017-07-10 18:48:25.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/prerm-init 2018-12-18 19:49:57.000000000 +0000 @@ -1,3 +1,3 @@ if [ -x "/etc/init.d/#SCRIPT#" ]; then - invoke-rc.d #SCRIPT# stop || #ERROR_HANDLER# + invoke-rc.d #INVOKE_RCD_PARAMS##SCRIPT# stop || #ERROR_HANDLER# fi diff -Nru debhelper-11.1.6ubuntu1/autoscripts/prerm-init-norestart debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/prerm-init-norestart --- debhelper-11.1.6ubuntu1/autoscripts/prerm-init-norestart 2017-07-10 18:48:25.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/autoscripts/prerm-init-norestart 2018-12-18 19:49:57.000000000 +0000 @@ -1,3 +1,3 @@ if [ -x "/etc/init.d/#SCRIPT#" ] && [ "$1" = remove ]; then - invoke-rc.d #SCRIPT# stop || #ERROR_HANDLER# + invoke-rc.d #INVOKE_RCD_PARAMS##SCRIPT# stop || #ERROR_HANDLER# fi diff -Nru debhelper-11.1.6ubuntu1/CONTRIBUTING.rst debhelper-12.1.1ubuntu1~ubuntu18.04.1/CONTRIBUTING.rst --- debhelper-11.1.6ubuntu1/CONTRIBUTING.rst 1970-01-01 00:00:00.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/CONTRIBUTING.rst 2018-12-18 19:49:57.000000000 +0000 @@ -0,0 +1,201 @@ +Contributing to debhelper +========================= + +Thanks for your interest in improving debhelper. + +No matter how you identify yourself or how others perceive you: we +welcome you. We welcome contributions from you as long as they +interact constructively with our community. See also +:ref:`code-of-conduct`. + +This document will cover what you need to get started on working with +debhelper, where to submit patches or contributions and what we expect +from contributors. + +.. contents:: + + +.. _getting-started: + +Getting started +--------------- + +This section helps you get started with working on debhelper. It +assumes you are comfortable with ``git``. + +First clone the debhelper git repository and install build-dependencies:: + + git clone https://salsa.debian.org/debian/debhelper.git + cd debhelper + apt-get build-dep ./ + # Used for running the test suite + apt-get install perl + +Running the test suite:: + + # Available from the perl package. + prove -lr -j`nproc` t + + +Doing a test build / release build of debhelper:: + + # Consider doing it in a chroot to verify that the Build-Depends are correct. + dpkg-buildpackage -us -uc + # installing it for further testing + apt-get install ../debhelper__all.deb + + +Please have a look at ``doc/PROGRAMMING``, which have guidelines for +debhelper code. + +Balancing simplicity, ease-of-use, performance, etc. +---------------------------------------------------- + +At times, there are conflicting wishes for debhelper. We cannot +satisfy all requirements and we sometimes have to say no thanks to a +particular change because it conflicts with design goal, or if it is +better suited in a different project, etc. + +Here are some guidelines that may be useful: + + * New build systems or helpers that are language/framework specific + or have a narrow scope are generally better shipped in a separate + package. If the scope becomes more general, the tooling can be + merged in to debhelper at a later stage. + + * Examples: Most ``dh-*`` packages in Debian are examples of this. + + * Changes that affect performance considerably generally must only + affect packages that need them and only affect a limited subset of + packages and a limited subset of ``dh_*``-tools. Particularly, be + careful of ``Dpkg::*``-modules, which tend to have very high load + costs. + + * Helpers / tools should generally *do the right thing* by default + (subject to backwards compatibility). If most people neeed some + particular option to make the tool work for them, then the default + should be changed (again, subject to backwards compatibility). + + +Handling backwards compatibility for consumers +---------------------------------------------- + +While changes in debhelper should avoid breaking consumers, some times +we need to implement a backwards incompatible change (e.g. to improve +defaults to match the current packaging norms or fix a bug). + + * For non-trivial breakage, we use compat bumps and migrate to the new + functionality by default in the new major version of debhelper. + (see the ``compat`` function) + + * For trivial issues or (mostly) unused functionality/bugs, then we + can make exceptions. Preferably, have all consumers migrate away + from the feature being changed (ìn Debian ``unstable``) before + applying it. + +Note that we tend to support compat levels for a long time (10+ +years). When changing behaviour via a compat bump, please take an +extra look to ensure the change is sufficient (this is easier said +than done). See ``doc/SUPPORT-POLICY`` for more information. + +Debian support baseline for debhelper +------------------------------------- + +The debhelper project aims to support the Debian ``unstable``, +``testing``, and ``stable-backports`` suites by default. For this to work, +we work based on the following guidelines: + + 1) it should be trivial to use/Build-Depend on debhelper in + ``stable-backports``, and + 2) the debhelper in ``stable-backports`` should behave the same as + in ``testing`` when backporting a package from ``testing``. + + * Note that we do not require feature/bug compatibility with + debhelper in ``stable`` (as most packages will still use + debhelper from ``stable``). + +In some cases, we can disable some *minor* functionality in +``stable-backports`` (previous cases being ``dbgsym`` and ``R³``). + +Where possible, use versioned ``Breaks`` against other packages to +make it easier to support packages in ``stable-backports`` +(e.g. debhelper had a ``Breaks`` against ``meson`` to ensure packages +used a recent enough version of ``meson`` when using the debhelper +from ``stretch-backports``). + +Submitting your contribution +---------------------------- + +We accept merge requests on https://salsa.debian.org/debian/debhelper +and in general prfer these to bug reports with patches. This is +because the merge requests will run our CI to ensure the tests still +pass. When opening a merge request, please consider allowing +committers to edit the branch as this enables us to rebase it for you. + +However, we fully respect that not everyone may want to sign up on a +Debian service (e.g. it might be a steep overhead for a one-time +contribution). Therefore, we also accepts bug reports against the +debhelper package in Debian with either patches (``git format-patch`` +format preferred) or links to public git repositories with reference +to branches. Please see :ref:`submitting-a-bug` for the guide on how +to do that. + +Please see :ref:`getting-started` for how to obtain the source code +and run the test suite. + +.. _submitting-a-bug: + +Submitting a bug report +----------------------- + +If you want to submit a bug report against debhelper, please see +https://www.debian.org/Bugs/Reporting for how to report the bug in the +Debian bug tracker (please file it against the ``debhelper`` package). + +Users of Debian can use ``reportbug debhelper`` if they have the +reportbug tool installed. + +You can find the list of open bugs against debhelper at: +https://bugs.debian.org/src:debhelper + +.. _code-of-conduct: + +Code of Conduct, Social rules and conflict resolution +----------------------------------------------------- + +The debhelper suite is a part of Debian. Accordingly, the Code of +Conduct, Social rules and conflict resolution applies to debhelper and +all of its contributors. + +As a guiding principle, we strive to have an open welcoming community +working on making Debian packaging easier. Hopefully, this will be +sufficient for most contributors. For more details, please consider +reading (some) of the documents below. + + + * `Debian's Code of Conduct `_ + + * If you feel a contributor is violating the code of contact, please + contact the `Debian anti-harassment team `_ + if you are uncomfortable with engaging with them directly. + + * `Debian's Diversity Statement `_ + + * Note that `interact constructively with our community` has the + implication that contributors extend the same acceptance and + welcome to others as they can expect from others based on the + diversity statement. + + * The rationale for this implication is based on the `Paradoc of tolerance `_. + + + * `Debian's Social Contract and Free Software Guidelines `_. + + * (very optional read) `Debian's Constitution `_. + + * The primary point of importance from this document is the + debhelper project is subject the Debian's technical committee and + the Debian General Resolution (GR) process. These + bodies/processes can make decisions that the debhelper project + must follow. Notably, the GR process is used for updating the + Debian documents above. diff -Nru debhelper-11.1.6ubuntu1/debhelper.pod debhelper-12.1.1ubuntu1~ubuntu18.04.1/debhelper.pod --- debhelper-11.1.6ubuntu1/debhelper.pod 2018-03-29 15:12:34.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/debhelper.pod 2019-01-03 20:43:12.000000000 +0000 @@ -30,8 +30,8 @@ Except where tool explicitly denotes otherwise, all of the debhelper tools assumes that they run from root directory of an unpacked source -package. This is so they can locate find F and -F when needed. +package. This is so they can locate find files like F +when needed. =head1 DEBHELPER COMMANDS @@ -78,7 +78,11 @@ Note for the first (or only) binary package listed in F, debhelper will use F when there's no -F file. +F.foo> file. However, it is often a good idea to keep +the F.> prefix as it is more explicit. The primary exception +to this are files that debhelper by default installs in every binary +package when it does not have a package prefix (such as +F or F). In some rare cases, you may want to have different versions of these files for different architectures or OSes. If files named debian/I.foo.I @@ -95,10 +99,41 @@ ignored. The syntax of these files is intentionally kept very simple to make them -easy to read, understand, and modify. If you prefer power and complexity, -you can make the file executable, and write a program that outputs -whatever content is appropriate for a given situation. When you do so, -the output is not further processed to expand wildcards or strip comments. +easy to read, understand, and modify. + +=head2 Executable debhelper config files + +If you need additional flexibility, many of the debhelper tools +(e.g. L) support executing a config file as a script. + +To use this feature, simply mark the config file as executable +(e.g. B<< chmod +x debian/I.install >>) and the tool will +attempt to execute it and use the output of the script. In many +cases, you can use L as interpreter of the config file to +retain most of the original syntax while getting the additional +flexibility you need. + + +When using executable debhelper config files, please be aware of the +following: + +=over 4 + +=item * + +The executable config file B exit with success (i.e. its return +code should indicate success). + +=item * + +The output will be used exactly as it is. Notably, debhelper will +I expand wildcards or strip comments in the output. + +=back + +If you need the package to build on a file system where you cannot +disable the executable bit, then you can use L and its +B script. =head1 SHARED DEBHELPER OPTIONS @@ -193,7 +228,7 @@ =item B<-X>I, B<--exclude=>I Exclude an item from processing. This option may be used multiple times, -to exclude more than one thing. The \fIitem\fR is typically part of a +to exclude more than one thing. The I is typically part of a filename, and any file containing the specified text will be excluded. =item B<-A>, B<--all> @@ -282,19 +317,36 @@ author gains more experience. To prevent such major changes from breaking existing packages, the concept of debhelper compatibility levels was introduced. You must tell debhelper which compatibility level it should use, and -it modifies its behavior in various ways. The compatibility level is -specified in the F file and the file must be present. - -Tell debhelper what compatibility level to use by writing a number to -F. For example, to use v#RECOMMENDED_COMPAT# mode: +it modifies its behavior in various ways. - % echo #RECOMMENDED_COMPAT# > debian/compat +In current debhelper, you can specify the compatibility level in +F by adding a Build-Depends on the debhelper-compat package. +For example, to use v#RECOMMENDED_COMPAT# mode, ensure F has: + + Build-Depends: debhelper-compat (= #RECOMMENDED_COMPAT#) + +This also serves as an appropriate versioned build dependency on a sufficient +version of the debhelper package, so you do not need to specify a separate +versioned build dependency on the debhelper package unless you need a specific +point release of debhelper (such as for the introduction of a new feature or +bugfix within a compatibility level). + +Note that debhelper does not provide debhelper-compat for experimental or beta +compatibility levels; packages experimenting with those compatibility levels +should use F or B. + +Prior versions of debhelper required specifying the compatibility level in the +file F, and current debhelper still supports this for backward +compatibility, though a package may not specify a compatibility level via +multiple methods at once. To use this method, F should contain +the compatibility level as a single number, and no other content. If you +specify the compatibility level by this method, your package will also need a +versioned build dependency on a version of the debhelper package equal to (or +greater than) the compatibility level your package uses. So, if you specify +compatibility level #RECOMMENDED_COMPAT# in F, ensure +F has: -Your package will also need a versioned build dependency on a version of -debhelper equal to (or greater than) the compatibility level your package -uses. So for compatibility level #RECOMMENDED_COMPAT#, ensure debian/control has: - - Build-Depends: debhelper (>= #RECOMMENDED_COMPAT#) + Build-Depends: debhelper (>= #RECOMMENDED_COMPAT#~) Unless otherwise indicated, all debhelper documentation assumes that you are using the most recent compatibility level, and in most cases does not @@ -489,13 +541,6 @@ =item - -B no longer creates the package build directory when skipping -running debhelper commands. This will not affect packages that only build -with debhelper commands, but it may expose bugs in commands not included in -debhelper. - -=item - - B no longer installs a maintainer-provided debian/I.shlibs file. This is now done by B instead. @@ -581,12 +626,22 @@ B<--without systemd> to B if this is not desirable for a given package. +=item - + +B: B no longer creates the package build +directory when skipping running debhelper commands. This will not +affect packages that only build with debhelper commands, but it may +expose bugs in commands not included in debhelper. + +This compatibility feature had a bug since its inception in +debhelper/9.20130516 that made it fail to apply in compat 9 and +earlier. As there has been no reports of issues caused by this bug in +those ~5 years, this item have been removed rather than fixed. + =back =item v11 -This is the recommended mode of operation. - Changes from v10 are: =over 8 @@ -619,8 +674,8 @@ =item - -The B buildsystem now passes B to L. Derivative buildsystems +The B buildsystem now passes B to L. Derivative buildsystems (e.g. B or B) are unaffected by this change. =item - @@ -692,16 +747,31 @@ =item - -The B and B tools will now attempt -to guess the "main package" for a given documentation package -(e.g. I will have I as main package if the latter -exists). If a main package is found, I of the documentation -will be installed into F<< /usr/share/doc/I >> by default as -recommended by Debian policy §12.3 since version 3.9.7. Notable -exceptions include the copyright file and changelog files. +The B and B tools may now install +I of the documentation in a different path to comply with the +recommendation from Debian policy §12.3 (since version 3.9.7). + +Note that if a given source package only contains a single binary +package in F or none of the packages are I<-doc> +packages, then this change is not relevant for that source package and +you can skip to the next change. + +By default, these tools will now attempt to determine a "main package +for the documentation" (called a I from here on) for +every I<-doc> package. If they find such a I, they +will now install the documentation into the path F<< +/usr/share/doc/I >> in the given doc package. +I.e. the path can change but the documentation is still shipped in the +I<-doc> package. The B<--doc-main-package> option can be used when the auto-detection -is insufficient. +is insufficient or to reset the path to its previous value if there is +a reason to diverge from Debian policy recommendation. + +Some documentation will not be affected by this change. These +exceptions include the copyright file, changelog files, README.Debian, +etc. These files will still be installed in the path F<< +/usr/share/doc/I >>. =item - @@ -716,7 +786,7 @@ =item v12 -This compatibility level is still open for development; use with caution. +This is the recommended mode of operation. Changes from v11 are: @@ -724,6 +794,16 @@ =item - +The B tool now generates shlibs files with versioned +dependency by default. This means that B<-VUpstream-Version> +(a.k.a. B<-V>) is now the default. + +If an unversioned dependency in the shlibs file is wanted, this can be +obtained by passing B<-VNone> instead. However, please see +L for the caveat of unversioned dependencies. + +=item - + The B<-s> (B<--same-arch>) option is removed. Please use B<-a> (B<--arch>) instead. =item - @@ -777,6 +857,90 @@ The B tool no longer compresses examples (i.e. anything installed in F</examples>>.) +=item - + +The standard sequence in B now includes B and +B by default. This makes the B and +B sequences obsolete and they will now fail with an +error. If you want to skip these commands, then please insert an +empty override target for them in F +(e.g. I) + +=item - + +The build systems B and B no longer explicitly set +the B<--libexecdir> variable and thus relies on the build system +default - which should be B (per FHS 3.0, adopted in +Debian Policy 4.1.5). + +If a particular upstream package does not use the correct default, the +parameter can often be passed manually via L. E.g. +via the following example: + + override_dh_auto_configure: + dh_auto_configure -- --libexecdir=/usr/libexec + +Note the B<--> before the B<--libexecdir> parameter. + +=item - + +The B tool no longer installs the maintainer provided +F file. The file has mostly been obsolete since +compatibility level 3, where B began to automatically +compute the resulting F control file. + +=item - + +The B tool no longer relies on B for +handling systemd services that have a sysvinit alternative. Both tools +must now be used in such a case to ensure the service is properly started +under both sysvinit and systemd. + +If you have an override for B (e.g. to call it with +B<--no-start>) then you will probably need one for +B as well now. + +This change makes B inject a I for +B<< init-system-helpers (>= 1.54~) >>. Please ensure that the package +lists B<${misc:Pre-Depends}> in its B field before +upgrading to compat 12. + +=item - + +The third-party B tool (from B package) now defaults on +honoring B variable for source installation in -dev +packages and not only during the building process. Please set +B to false to revert to the previous behaviour. See +B for details and examples. + +=item - + +B is now included in the B standard +sequence by default. + +=item - + +The B buildsystem is now removed. Please use the +third-party build system B instead. + +=back + +=item v13 + +This compatibility level is still open for development; use with caution. + +Changes from v12 are: + +=over 8 + +=item - + +The B build system now uses B instead of +B when running the test suite. Any override of +B that passes extra parameters to upstream test runner +should be reviewed as B is not command line compatible +with B. + =back =back @@ -942,7 +1106,8 @@ =item B Temporarily specifies what compatibility level debhelper should run at, -overriding any value in F. +overriding any value specified via Build-Depends on debhelper-compat or via the +F file. =item B diff -Nru debhelper-11.1.6ubuntu1/debian/changelog debhelper-12.1.1ubuntu1~ubuntu18.04.1/debian/changelog --- debhelper-11.1.6ubuntu1/debian/changelog 2018-03-30 08:01:04.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/debian/changelog 2019-05-28 09:37:25.000000000 +0000 @@ -1,3 +1,592 @@ +debhelper (12.1.1ubuntu1~ubuntu18.04.1) bionic-backports; urgency=medium + + * No-change backport to bionic + + -- Gianfranco Costamagna Tue, 28 May 2019 11:37:25 +0200 + +debhelper (12.1.1ubuntu1) eoan; urgency=medium + + * Merge from Debian testing. Remaining changes: + - Generate ddebs from debhelper instead of pkg-create-dbgsym: + + Make debhelper Conflict/Replace pkg-create-dbgsym to force it off. + + Set DBGSYM_PACKAGE_TYPE to ddeb to get correct debian/files output. + - dh_installchangelogs: Do not install upstream changelog in compat + level 7 and higher to avoid pointlessly bloating installed packages. + + -- Adam Conrad Sat, 20 Apr 2019 17:22:06 -0600 + +debhelper (12.1.1) unstable; urgency=medium + + * dh_installinitramfs: Install hooks as executable rather than + plan files. Thanks to Thorsten Glaser for the report. + (Closes: #922990) + * dh_compress: Fix bug where examples where compressed when a + doc package shipped examples for another package. Thanks to + Christian Kastner for reporting this. (Closes: #922267) + + -- Niels Thykier Sat, 23 Feb 2019 13:24:47 +0000 + +debhelper (12.1) unstable; urgency=medium + + [ Xavier Guimard ] + * dh_fixperms: add .node in mode_0644_patterns. + + [ Sylvestre Ledru ] + * dh_strip: Print a warning when an ELF binary does not have a + build-id (or when dh_strip cannot find it). + + [ Niels Thykier ] + * Dh_Lib.pm: Strip leading and trailing whitespace from lines in + regular debhelper config files. Whitespace-only lines from + executable config files are now explicitly detected and triggers + a human readable error message early rather than warnings/errors + about uninitialized variables. Thanks to Ben Finney for the + suggestion and the initial patch. (Closes: #919853) + * meson.pm: Dump "meson-logs/testlog.txt" if testing fails with + an error. Thanks to Jeremy Bicha for the suggestion. + (Closes: #918066) + * dh_missing: Clarify the documentation about when -X with other + helpers can may dh_missing ignore paths that are not installed. + Thanks to Hilko Bengen for reporting the original documentation + was unsufficient. (Closes: #917362) + * d/control: Bump Standards-Version to 4.3.0 - no changes required. + + [ Baptiste Jammet ] + * fr.po: Update French translation. (Closes: #921254) + + -- Niels Thykier Sun, 10 Feb 2019 20:33:53 +0000 + +debhelper (12ubuntu1) disco; urgency=medium + + * Merge from Debian Sid. Remaining changes: + - Generate ddebs from debhelper instead of pkg-create-dbgsym: + + Make debhelper Conflict/Replace pkg-create-dbgsym to force it off. + + Set DBGSYM_PACKAGE_TYPE to ddeb to get correct debian/files output. + - dh_installchangelogs: Do not install upstream changelog in compat + level 7 and higher to avoid pointlessly bloating installed packages. + + -- Simon Quigley Mon, 24 Dec 2018 14:29:23 -0600 + +debhelper (12) unstable; urgency=medium + + [ Niels Thykier ] + * Release debhelper/12 marking compat 12 as stable. + * dh: Special NOOP PROMISE of cli-options() to always allow skipping + the helper (as we know no option can make it change behaviour). + + [ Dmitry Shachnev ] + * dh_compress: Do not compress mkdocs search indices + (search_index.json). + + -- Niels Thykier Mon, 24 Dec 2018 13:47:55 +0000 + +debhelper (11.5.4) unstable; urgency=medium + + [ Niels Thykier ] + * Dh_Lib.pm: Reopen stdin to read from /dev/null in doit (and its sibling + functions) to prevent issues when stdin is open in write-only mode + (which is what nohup(1) does). Thanks to Julian Gilbey for reporting + the issue and providing a sample patch for it as well. + (Closes: #913663) + * fr.po: Add missing dash in "--parallel" in a translation. Thanks to + Christian Marillat for reporting the issue. (Closes: #915255) + * debhelper.7: Document that the "python-distutils" build system is + removed in compat 12. Thanks to Axel Beckert for reporting the + omission. (Closes: #915530) + + [ Luca Boccassi ] + * makefile.pm: revert passing V=0/1 to makefiles. Fixes FTBFS in apcupsd + (and possibly more). + (Closes: #914419) + + -- Niels Thykier Sat, 15 Dec 2018 19:18:47 +0000 + +debhelper (11.5.3ubuntu1) disco; urgency=medium + + * Merge from Debian testing. Remaining changes: + - Generate ddebs from debhelper instead of pkg-create-dbgsym + + Make debhelper Conflict/Replace pkg-create-dbgsym to force it off. + + Set DBGSYM_PACKAGE_TYPE to ddeb to get correct debian/files output. + - dh_installchangelogs: Do not install upstream changelog in compat + level 7 and higher to avoid pointlessly bloating installed packages. + + -- Matthias Klose Tue, 04 Dec 2018 12:21:52 +0100 + +debhelper (11.5.3) unstable; urgency=medium + + [ Helmut Grohne ] + * cmake.pm: Pass the usual CMAKE_SYSTEM_PROCESSOR for ppc64el + when cross compiling. (Closes: #913425) + + -- Niels Thykier Sat, 10 Nov 2018 21:42:12 +0000 + +debhelper (11.5.2) unstable; urgency=medium + + [ Luca Boccassi ] + * makefile.pm: Pass V=0 or V=1 to the make file depending on + whether "terse" is set in DEB_BUILD_OPTIONS. + + [ Niels Thykier ] + * dh_gconf: Mark dh_gconf as deprecated (see #908845). + * Dh_Lib.pm: Separate lowest non-deprecated compat level and + the lowest compat level we generate "debhelper-compat (= X)" + relations for. + * Dh_Lib.pm: Open compat level 13 as an experimental compat + level. + * meson.pm: In compat 13, run tests with "meson test" rather + than "ninja test". Thanks to Simon McVittie for the + suggestion. (Closes: #912560) + * dh: Correctly include dh_installsystemduser in the sequence + in compat 12. It was excluded due to an inverted boolean + meaning it was added in compat up to (and incl.) compat 11. + Thanks to Michael Biebl for reporting the issue. + (Closes: #913329) + * fr.po: Correct translations for dh_installman.1 which + incorrectly implied that dh_installman was deprecated. + Thanks to Laurent Bigonville for reporting the issue. + (Closes: #912978) + + [ Helmut Grohne ] + * cmake.pm: Pass QMAKE_EXECUTABLE when cross-building. + (Closes: #913415) + + + -- Niels Thykier Sat, 10 Nov 2018 19:51:25 +0000 + +debhelper (11.5.1) unstable; urgency=medium + + * dh_systemd_start: Fix bug introduced in debhelper/11.5 where + dh_systemd_start would fail to substitute a token in the + generated maintscript for maintainer scripts when using + "--restart-after-upgrade" (including when the option is + on by default). Thanks to Colin Watson for reporting the + bug. (Closes: #912420) + + -- Niels Thykier Wed, 31 Oct 2018 21:02:00 +0000 + +debhelper (11.5) unstable; urgency=medium + + [ Daniele Nicolodi ] + * dh_installsystemduser: New helper responsible for istalling package + maintainer supplied systemd user instance units and to produce + postinst and postrm maintiner scripts code blocks to appropriately + enable, mask and disable units when the package is installed, + upgraded, or removed. (Closes: #764678) + + [ Niels Thykier ] + * dh_installsystemd.1: Improve the documentation for --name to make + it more clear that it also changes the name of the source files in + the debian directory. Thanks to Emel Hasdal for reporting the + issue and reviewing the change. (Closes: #899983) + + -- Niels Thykier Sun, 28 Oct 2018 16:07:01 +0000 + +debhelper (11.4.1) unstable; urgency=medium + + [ Niels Thykier ] + * debhelper.pod: Quote the value of INSTALL in description of + compat level 11. Thanks to Josh Triplett for the suggestion + (Closes: #908906) + * d/changelog: Fix typos in old entries. + * dh_strip: Remove empty /usr/lib/debug directories left over + by dh_dwz. Thanks to Ferenc Wágner for reporting the issue. + (Closes: #909303) + * dh: Disable optimization to skip tools based on command-line + parameters when dh is passed long options. Since debhelper + had implicit support for auto-abbrevation of long options + and people have started to rely on it, the optimization in + debhelper/11.4 caused regressions. The optimization is + still enabled for short options. (Closes: #909704) + + [ Josh Triplett ] + * debhelper.pod: Document how to declare the debhelper compat + level via the "debhelper-compat (= X)"-method. + (Closes: #908909) + * debhelper.pod: Document that we do not provide debhelper-compat + for experimental/beta versions of compat levels. + (Closes: #908907) + * doc/PROGRAMMING: Fix typos. + + -- Niels Thykier Sun, 30 Sep 2018 15:49:38 +0000 + +debhelper (11.4) unstable; urgency=medium + + [ Niels Thykier ] + * dh_dwz.1: Remove now obsolete note in manpage claming that dh_dwz + was experimental. Since debhelper/11.3, dh_dwz was no longer + experimental. + * cmake.pm: Explicitly set CMAKE_INSTALL_LIBDIR on native builds. + This should not make any pratical difference but aligns the + behaviour of native and cross builds. Thanks to Simon McVittie + for the suggestion. (Closes: #903042) + * autoconf.pm: Leave --libexecdir at upstream default (/usr/libexec) + in compat 12 and later. (Closes: #859724) + * meson.pm: Ditto. + * dh: Support implicitly loading addons via "dh-sequence-${name}" + relations in Build-Depends (which would imply "dh ... --with ${name}"). + Only simple relations in Build-Depends are considered at the moment. + * debian/control: Provide dh-sequence-dwz, dh-sequence-installinitramfs, + and dh-sequence-systemd, which enables packages to use the new + feature to implicitly autoload dh addons via Build-Depends. + * dh_md5sums: Rewrite handling of conffiles and excludes to better + support an arbitrary number of files that should be omitted from the + md5sums file. Previously, dh_md5sums could fail with the error: + """... "/bin/sh": Argument list too long at ...""" + (Closes: #864182) + * dh_installinit.1: Correct documentation which was inaccurate in relation + to which compat levels where dh_installinit still supported systemd + items and upstart jobs. Thanks to Theodore Y. Ts'o for bring up the + issue. + * dh_installdeb: In compat 12, ignore the maintainer provided conffiles. + It has not been useful since compat 3. + * Dh_Lib.pm: isnative() now also resets $dh{VERSION} as a side-effect when + using the cache to answer the request. This is mostly useful because + it enables the following optimization. + * Dh_Lib.pm: Have isnative() special-case debian/changelog to avoid + reparsing that file over and over in the same helper. + * dh_gconf: Explicitly declare the --priority parameter with the intention + to remove it from the default debhelper options. + * dh_installemacsen: Ditto. + * dh_installgsettings: Ditto. + * dh_installudev: Ditto. + * dh_installwm: Ditto. + * Dh_Getopt.pm: Remove --priority from the list of options supported by all + debhelper tools. The only external consumer was dh_installtex from + tex-common, which was fixed in 6.10. + * dh_installinit: In compat 12, pass --skip-systemd-native to update-rc.d + to make it ignore systemd services. + * dh_installsystemd: In compat 12, avoid relying on dh_installinit's + shell snippets for starting services. (Closes: #887904, #887900) + * dh_installinit: Drop unnecessary "systemctl daemon-reload" in + auto-generated postrm script. The systemd package has a trigger for + handling sysvinit scripts and dh_installsystemd handles the requirement + for native systemd unit files. + * dh_clean: Explicitly declare the -k/--keep parameter with the intention + to remove it from the default debhelper options. + * dh_installchangelogs: Ditto. + * dh_strip: Ditto. + * Dh_Getopt.pm: Remove -k/--keep from the list of options supported by all + debhelper tools. The only external consumer was dh_gtkmodules which is now + deprecated and a "noop" command. No consumers of dh_gtkmodules appear to + pass -k/--keep to dh_gtkmodules any longer. + * dh: Rewrite command line optimization logic to enable support for a new + NOOP PROMISE for command line options. This will make dh able to skip + helpers in some cases even when passed options. (Closes: #866581) + * dh_*: Add a NOOP PROMISE for command options where applicable. + * dh: Remove old compatibility code from compat 10 that never worked. + * Dh_Getopt.pm: Fix a bug that would make "-S" be interpreted as "-s" when + "-S" was not given an argument. + * debian/control: Bump Standards-Versions to 4.2.1 - no changes required. + * debhelper.pod: Declare compat 12 in beta testing. + + [ Juhani Numminen ] + * dh_installsystemd.1: Fix typo in manpage. + * dh_installinit.1: Ditto. + + [ Fabian Wolff ] + * dh_installdocs.1: Fix typo. + * dh_link.1: Ditto. + + [ Nicholas Guriev ] + * cmake.pm, autoconf.pm: honor QUIET setting (closes: #907738). + * Dh_Lib.pm: use terse build option to set QUIET setting (closes: #907595). + + [ Clément Hermann ] + * debhelper.pod: Document dh_golang's DH_GOLANG_EXCLUDES behaviour change + for compat 12 (closes: #908656) + + -- Niels Thykier Fri, 14 Sep 2018 20:56:55 +0000 + +debhelper (11.3.5) unstable; urgency=medium + + * Dh_Lib.pm: Introduce a new glob_expand error handler to + better emulate the old style glob code to fail when a + non-glob entry in the config file is missing. + * dh_installdocs: Use the new glob_expand error handler to + restore the behaviour to that of debhelper/10.5.1 and older. + Thanks to Christoph Berg for reporting the issue. + (Closes: #902355) + * dh_installexamples: Ditto. + * dh_installinfo: Ditto. + * dh_installman: Ditto. + * Dh_Lib.pm: Fix a bug where ending debian/control on (what + debhelper believed was) a comment line could cause debhelper + to omit the last package listed in the file. Thanks to + Santiago Vila for reporting the bug. (Closes: #902748) + + -- Niels Thykier Sat, 30 Jun 2018 11:52:51 +0000 + +debhelper (11.3.4) unstable; urgency=medium + + * Dh_Lib.pm: Fix bug that made the parser assign the wrong + value from the Build-Profiles field. Thanks to Sven Joachim + for reporting the bug. (Closes: #902268) + * debhelper.pod: Rewrite the compat 11 change on "main doc + packages" in an attempt to clarify what is happening in + compat 11. Thanks to Paul Gevers for pointing out some of + the confusing aspects. + + -- Niels Thykier Sun, 24 Jun 2018 09:46:35 +0000 + +debhelper (11.3.3) unstable; urgency=medium + + [ Niels Thykier ] + * d/control: Remove versioned Breaks on qt5-qmake as it + prevents others from backporting qt5 packages to + stable-backports. The Breaks was added to assist + cross-building in buster and it has already served that + purpose by now. + * Dh_Lib.pm: Provide a more helpful diagnostic message when + an executable config file fails and it does not have a + #!-line (and is not an ELF binary). Thanks to Nadav + Ruskin for the suggestion. (Closes: #902214) + * debhelper.pod: Make a dedicated subsection about executable + debhelper config files to make them more prominent. Thanks + to Nadav Ruskin for the suggestion. (Closes: #901715) + * Dh_Lib.pm: Avoid forking a shell when running executable + debhelper config files. + * Dh_Lib.pm: Validate package names according the rules for + Debian packages. Thanks to Raphael Geissert and Tim + Düsterhus for the suggestion. (Closes: #567178) + * Dh_Lib.pm: Rewrite deb822 parser to validate d/control + more strictly. Particularly, debhelper no longer permits + the same field twice in a stanza. Thanks to Tim Düsterhus + for the suggestion. + * Dh_Lib.pm: Ensure that at most once definition of + (X-)Package-Type is used per stanza. + + [ Roberto C. Sánchez ] + * cmake.pm: Reorder arguments to cmake to make "-D FOO=BAR" + work. This form only works if it is before the directory + passed to cmake. + + [ Daniele Nicolodi ] + * dh_installsystemd: Improve man page. + * dh_installsystemd: Tighten error handling: fail immediately if an unit + name not installed by the package is specified on the command line. + * dh_installsystemd: Fix the undocumented '--no-also' command line + option to do not affect handling of the Alias= directives. + * dh_installsystemd: Add timer units to the list of units considered + when the '--name' option is specified. + + -- Niels Thykier Sat, 23 Jun 2018 18:30:08 +0000 + +debhelper (11.3.2ubuntu1) cosmic; urgency=medium + + * Merge from Debian testing. Remaining changes: + - Generate ddebs from debhelper instead of pkg-create-dbgsym + + Make debhelper Conflict/Replace pkg-create-dbgsym to force it off. + + Set DBGSYM_PACKAGE_TYPE to ddeb to get correct debian/files output. + - dh_installchangelogs: Do not install upstream changelog in compat + level 7 and higher to avoid pointlessly bloating installed packages. + + -- Adam Conrad Thu, 07 Jun 2018 18:25:31 -0600 + +debhelper (11.3.2) unstable; urgency=medium + + * dh_installchangelogs: Fix a second regression that made + dh_installchangelogs ignore upstream changelogs in the + source directories. Thanks to gregor herrmann for + reporting the imcomplete fix. (Closes: #899248) + + -- Niels Thykier Wed, 23 May 2018 05:59:59 +0000 + +debhelper (11.3.1) unstable; urgency=medium + + * dh_installchangelogs: Fix logic error that made + dh_installchangelogs incorrectly ignore explicitly passed + changelogs. Thanks to Sven Joachim and Rene Engelhard + for reporting the bug. (Closes: #899248) + + -- Niels Thykier Mon, 21 May 2018 20:02:32 +0000 + +debhelper (11.3) unstable; urgency=medium + + [ Niels Thykier ] + * Buildsystem.pm: Fix use of undefined variable in certain + error conditions. + * dh_makeshlibs: Support -VUpstream-Version and -VNone as + alternative to passing -V or omitting -V respectively. + * dh_makeshlibs: Make -VUpstream-Version the default in + compat 12 when -V is omitted. (Closes: #896464) + * dh_makeshlibs: Correct handling of an explicit -V when + a source builds multiple library packages and provides + explicit shlibs files for a subset of them. Previously, + the -V option could have been ignored for some of the + packages containing libraries. + * Dh_Lib.pm: Fall back to a regular mv(1) when rename fails + with EXDEV (cross mount point moves). This restores + debhelper's ability to move files between mount points, + which can happen in dh_builddeb has to correct the + extension of a binary package built by dpkg-deb. + Thanks to Evan Krall for the report. (Closes: #897569) + * dh_missing.1: Consistently mention that dh_missing + defaults to --list-missing in compat 12. Thanks to + Robie Basak for spotting the contradicting documentation. + (Closes: #898161) + * dh_compress: Avoid adding a duplicate ".gz" extension on + a symlink if it already has it. This can happen e.g. with + dh_installman recompresses a manpage that was compressed and + had a valid symlink to it. Thanks to Andreas Hasenack for + reporting the bug. (Closes: LP: #1765851) + * debian/control: Depend on dwz for dh_dwz. + * dh_dwz: Generate a per-package multifile by default. This + feature can be disabled by --no-dwz-multifile. + * dh: Run dh_dwz by default in compat 12. + * dh_dwz: Remove warning about the dwz feature being experimental. + * dwz.pm: Ditto. + * dh_installsystemd: Use the basename of the "tmpfiles" config + files. This makes "systemd-tmpfiles --create" search for it + in both /usr/lib/tmpfiles.d and in /etc/tmpfiles.d. With + this change the system administrator can now override the + "tmpfiles" config shipped by the package in + /usr/libtmpfiles.d. Thanks to Nick Groenen and Seyeong Kim + for filing the bug. (Closes: #894510) + * dh_installinit: Ditto. + * dh_installchangelogs: Look for changelog files installed by the + upstream build system in the package build dir (i.e. d// + and *not* debian/tmp!) and use them in preference to the one in the + source package where available. This avoids some cases of duplicated + upstream changelogs. Thanks to Evgeni Golov for the suggestion. + (Closes: #513521) + * dh_md5sums: Stop deleting empty md5sums files as dpkg (now) creates + the empty file on install if absent. Thanks to Rhonda D'Vine for + suggesting the improvement. (Closes: #776853) + * Dh_Lib.pm: Re-organise exports. + * Dh_Lib.pm: Retract "print_and_complex_doit"; the only potential + consumer went with a different code snippet. + * dh_installinitramfs: New tool to install initramfs hook scripts and + handle related maintscripts. Thanks to Evgeni Golov for the + suggestion. (Closes: #491027) + * installinitramfs.pm: New sequence to enable dh_installinitramfs in + compat 11 and earlier. + * dh_installdirs: Add --(no-)create-in-sourcedir option to make + dh_installdirs create directories in the source directory in addition + in the package build directory. Furthermore, dh_installdirs now + accepts --sourcedir to overrule the default source directory (just + like e.g. dh_install). Thanks to Robert Luberda for the suggestion. + (Closes: #816332) + * Buildsystem.pm: Move code from Dh_Buildsystems.pm to Buildsystem.pm + to make the latter independent of the former. This makes it possible + to load Buildsystem.pm without debian/control being present. Thanks + to Andreas Tille for the bug report. (Closes: #897026) + * dh_installinit.1: Fix some incorrect markup in the documentation of + --no-enable. + * makefile.pm: Revert the use of -O/-Oline for make, which helps + debugging what commands time out on the buildds. Thanks to + Adrian Bunk for the report. (Closes: #895196) + * dh_testroot.1: Update R³ documentation to reflect the current + implementation and not the initial draft. Thanks to Jens Reyer + for reporting the inconsistency. (Closes: #899125) + * d/changelog: Retroactively add Closes for LP bug #1766102 in 11.2 + release. + * Dh_Lib.pm: Correct control parser to permit zero or more leading + space after the "Section" field (instead of "exactly one" space). + * python_distutils.pm: Deprecate the python-distutils build system + and mark it as removed in compat 12. Users are recommended to + migrate to the third-party build system called "pybuild". This + deprecation implies that python3 (among other) will not be + supported in the python-distutils build system. + (Closes: #568033, #597105, #597342, #769840, #813686, #898347) + * Dh_Lib.pm: Remove warning for using "debhelper-compat" + build-dependency. + + [ Dmitry Shachnev ] + * qmake.pm: Use ${DEB_HOST_GNU_TYPE}-qmake wrapper for + cross-compilation. (Closes: #895286) + + [ Helmut Grohne ] + * cmake: Pass CC/CXX environment variables down during native + compilation as well. (Closes: #897083) + + [ Chris Lamb ] + * dh_listpackages.1: Document that packages are listed in the + order that they appear in debian/control. + (Closes: #897949) + + [ Peter Pentchev ] + * Dh_Lib: Permit leading and trailing whitespace around the + debhelper-compat dependency when it is the first or the last + relation listed. (Closes: #897937) + + [ Jakub Wilk ] + * dh_usrlocal: Fix invalid POD markup. + + -- Niels Thykier Sun, 20 May 2018 20:35:00 +0000 + +debhelper (11.2.1ubuntu1) cosmic; urgency=medium + + * Merge from Debian unstable. Remaining changes: + - Generate ddebs from debhelper instead of pkg-create-dbgsym + + Make debhelper Conflict/Replace pkg-create-dbgsym to force it off. + + Set DBGSYM_PACKAGE_TYPE to ddeb to get correct debian/files output. + - dh_installchangelogs: Do not install upstream changelog in compat + level 7 and higher to avoid pointlessly bloating installed packages. + + -- Adam Conrad Wed, 02 May 2018 06:53:25 -0600 + +debhelper (11.2.1) unstable; urgency=medium + + * Buildsystem.pm: Correctly pass build directory values to + target buildsystems. Thanks to Helmut Grohne, Adrian Bunk + and Tobias Frost for the reports and debugging. + (Closes: #895174, #895181) + * Buildsystems: Avoid choosing a build system for the clean + step if it is not necessary. Previously, debhelper could + choose a "random" build system that would prefer building + in a separate build directory on the basis that the build + directory should be removed. With this, change we only + choose such a build system if there is a build directory + to remove. + + -- Niels Thykier Sun, 08 Apr 2018 08:47:35 +0000 + +debhelper (11.2) unstable; urgency=medium + + [ Niels Thykier ] + * debhelper.7: Add a ~ to the suggested Build-Depends to ensure + backports also work for debhelper with single integer versions. + Thanks to Trent W. Buck for the suggestion. (Closes: #894666) + * makefile.pm: Use -Oline with make. This avoids make mistaking + a target name for a value for -O and should make build time + outs less likely for "long" targets. (Closes: #894573) + * Dh_Lib.pm: Fix bug that make debhelper trip on packages with + the version "0". Thanks to Chris Lamb for reporting the bug + plus debugging the issue. (Closes: #894895, LP: #1766102) + * Buildsystem.pm: Rewrite to support build systems that generate + build files for another build system (without using + inheritance). This enables generator build systems to have + multiple backends. + * cmake.pm: Support ninja as alternative backend (by using the + build system cmake+ninja). Thanks to Kyle Edwards for the + suggestion. (Closes: #895044) + * meson.pm: Rewrite as a generator build system with ninja as + the only backend. + * debhelper.7: Recommend packagers to use "debian/." + over "debian/" in most cases. Thanks to Johannes + Schauer for the suggestion. + * dh_usrlocal: Implement a simple guard for directories that + will likely cause issues in the shell snippets. + * dh_usrlocal: Use the new rules from Debian Policy 4.1.4 to + determine the default ownership and mode for directories. + * d/control: Bump Standards-Versions to 4.1.4. Beyond the + dh_usrlocal change listed above, no changes were required. + + [ Nicolas Boulenguez ] + * dh_installxfonts: Fix typo that causes a misc:Depends on + non-existing xfont-utils. (Closes: #894835) + * dh_installwm.1: Document --all. (Closes: #895011) + * dh_usrlocal: Fix bug where the generated prerm script generated + by dh_usrlocal could remove a directory directly in /usr/local. + (Closes: #894549) + + [ Mattia Rizzolo ] + * Lower the version restrictions on dpkg and dpkg-dev. They are not + needed anymore, as R³ support is not implied anymore, but requires + an environment variable to be passed. + + -- Niels Thykier Sat, 07 Apr 2018 19:23:32 +0000 + debhelper (11.1.6ubuntu1) bionic; urgency=medium * Merge from Debian unstable. Remaining changes: @@ -1180,7 +1769,7 @@ * Dh_Lib.pm: Emulate "install -d" with File::Path to avoid a fork+exec for creating directories. For simplicity, the verbose output still claim debhelper uses "install -d" for this. - * dh_auto_install: In compat 11, do noot create package build + * dh_auto_install: In compat 11, do not create package build directories (except if one of them happens to be the default "destdir" for dh_auto_install). diff -Nru debhelper-11.1.6ubuntu1/debian/control debhelper-12.1.1ubuntu1~ubuntu18.04.1/debian/control --- debhelper-11.1.6ubuntu1/debian/control 2018-03-30 08:00:57.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/debian/control 2019-04-20 23:21:58.000000000 +0000 @@ -4,12 +4,11 @@ Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debhelper Maintainers Uploaders: Niels Thykier , -Build-Depends: dpkg (>= 1.19.0.5~), - dpkg-dev (>= 1.19.0.5~), +Build-Depends: dpkg-dev (>= 1.18.0~), perl:any, po4a, Rules-Requires-Root: no -Standards-Version: 4.1.3 +Standards-Version: 4.3.0 Testsuite: autopkgtest-pkg-perl Vcs-Git: https://salsa.debian.org/debian/debhelper.git Vcs-Browser: https://salsa.debian.org/debian/debhelper @@ -26,15 +25,12 @@ # without several bugs. The constraint can be relaxed if an older # version is sufficient. dh-strip-nondeterminism (>= 0.028~), -# Rules-Requires-Root support. Otherwise it stops at 1.18.0/1.18.2 for dbgsym support. - dpkg (>= 1.19.0.5~), - dpkg-dev (>= 1.19.0.5~), +# dbgsym support landed in 1.18.0, 1.18.2 fixes a related nasty bug. + dpkg (>= 1.18.0~), + dpkg-dev (>= 1.18.2~), + dwz, file (>= 3.23), libdpkg-perl (>= 1.17.14), -# makefile.pm uses -O which according to #768791 requires make (>= 4~). -# The -O is an aid to maintainers, debhelper works perfectly fine without it. -# (commented to avoid issues with make-guile, #892586) -# make (>= 4~), man-db, po-debconf, ${misc:Depends}, @@ -46,10 +42,17 @@ cmake (<< 3.9~), # meson build system uses --wrap-mode, which requires meson (>= 0.40.0) meson (<< 0.40.0~), +# Re-add if qt5-qmake is added to stretch-backports +# The qmake cross wrapper was introduced in 5.9.2+dfsg-5, but got some important +# fixes in the subsequent uploads. It is only needed for cross-building. +# qt5-qmake (<< 5.9.2+dfsg-8), Replaces: dh-systemd (<< 1.38), pkg-create-dbgsym Conflicts: pkg-create-dbgsym -Suggests: dh-make, dwz -Provides: ${dh:CompatLevels} +Suggests: dh-make +Provides: ${dh:CompatLevels}, + dh-sequence-dwz, + dh-sequence-installinitramfs, + dh-sequence-systemd, Multi-Arch: foreign Description: helper programs for debian/rules A collection of programs that can be used in a debian/rules file to diff -Nru debhelper-11.1.6ubuntu1/debian/gen-provides debhelper-12.1.1ubuntu1~ubuntu18.04.1/debian/gen-provides --- debhelper-11.1.6ubuntu1/debian/gen-provides 2018-02-25 09:46:44.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/debian/gen-provides 2018-12-18 19:49:57.000000000 +0000 @@ -9,7 +9,7 @@ my $version = $Debian::Debhelper::Dh_Version::version; $version =~ s/~.*//; # Drop backports marker $version =~ s/^\d+\K\..*//; -for (my $i = Debian::Debhelper::Dh_Lib::LOWEST_NON_DEPRECATED_COMPAT_LEVEL ; $i <= $version ; $i++) { +for (my $i = Debian::Debhelper::Dh_Lib::LOWEST_VIRTUAL_DEBHELPER_COMPAT_LEVEL ; $i <= $version ; $i++) { push(@provides, "debhelper-compat (= $i)"); } print "dh:CompatLevels=" . join(", ", @provides) . "\n"; diff -Nru debhelper-11.1.6ubuntu1/dh debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh --- debhelper-11.1.6ubuntu1/dh 2018-03-07 21:10:22.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh 2019-01-03 20:43:12.000000000 +0000 @@ -8,6 +8,9 @@ use strict; use warnings; +use constant { + 'UNSKIPPABLE_CLI_OPTIONS_BUILD_SYSTEM' => q(-S|--buildsystem|-D|--sourcedirectory|-B|--builddirectory), +}; use Debian::Debhelper::Dh_Lib; use Debian::Debhelper::SequencerUtil; @@ -55,6 +58,16 @@ debhelper commands. See the F file for documentation about the sequence addon interface. +A B relation on the package BI +implies a B<--with> I. This avoids the need for an explicit +B<--with> in F that only duplicates what is already +declared via the build dependencies in F. Note that +only relations in the B field are considered +(i.e. B and B are +deliberately unsupported). Please keep in mind that B insists on +"simple" relations (e.g. a relation like "BI | +B" will I imply B<--with> I). + =item B<--without> I The inverse of B<--with>, disables using the given addon. This option @@ -102,10 +115,10 @@ #!/usr/bin/make -f %: dh $@ - + override_dh_strip: dh_strip -Xfoo - + override_dh_auto_configure: dh_auto_configure -- --with-foo --disable-bar @@ -186,7 +199,7 @@ #!/usr/bin/make -f %: dh $@ - + # Commands not to run: override_dh_auto_test override_dh_compress override_dh_fixperms: @@ -197,7 +210,7 @@ #!/usr/bin/make -f %: dh $@ - + override_dh_auto_build-indep: $(MAKE) -C docs @@ -259,7 +272,7 @@ =head1 DEPRECATED OPTIONS -The following options are deprecated. It's much +The following options are deprecated. It's much better to use override targets instead. They are B available in compat 10. @@ -292,40 +305,27 @@ # Stash this away before init modifies it. my @ARGV_orig=@ARGV; - -if (not compat(9, 1)) { - # Enable autoreconf'ing by default in compat 10 or later. Use the - # sequence add-on so existing --without=autoreconf - unshift(@ARGV, "--with=autoreconf"); - # Enable systemd support by default in compat 10 or later. - # - compat 11 injects the dh_installsystemd tool directly in the - # sequence instead of using a --with sequence. - unshift(@ARGV, "--with=systemd") if compat(10, 1); - unshift(@ARGV, "--with=build-stamp"); -} - -push(@{$dh{WITH}},split(",", $ENV{DH_EXTRA_ADDONS})) if $ENV{DH_EXTRA_ADDONS}; +my (@addons, @addon_requests); inhibit_log(); - + init(options => { "until=s" => \$dh{UNTIL}, "after=s" => \$dh{AFTER}, "before=s" => \$dh{BEFORE}, "remaining" => \$dh{REMAINING}, "with=s" => sub { - my ($option,$value)=@_; - push @{$dh{WITH}},split(",", $value); + my ($option, $value) = @_; + push(@addon_requests, map { "+${_}" } split(",", $value)); }, "without=s" => sub { - my ($option,$value)=@_; - my %without = map { $_ => 1 } split(",", $value); - @{$dh{WITH}} = grep { ! $without{$_} } @{$dh{WITH}}; + my ($option, $value) = @_; + push(@addon_requests, map { "-${_}" } split(",", $value)); }, "l" => \&list_addons, "list" => \&list_addons, }, - # Disable complaints about unknown options; they are passed on to + # Disable complaints about unknown options; they are passed on to # the debhelper commands. ignore_unknown_options => 1, # Bundling does not work well since there are unknown options. @@ -405,6 +405,7 @@ dh_installinit }, (!compat(10) ? qw(dh_installsystemd) : qw()), + (!compat(11) ? qw(dh_installsystemduser) : qw()), qw{ dh_installmenu @@ -416,6 +417,9 @@ dh_installppp dh_installudev dh_installgsettings +}, + (!compat(11) ? qw(dh_installinitramfs) : qw()), +qw{ dh_bugfiles dh_ucf dh_lintian @@ -432,11 +436,13 @@ dh_fixperms dh_missing }); -my @ba=qw{ +my @ba=( + (!compat(11) ? qw(dh_dwz) : qw()), +qw{ dh_strip dh_makeshlibs dh_shlibdeps -}; +}); if (! getpackages("arch")) { @ba=(); } @@ -494,7 +500,7 @@ foreach my $sequence (keys %sequences) { $sequences{$sequence}=[grep { $_ ne $command } @{$sequences{$sequence}}]; } - + } sub add_command { my ($command, $sequence) = @_; @@ -548,8 +554,60 @@ exit 0; } +sub _compute_addons { + my (@addon_requests_from_args) = @_; + my (@enabled_addons, %disabled_addons, %enabled); + my @addon_requests; + + # Order is important; DH_EXTRA_ADDONS must come before everything + # else; then comes built-in and finally argument provided add-ons + # requests. + push(@addon_requests, map { "+${_}" } split(",", $ENV{DH_EXTRA_ADDONS})) + if $ENV{DH_EXTRA_ADDONS}; + if (not compat(9, 1)) { + # Enable autoreconf'ing by default in compat 10 or later. + push(@addon_requests, '+autoreconf'); + + # Enable systemd support by default in compat 10 or later. + # - compat 11 injects the dh_installsystemd tool directly in the + # sequence instead of using a --with sequence. + push(@addon_requests, '+systemd') if compat(10, 1); + push(@addon_requests, '+build-stamp'); + } + push(@addon_requests, map { "+${_}" } Debian::Debhelper::Dh_Lib::bd_dh_sequences()); + push(@addon_requests, @addon_requests_from_args); + + # Removing disabled add-ons are expensive (O(N) per time), so we + # attempt to make removals in bulk. Note that we have to be order + # preserving (due to #885580), so there is a limit to how "smart" + # we can be. + my $flush_disable_cache = sub { + @enabled_addons = grep { not exists($disabled_addons{$_}) } @enabled_addons; + for my $addon (keys(%disabled_addons)) { + delete($enabled{$addon}); + } + %disabled_addons = (); + }; + + for my $request (@addon_requests) { + if ($request =~ s/^[+]//) { + $flush_disable_cache->() if %disabled_addons; + push(@enabled_addons, $request) if not $enabled{$request}++; + } elsif ($request =~ s/^-//) { + $disabled_addons{$request} = 1; + } else { + error("Internal error: Invalid add-on request: $request (Missing +/- prefix)"); + } + } + + $flush_disable_cache->() if %disabled_addons; + return @enabled_addons; +} + +@addons = _compute_addons(@addon_requests); + # Load addons, which can modify sequences. -foreach my $addon (@{$dh{WITH}}) { +foreach my $addon (@addons) { my $mod="Debian::Debhelper::Sequence::$addon"; $mod=~s/-/_/g; eval "use $mod"; @@ -586,9 +644,9 @@ # Get the options to pass to commands in the sequence. # Filter out options intended only for this program. -my @options; -my $user_specified_options=0; -my $build_system_options = 0; +my (@options, %seen_options); +my ($unoptimizable_user_option, $long_options_seen) = (0, 0); + if ($sequence eq 'build-arch' || $sequence eq 'install-arch' || $sequence eq 'binary-arch') { @@ -614,6 +672,7 @@ next; } elsif ($opt=~/^-/) { + my $optname = $opt; if (not @options and $opt eq '--parallel' or $opt eq '--no-parallel') { my $max_parallel; # Ignore the option if it is the default for the given @@ -627,17 +686,21 @@ $max_parallel = get_buildoption('parallel') // 1; next if $max_parallel == 1; } + if ($opt =~ m/^(--[^=]++)(?:=.*)?$/ or $opt =~ m/^(-[^-])$/) { + my $optname = $1; + $long_options_seen = 1 if length($optname) > 2; + $seen_options{$optname} = 1; + } else { + $unoptimizable_user_option = 1; + } push @options, "-O".$opt; - $build_system_options = 1 if $opt ne '--no-parallel' and $opt ne '--parallel'; - $user_specified_options=1 - unless $opt =~ /^--((?:no-)?parallel|buildsystem|sourcedirectory|builddirectory|)/; } elsif (@options) { - $user_specified_options=1; if ($options[$#options]=~/^-O--/) { $options[$#options].="=".$opt; } else { + $unoptimizable_user_option = 1; $options[$#options].=$opt; } } @@ -802,7 +865,7 @@ close($fd) or error("close($stamp_file) failed: $!"); next; } - + # Check for override targets in debian/rules, and run instead of # the usual command. (The non-arch-specific override is tried first, # for simplest semantics; mixing it with arch-specific overrides @@ -813,20 +876,7 @@ } next unless @todo; - if (can_skip($command, @todo) && ! $dh{NO_ACT}) { - # This mkdir is to avoid skipping the command causing - # breakage if some later command assumed that the - # command ran, and created the tmpdir, as a side effect. - # No commands in debhelper should make such an assuption, - # but there may be third party commands or other things - # in the rules file that does. - if (! compat(10)) { - foreach my $package (@todo) { - mkdir(tmpdir($package)); - } - } - next; - } + next if can_skip($command, @todo); # No need to run the command for any packages handled by the # override targets. @@ -983,7 +1033,9 @@ sub can_skip { my ($command, @packages) = @_; - return 0 if $user_specified_options || + return 0 if $dh{NO_ACT} and not $ENV{DH_INTERNAL_TEST_CAN_SKIP}; + + return 0 if $unoptimizable_user_option || (exists $ENV{DH_OPTIONS} && length $ENV{DH_OPTIONS}); return 0 if exists($command_opts{$command}) @@ -995,7 +1047,7 @@ my @skipinfo=@{$skipinfo{$command}}; return 0 unless @skipinfo; return 1 if scalar(@skipinfo) == 1 and $skipinfo[0] eq 'always-skip'; - my $all_pkgs; + my ($all_pkgs, $had_cli_options); foreach my $skipinfo (@skipinfo) { if ($skipinfo=~/^([a-zA-Z0-9-_]+)\((.*)\)$/) { @@ -1010,16 +1062,28 @@ my $pkgs; if ($type eq 'pkgfile') { $pkgs = \@packages; - } else { - $all_pkgs //= [getpackages()]; + } + else { + $all_pkgs //= [ getpackages() ]; $pkgs = $all_pkgs; } # Use the secret bulk check call return 0 if pkgfile($pkgs, $need) ne ''; + } elsif ($type eq 'cli-options') { + $had_cli_options = 1; + # If cli-options is empty, we no the helper does not + # react to any thing and can always be skipped. + next if $need =~ m/^\s*$/; + # Long options are subject to abbreviations so it is + # very difficult to implement this optimization with + # long options. + return 0 if $long_options_seen; + $need =~ s/(?:^|\s)BUILDSYSTEM(?:\s|$)/${\UNSKIPPABLE_CLI_OPTIONS_BUILD_SYSTEM}/; + my @behavior_options = split(qr/\Q|\E/, $need); + for my $opt (@behavior_options) { + return 0 if exists($seen_options{$opt}); + } } elsif ($type eq 'buildsystem') { - # If there are any buildsystem options, we assume that - # the build needs a buildsystem. - return 0 if $build_system_options; require Debian::Debhelper::Dh_Buildsystems; my $system = Debian::Debhelper::Dh_Buildsystems::load_buildsystem(undef, $need); return 0 if defined($system); @@ -1032,6 +1096,7 @@ return 0 if pkgfile(\@packages, $skipinfo) ne ''; } } + return 0 if not $had_cli_options and %seen_options; return 1; } diff -Nru debhelper-11.1.6ubuntu1/dh_auto_build debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_auto_build --- debhelper-11.1.6ubuntu1/dh_auto_build 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_auto_build 2018-12-18 19:49:57.000000000 +0000 @@ -45,7 +45,7 @@ =cut -# PROMISE: DH NOOP WITHOUT buildsystem(build) +# PROMISE: DH NOOP WITHOUT cli-options(BUILDSYSTEM) buildsystem(build) buildsystems_init(); buildsystems_do(); diff -Nru debhelper-11.1.6ubuntu1/dh_auto_clean debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_auto_clean --- debhelper-11.1.6ubuntu1/dh_auto_clean 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_auto_clean 2018-12-18 19:49:57.000000000 +0000 @@ -46,7 +46,7 @@ =cut -# PROMISE: DH NOOP WITHOUT buildsystem(clean) +# PROMISE: DH NOOP WITHOUT cli-options(BUILDSYSTEM) buildsystem(clean) inhibit_log(); buildsystems_init(); diff -Nru debhelper-11.1.6ubuntu1/dh_auto_configure debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_auto_configure --- debhelper-11.1.6ubuntu1/dh_auto_configure 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_auto_configure 2018-12-18 19:49:57.000000000 +0000 @@ -50,7 +50,7 @@ =cut -# PROMISE: DH NOOP WITHOUT buildsystem(configure) +# PROMISE: DH NOOP WITHOUT cli-options(BUILDSYSTEM) buildsystem(configure) buildsystems_init(); buildsystems_do(); diff -Nru debhelper-11.1.6ubuntu1/dh_auto_install debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_auto_install --- debhelper-11.1.6ubuntu1/dh_auto_install 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_auto_install 2018-12-18 19:49:57.000000000 +0000 @@ -71,7 +71,7 @@ "destdir=s" => \$destdir, }); -# PROMISE: DH NOOP WITHOUT buildsystem(install) +# PROMISE: DH NOOP WITHOUT cli-options(BUILDSYSTEM) buildsystem(install) # If destdir is not specified, determine it automatically if (!$destdir) { @@ -83,7 +83,7 @@ $destdir=tmpdir($dh{MAINPACKAGE}); } } -$destdir = File::Spec->rel2abs($destdir, cwd()); +$destdir = File::Spec->rel2abs($destdir, getcwd()); if (compat(10)) { # Ensure that all debian/ directories exist diff -Nru debhelper-11.1.6ubuntu1/dh_auto_test debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_auto_test --- debhelper-11.1.6ubuntu1/dh_auto_test 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_auto_test 2018-12-18 19:49:57.000000000 +0000 @@ -52,7 +52,7 @@ =cut -# PROMISE: DH NOOP WITHOUT buildsystem(test) +# PROMISE: DH NOOP WITHOUT cli-options(BUILDSYSTEM) buildsystem(test) if (get_buildoption("nocheck")) { exit 0; diff -Nru debhelper-11.1.6ubuntu1/dh_bugfiles debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_bugfiles --- debhelper-11.1.6ubuntu1/dh_bugfiles 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_bugfiles 2018-12-18 19:49:57.000000000 +0000 @@ -74,7 +74,7 @@ "control" => "bug-control", "presubj" => "bug-presubj", ); -# PROMISE: DH NOOP WITHOUT bug-script bug-control bug-presubj +# PROMISE: DH NOOP WITHOUT bug-script bug-control bug-presubj cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { next if is_udeb($package); diff -Nru debhelper-11.1.6ubuntu1/dh_clean debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_clean --- debhelper-11.1.6ubuntu1/dh_clean 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_clean 2018-12-18 19:49:57.000000000 +0000 @@ -78,6 +78,7 @@ init(options => { "dirs-only" => \$dh{D_FLAG}, + "keep|k" => \$dh{K_FLAG}, }); inhibit_log(); diff -Nru debhelper-11.1.6ubuntu1/dh_compress debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_compress --- debhelper-11.1.6ubuntu1/dh_compress 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_compress 2019-02-23 11:22:13.000000000 +0000 @@ -91,7 +91,12 @@ # structure that will be effected. next unless -d $tmp; my $ignore_doc_dirs = '-name _sources'; - $ignore_doc_dirs .= qq{ -o -path "usr/share/doc/$package/examples"} if not compat(11); + if (not compat(11)) { + my $target_package = compute_doc_main_package($package); + $ignore_doc_dirs .= qq{ -o -path "usr/share/doc/${package}/examples"}; + $ignore_doc_dirs .= qq{ -o -path "usr/share/doc/${target_package}/examples"} + if $target_package and $target_package ne $package; + } $olddir = getcwd() if not defined $olddir; verbose_print("cd $tmp"); chdir($tmp) || error("Can't cd to $tmp: $!"); @@ -133,7 +138,7 @@ ! -iname "*.xz" ! -iname "*.lz" ! -iname "*.lzma" \\ ! -iname "*.svg" ! -iname "*.svgz" ! -iname "*.js" \\ ! -name "index.sgml" ! -name "objects.inv" ! -name "*.map" \\ - ! -name "*.devhelp2" \\ + ! -name "*.devhelp2" ! -name "search_index.json" \\ ! -name "copyright" 2>/dev/null || true; find usr/share/fonts/X11 -type f -name "*.pcf" 2>/dev/null || true; `); @@ -193,8 +198,15 @@ my ($directory) = $link =~ m:(.*)/:; my $linkval = readlink($link); if (! -e "$directory/$linkval" && -e "$directory/$linkval.gz") { + # Avoid duplicate ".gz.gz" if the link already has + # the .gz extension. This can happen via + # dh_installman when the .so is already compressed + # and then dh_installman reencodes the target + # manpage. + my $link_name = $link; + $link_name .= '.gz' if $link_name !~ m/[.]gz$/; rm_files($link, "$link.gz"); - make_symlink_raw_target("$linkval.gz","$link.gz"); + make_symlink_raw_target("$linkval.gz", $link_name); delete $links{$link}; $changed++; } diff -Nru debhelper-11.1.6ubuntu1/dh_dwz debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_dwz --- debhelper-11.1.6ubuntu1/dh_dwz 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_dwz 2018-12-18 19:49:57.000000000 +0000 @@ -19,9 +19,6 @@ =head1 DESCRIPTION -B: This tool is experimental and may disappear or change -behaviour without any notice. - B is a debhelper program that will optimize the (uncompressed) size of the DWARF debug information in ELF binaries. It does so by running L on all the ELF binaries in the package. @@ -30,6 +27,20 @@ =over 4 +=item B<--dwz-multifile>, B<--no-dwz-multifile> + +Whether L should generate a I from the ELF binaries +in the same package (it does by default). When enabled, if a package +ships at least 2 ELF binaries, B will instruct L to +generate a multifile for the package. + +Note this options may not work if a package contains more ELF binaries +than can fit on a single command line. If this becomes a problem, +please pass B<--no-dwz-multifile> to work around the issue. + +The generated multifile will be compressed with B. + =item B<-X>I, B<--exclude=>I Exclude files that contain I anywhere in their filename from being @@ -57,13 +68,15 @@ =cut -init(); +my $create_multifile = 1; + +init(options => { + 'dwz-multifile!' => \$create_multifile, +}); # This variable can be used to turn off stripping (see Policy). exit 0 if get_buildoption('nostrip'); -warning('This tool is experimental and may change (or be retired) without any notice'); - my @elf_files; sub testfile { @@ -99,10 +112,21 @@ # Consistent order; @elf_files = sort(@elf_files); my ($unique_files, $hardlinks) = find_hardlinks(@elf_files); + my @dwz_options; + if ($create_multifile and @{$unique_files} > 1) { + my $objcopy = cross_command($package, 'objcopy'); + my $ma_dir = dpkg_architecture_value('DEB_HOST_MULTIARCH'); + my $dwz_dir = "usr/lib/debug/.dwz/${ma_dir}"; + my $m = "${dwz_dir}/${package}.debug"; + my @dwz_options = ("-m${tmp}/${m}", "-M/${m}"); + install_dir("${tmp}/${dwz_dir}"); + doit('dwz', '-q', @dwz_options, @{$dh{U_PARAMS}}, '--', @{$unique_files}); + doit($objcopy, '--compress-debug-sections', "${tmp}/${m}"); + } else { + xargs($unique_files, 'dwz', '-q', @{$dh{U_PARAMS}}, '--'); + } - # TODO: Support multifile (-m) - xargs($unique_files, 'dwz', '-q', @{$dh{U_PARAMS}}, '--'); # Now change over any files we can that used to be hard links so # they are again. for my $hardlink (keys %{$hardlinks}) { diff -Nru debhelper-11.1.6ubuntu1/dh_fixperms debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_fixperms --- debhelper-11.1.6ubuntu1/dh_fixperms 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_fixperms 2019-01-10 07:03:38.000000000 +0000 @@ -72,6 +72,8 @@ '*.jpeg', '*.jpg', '*.png', '*.gif', # OCaml native-code shared objects '*.cmxs', + # Node bindings + '*.node', ); my @mode_0755_patterns = ( # None for Debian diff -Nru debhelper-11.1.6ubuntu1/dh_gconf debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_gconf --- debhelper-11.1.6ubuntu1/dh_gconf 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_gconf 2018-12-18 19:49:57.000000000 +0000 @@ -2,7 +2,7 @@ =head1 NAME -dh_gconf - install GConf defaults files and register schemas +dh_gconf - install GConf defaults files and register schemas (deprecated) =cut @@ -54,14 +54,18 @@ =cut -init(); +init(options => { + "priority=s" => \$dh{PRIORITY}, +}); + +warning("Please migrate to dh_installgsettings; gconf + dh_gconf is scheduled for removal."); my $priority=10; if (defined $dh{PRIORITY}) { $priority=$dh{PRIORITY}; } -# PROMISE: DH NOOP WITHOUT gconf-mandatory gconf-defaults tmp(etc/gconf/schemas) tmp(usr/share/gconf/schemas) +# PROMISE: DH NOOP WITHOUT gconf-mandatory gconf-defaults tmp(etc/gconf/schemas) tmp(usr/share/gconf/schemas) cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_icons debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_icons --- debhelper-11.1.6ubuntu1/dh_icons 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_icons 2018-12-18 19:49:57.000000000 +0000 @@ -44,7 +44,7 @@ init(); -# PROMISE: DH NOOP WITHOUT tmp(usr/share/icons) +# PROMISE: DH NOOP WITHOUT tmp(usr/share/icons) cli-options() my $baseicondir="/usr/share/icons"; foreach my $package (@{$dh{DOPACKAGES}}) { diff -Nru debhelper-11.1.6ubuntu1/dh_install debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_install --- debhelper-11.1.6ubuntu1/dh_install 2018-02-04 18:00:43.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_install 2018-12-18 19:49:57.000000000 +0000 @@ -138,7 +138,7 @@ $exclude = '! \( '.$dh{EXCLUDE_FIND}.' \)'; } -# PROMISE: DH NOOP WITHOUT pkgfile-logged(install) +# PROMISE: DH NOOP WITHOUT pkgfile-logged(install) cli-options() foreach my $package (getpackages()) { my (@installed, %dest2sources); diff -Nru debhelper-11.1.6ubuntu1/dh_installcatalogs debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installcatalogs --- debhelper-11.1.6ubuntu1/dh_installcatalogs 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installcatalogs 2018-12-18 19:49:57.000000000 +0000 @@ -71,7 +71,7 @@ init(); -# PROMISE: DH NOOP WITHOUT sgmlcatalogs +# PROMISE: DH NOOP WITHOUT sgmlcatalogs cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmpdir = tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installchangelogs debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installchangelogs --- debhelper-11.1.6ubuntu1/dh_installchangelogs 2018-03-30 08:00:57.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installchangelogs 2019-04-20 23:21:58.000000000 +0000 @@ -26,7 +26,7 @@ If there is an upstream F file, it will be installed as F in the package build directory. -If the upstream changelog is an F file (determined by file +If the specified upstream changelog is an F file (determined by file extension), it will be installed as F instead. If the html changelog is converted to plain text, that variant can be specified as a second upstream changelog file. When no plain @@ -74,6 +74,8 @@ Exclude upstream F files that contain I anywhere in their filename from being installed. +Note that directory name of the changelog is also part of the match. + =item I Install this file as the upstream changelog. @@ -132,22 +134,41 @@ } } -init(); +init(options => { + 'keep|k' => \$dh{K_FLAG}, +}); my $news_name="NEWS.Debian"; my $changelog_name="changelog.Debian"; -my $upstream=shift; -my $upstream_text=$upstream; -my $upstream_html; -if (! defined $upstream) { +my $explicit_changelog = @ARGV ? 1 : 0; +my $default_upstream = $ARGV[0]; +my $default_upstream_text=$default_upstream; +my $default_upstream_html; +if (! defined($default_upstream)) { if (isnative($dh{MAINPACKAGE})) { $changelog_name='changelog'; } } -elsif ($upstream=~m/\.html?$/i) { - $upstream_html=$upstream; - $upstream_text=shift; +elsif ($default_upstream=~m/\.html?$/i) { + $default_upstream_html=$default_upstream; + $default_upstream_text=$ARGV[1]; +} + +sub find_changelog { + my ($dir) = @_; + my @files=sort glob("$dir/*"); + foreach my $suffix ('', qw(.txt .md .rst)) { + foreach my $name (qw{changelog changes history}) { + my @matches=grep { + lc basename($_) eq "$name$suffix" && -f $_ && -s _ && ! excludefile($_) + } @files; + if (@matches) { + return shift(@matches); + } + } + } + return; } on_pkgs_in_parallel { @@ -157,6 +178,15 @@ my $tmp=tmpdir($package); my $changelog=pkgfile($package,"changelog"); my $news=pkgfile($package,"NEWS"); + my $upstream_changelog; + my ($upstream_changelog_text, $upstream_changelog_html); + my $changelog_from_tmp_dir = 0; + + if ($explicit_changelog) { + $upstream_changelog = $default_upstream; + $upstream_changelog_text = $default_upstream_text; + $upstream_changelog_html = $default_upstream_html; + } if (!$changelog) { $changelog="debian/changelog"; @@ -197,17 +227,31 @@ install_file($news, "$tmp/usr/share/doc/$package/$news_name"); } - if (defined $upstream) { + if (defined($upstream_changelog)) { my $link_to; my $base="$tmp/usr/share/doc/$package"; - if (defined $upstream_text) { - install_file($upstream_text, "$base/changelog"); + if (defined($upstream_changelog_text)) { + if ($changelog_from_tmp_dir and not $dh{K_FLAG}) { + # mv (unless if it is the same file) + rename_path($upstream_changelog_text, "$base/changelog") + if basename($upstream_changelog_text) ne 'changelog'; + reset_perm_and_owner(0644, "$base/changelog"); + } else { + install_file($upstream_changelog_text, "$base/changelog"); + } $link_to='changelog'; } - if (defined $upstream_html) { - install_file($upstream_html,"$base/changelog.html"); + if (defined($upstream_changelog_html)) { + if ($changelog_from_tmp_dir and not $dh{K_FLAG}) { + # mv (unless if it is the same file) + rename_path($upstream_changelog_html, "$base/changelog.html") + if basename($upstream_changelog_text) ne 'changelog.html'; + reset_perm_and_owner(0644, "$base/changelog.html"); + } else { + install_file($upstream_changelog_html,"$base/changelog.html"); + } $link_to='changelog.html'; - if (! defined $upstream_text) { + if (! defined($upstream_changelog_text)) { complex_doit("echo 'See changelog.html.gz' > $base/changelog"); reset_perm_and_owner(0644,"$base/changelog"); } @@ -215,7 +259,7 @@ if ($dh{K_FLAG}) { # Install symlink to original name of the upstream changelog file. # Use basename in case original file was in a subdirectory or something. - doit("ln","-sf",$link_to,"$tmp/usr/share/doc/$package/".basename($upstream)); + doit('ln', '-sf', $link_to, "$tmp/usr/share/doc/$package/".basename($upstream_changelog)); } } } diff -Nru debhelper-11.1.6ubuntu1/dh_installcron debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installcron --- debhelper-11.1.6ubuntu1/dh_installcron 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installcron 2018-12-18 19:49:57.000000000 +0000 @@ -56,7 +56,7 @@ init(); -# PROMISE: DH NOOP WITHOUT cron.hourly cron.daily cron.weekly cron.monthly cron.d +# PROMISE: DH NOOP WITHOUT cron.hourly cron.daily cron.weekly cron.monthly cron.d cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installdeb debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installdeb --- debhelper-11.1.6ubuntu1/dh_installdeb 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installdeb 2018-12-18 19:49:57.000000000 +0000 @@ -50,11 +50,13 @@ =item I.conffiles -This control file will be installed into the F directory. - -In v3 compatibility mode and higher, all files in the F directory in a -package will automatically be flagged as conffiles by this program, so -there is no need to list them manually here. +Historically, this file was needed to manually mark files files as +conffiles. However, it has become de facto obsolete since debhelper +automatically computed which files should be marked as conffiles. + +In compatibility level up and including 11, this control file will be +installed into the F directory. In compatibility level 12 and +later, the file is silently ignored. =item I.maintscript @@ -175,7 +177,9 @@ } # Install non-executable files - my @non_exec_files = (qw{conffiles}); + my @non_exec_files; + # Removed in compat 12. + push(@non_exec_files, 'conffiles') if compat(11); # In compat 10, we let dh_makeshlibs handle "shlibs". push(@non_exec_files, 'shlibs') if compat(9); foreach my $file (@non_exec_files) { diff -Nru debhelper-11.1.6ubuntu1/dh_installdebconf debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installdebconf --- debhelper-11.1.6ubuntu1/dh_installdebconf 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installdebconf 2018-12-18 19:49:57.000000000 +0000 @@ -84,7 +84,7 @@ @extraparams=@{$dh{U_PARAMS}}; } -# PROMISE: DH NOOP WITHOUT config templates +# PROMISE: DH NOOP WITHOUT config templates cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installdirs debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installdirs --- debhelper-11.1.6ubuntu1/dh_installdirs 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installdirs 2018-12-18 19:49:57.000000000 +0000 @@ -14,7 +14,7 @@ =head1 SYNOPSIS -B [S>] [B<-A>] [S ...>] +B [S>] [B<-A>] [B<--sourcedir=>I] [B<--create-in-sourcedir>] [S ...>] =head1 DESCRIPTION @@ -48,6 +48,23 @@ Create any directories specified by command line parameters in ALL packages acted on, not just the first. +=item B<--create-in-sourcedir>, B<--no-create-in-sourcedir> + +Whether to create the specified directories in the source directory +(usually F) I in the package build directory +(usually F<< debian/I >>). + +The default is B<--no-create-in-sourcedir>. + +=item B<--sourcedir=>I + +Consider I the source directory for the packages acted on instead +of the default (which is usually F). + +Please note that this option is dependent on the +B<--create-in-sourcedir> option (when B<--no-create-in-sourcedir> is +in effect, this option does nothing in B). + =item I ... Create these directories in the package build directory of the first @@ -57,13 +74,19 @@ =cut -init(); +my $create_in_sourcedir = 0; + +init(options => { + 'sourcedir=s' => \$dh{SOURCEDIR}, + 'create-in-sourcedir!' => \$create_in_sourcedir, +}); -# PROMISE: DH NOOP WITHOUT dirs +# PROMISE: DH NOOP WITHOUT dirs cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); my $file=pkgfile($package,"dirs"); + my $srcdir = $dh{SOURCEDIR} // default_sourcedir($package); install_dir($tmp) if compat(10); @@ -83,14 +106,22 @@ # be in the right directory, but more importantly, it # protects against the danger of absolute dirs being # specified. - @dirs=map { - $_="$tmp/$_"; - tr:/:/:s; # just beautification. - $_ - } @dirs; + my @make_dirs; + push(@make_dirs, map { + my $dir = "$tmp/$_"; + $dir =~ tr:/:/:s; # just beautification. + $dir; + } @dirs); + if ($create_in_sourcedir) { + push(@make_dirs, map { + my $dir = "${srcdir}/$_"; + $dir =~ tr:/:/:s; # just beautification. + $dir; + } @dirs); + } # Create dirs. - install_dir(@dirs); + install_dir(@make_dirs); } } diff -Nru debhelper-11.1.6ubuntu1/dh_installdocs debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installdocs --- debhelper-11.1.6ubuntu1/dh_installdocs 2018-02-04 18:03:18.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installdocs 2018-12-18 19:49:57.000000000 +0000 @@ -33,7 +33,7 @@ directory (or wherever you've told it to look using B<--sourcedir>). In compat 11 and later, B offers many of the features that -L also have. Furthermore, B also supports +L also has. Furthermore, B also supports the B build profile to exclude documentation (regardless of compat level). @@ -166,8 +166,8 @@ script snippets. B: The use of B<--link-doc> should only be done when the -packages have same "architecture" type. A link from a architecture -independent package to a architecture dependent package (or vice +packages have same "architecture" type. A link from an architecture +independent package to an architecture dependent package (or vice versa) will not work. Since compat 10, debhelper will actively reject unsupported combinations. @@ -228,7 +228,7 @@ }); my $called_getpackages = 0; -my $default_error_handler = compat(10) ? \&glob_expand_error_handler_warn_and_discard : \&glob_expand_error_handler_reject; +my $default_error_handler = compat(10) ? \&glob_expand_error_handler_reject_nomagic_warn_discard : \&glob_expand_error_handler_reject; my $nodocs = is_build_profile_active('nodoc') || get_buildoption('nodoc') ? 1 : 0; # We cannot assume documentation is built under nodoc, but if it is we must flag it as handled # or dh_missing might make noise. diff -Nru debhelper-11.1.6ubuntu1/dh_installemacsen debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installemacsen --- debhelper-11.1.6ubuntu1/dh_installemacsen 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installemacsen 2018-12-18 19:49:57.000000000 +0000 @@ -82,6 +82,7 @@ init(options => { "flavor=s" => \$dh{FLAVOR}, + "priority=s" => \$dh{PRIORITY}, }); if (! defined $dh{PRIORITY}) { @@ -91,7 +92,7 @@ $dh{FLAVOR}='emacs'; } -# PROMISE: DH NOOP WITHOUT emacsen-common emacsen-install emacsen-remove emacsen-startup +# PROMISE: DH NOOP WITHOUT emacsen-common emacsen-install emacsen-remove emacsen-startup cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installexamples debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installexamples --- debhelper-11.1.6ubuntu1/dh_installexamples 2018-02-04 18:02:39.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installexamples 2018-12-18 19:49:57.000000000 +0000 @@ -99,10 +99,10 @@ 'doc-main-package=s' => \$dh{DOC_MAIN_PACKAGE}, }); -# PROMISE: DH NOOP WITHOUT pkgfile-logged(examples) +# PROMISE: DH NOOP WITHOUT pkgfile-logged(examples) cli-options() my $pwd; -my $default_error_handler = compat(10) ? \&glob_expand_error_handler_warn_and_discard : \&glob_expand_error_handler_reject; +my $default_error_handler = compat(10) ? \&glob_expand_error_handler_reject_nomagic_warn_discard : \&glob_expand_error_handler_reject; my $nodocs = is_build_profile_active('nodoc') || get_buildoption('nodoc') ? 1 : 0; # We cannot assume documentation is built under nodoc, but if it is we must flag it as handled # or dh_missing might make noise. diff -Nru debhelper-11.1.6ubuntu1/dh_installgsettings debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installgsettings --- debhelper-11.1.6ubuntu1/dh_installgsettings 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installgsettings 2018-12-18 19:49:57.000000000 +0000 @@ -55,14 +55,16 @@ =cut -init(); +init(options => { + "priority=s" => \$dh{PRIORITY}, +}); my $priority=10; if (defined $dh{PRIORITY}) { $priority=$dh{PRIORITY}; } -# PROMISE: DH NOOP WITHOUT gsettings-override tmp(usr/share/glib-2.0/schemas) +# PROMISE: DH NOOP WITHOUT gsettings-override tmp(usr/share/glib-2.0/schemas) cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installifupdown debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installifupdown --- debhelper-11.1.6ubuntu1/dh_installifupdown 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installifupdown 2018-12-18 19:49:57.000000000 +0000 @@ -55,7 +55,7 @@ init(); -# PROMISE: DH NOOP WITHOUT if-pre-up if-up if-down if-post-down +# PROMISE: DH NOOP WITHOUT if-pre-up if-up if-down if-post-down cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installinfo debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installinfo --- debhelper-11.1.6ubuntu1/dh_installinfo 2018-03-29 16:35:25.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installinfo 2018-12-18 19:49:57.000000000 +0000 @@ -67,9 +67,9 @@ "sourcedir=s" => \$dh{SOURCEDIR}, }); -# PROMISE: DH NOOP WITHOUT info +# PROMISE: DH NOOP WITHOUT info cli-options() -my $default_error_handler = compat(10) ? \&glob_expand_error_handler_warn_and_discard : \&glob_expand_error_handler_reject; +my $default_error_handler = compat(10) ? \&glob_expand_error_handler_reject_nomagic_warn_discard : \&glob_expand_error_handler_reject; my $nodocs = is_build_profile_active('nodoc') || get_buildoption('nodoc') ? 1 : 0; # We cannot assume documentation is built under nodoc, but if it is we must flag it as handled # or dh_missing might make noise. diff -Nru debhelper-11.1.6ubuntu1/dh_installinit debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installinit --- debhelper-11.1.6ubuntu1/dh_installinit 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installinit 2018-12-18 19:49:57.000000000 +0000 @@ -19,9 +19,14 @@ =head1 DESCRIPTION -B is a debhelper program that is responsible for installing -init scripts with associated defaults files. In compatibility levels up to -11, B also handled upstart job files and systemd service files. +B is a debhelper program that is responsible for +installing init scripts with associated defaults files. In +compatibility levels up to and including 10, B will +also install some systemd related files provided by the debian +packaging (see the L section below). In compatibility levels +up to and including 11, B will also handle upstart +jobs provided in the debian packaging (see the L for more +information on this as well). It also automatically generates the F and F and F commands needed to set up the symlinks in F to start and stop @@ -137,9 +142,9 @@ =item B<--no-enable> Disable the init script on purge, but do not enable them on install. -This implies a versioned dependency on B= -1.51)> as it is the first (functional) version that supports -B< defaults-disabled>>. +This implies a versioned dependency on B<< init-system-helpers (E= +1.51) >> as it is the first (functional) version that supports +B<< update-rc.d EscriptE defaults-disabled >>. B that this option does not affect whether the services are started. Please remember to also use B<--no-start> if the service @@ -223,7 +228,7 @@ "no-enable" => \$dh{NO_ENABLE}, }); -# PROMISE: DH NOOP WITHOUT service tmpfile default upstart init init.d tmp(usr/lib/tmpfiles.d) tmp(etc/tmpfiles.d) +# PROMISE: DH NOOP WITHOUT service tmpfile default upstart init init.d tmp(usr/lib/tmpfiles.d) tmp(etc/tmpfiles.d) cli-options(--init-script|-d|--remove-d|-o|--only-scripts) my %snippet_options = ('snippet-order' => 'service'); @@ -326,7 +331,7 @@ $name =~ s/^\Q$tmp\E//g; if ($name =~ m,^/usr/lib/tmpfiles\.d/, || $name =~ m,^/etc/tmpfiles\.d/,) { - push @tmpfiles, $name; + push(@tmpfiles, basename($name)); } }, no_chdir => 1, @@ -344,6 +349,7 @@ # the parameters to pass to update-rc.d. If not set, # we have to say "defaults". my $params = 'defaults'; + my $update_rcd_params = compat(11) ? '' : '--skip-systemd-native '; if ($dh{NO_ENABLE}) { $params = 'defaults-disabled'; addsubstvar($package, "misc:Depends", "init-system-helpers (>= 1.51)"); @@ -359,29 +365,47 @@ if ($dh{RESTART_AFTER_UPGRADE}) { # update-rc.d, and restart (or # start if new install) script - autoscript($package,"postinst", "postinst-init-restart", - { 'SCRIPT' => $script, 'INITPARMS' => $params, 'ERROR_HANDLER' => $dh{ERROR_HANDLER} }, + autoscript($package, 'postinst', 'postinst-init-restart', + { + 'SCRIPT' => $script, 'INITPARMS' => $params, 'ERROR_HANDLER' => $dh{ERROR_HANDLER}, + 'INVOKE_RCD_PARAMS' => $update_rcd_params, + }, \%snippet_options); } else { # update-rc.d, and start script - autoscript($package,"postinst", "postinst-init", - { 'SCRIPT' => $script, 'INITPARMS' => $params, 'ERROR_HANDLER' => $dh{ERROR_HANDLER} }, + autoscript($package, 'postinst', 'postinst-init', + { + 'SCRIPT' => $script, 'INITPARMS' => $params, 'ERROR_HANDLER' => $dh{ERROR_HANDLER}, + 'INVOKE_RCD_PARAMS' => $update_rcd_params, + }, \%snippet_options); } if ($dh{R_FLAG} || $dh{RESTART_AFTER_UPGRADE}) { # stops script only on remove - autoscript($package,"prerm","prerm-init-norestart", - { 'SCRIPT' => $script, 'ERROR_HANDLER' => $dh{ERROR_HANDLER} }, + autoscript($package, 'prerm', 'prerm-init-norestart', + { + 'SCRIPT' => $script, 'ERROR_HANDLER' => $dh{ERROR_HANDLER}, + 'INVOKE_RCD_PARAMS' => $update_rcd_params, + }, \%snippet_options); } else { # always stops script - autoscript($package,"prerm","prerm-init", - { 'SCRIPT' => $script, 'ERROR_HANDLER' => $dh{ERROR_HANDLER} }, + autoscript($package, 'prerm', 'prerm-init', + { + 'SCRIPT' => $script, 'ERROR_HANDLER' => $dh{ERROR_HANDLER}, + 'INVOKE_RCD_PARAMS' => $update_rcd_params, + }, \%snippet_options); } + # The --skip-systemd-native option requires + # init-system-helpers (>= 1.54) and since we need it + # from prerm we need init-system-helpers to have been + # unpacked before the package is being unpacked. + addsubstvar($package, 'misc:Pre-Depends', 'init-system-helpers (>= 1.54~)') + if $update_rcd_params !~ m/^\s*$/; } else { # just update-rc.d @@ -400,7 +424,7 @@ =head1 SEE ALSO -L +L, L This program is a part of debhelper. diff -Nru debhelper-11.1.6ubuntu1/dh_installinitramfs debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installinitramfs --- debhelper-11.1.6ubuntu1/dh_installinitramfs 1970-01-01 00:00:00.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installinitramfs 2019-02-23 07:40:09.000000000 +0000 @@ -0,0 +1,97 @@ +#!/usr/bin/perl + +=head1 NAME + +dh_installinitramfs - install initramfs hooks and setup maintscripts + +=cut + +use strict; +use warnings; +use Debian::Debhelper::Dh_Lib; + +our $VERSION = DH_BUILTIN_VERSION; + +=head1 SYNOPSIS + +B [S>] [B<-n>] + +=head1 DESCRIPTION + +B is a debhelper program that is responsible for +installing Debian package provided initramfs hooks. + +If B installs or (in compat 12 or later) detects +one or more initramfs hooks in the package, then it also automatically +generates the F and F commands needed to interface +with the Debian initramfs system. These commands are inserted into +the maintainer scripts by L. + +=head1 FILES + +=over 4 + +=item debian/I.initramfs-hook + +Assumed to be an initramfs hook that will be installed into F<< +usr/share/initramfs-tools/hooks/I >> in the package build +directory. See B in L for more +information about initramfs hooks. + +=back + +=head1 OPTIONS + +=over 4 + +=item B<-n>, B<--no-scripts> + +Do not modify F/F scripts. + +=back + +=head1 NOTES + +Note that this command is not idempotent. L should be called +between invocations of this command. Otherwise, it may cause multiple +instances of the same text to be added to maintainer scripts. + +=cut + +init(); + +# PROMISE: DH NOOP WITHOUT initramfs-hook tmp(usr/share/initramfs-tools/hooks) cli-options() + +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmp = tmpdir($package); + my $hook_script = pkgfile($package, 'initramfs-hook'); + my $has_hooks; + my $hook_dir = "${tmp}/usr/share/initramfs-tools/hooks"; + + if ($hook_script ne '') { + install_dir($hook_dir); + install_prog($hook_script, "${hook_dir}/${package}"); + $has_hooks = 1; + } elsif (-d $hook_dir and not is_empty_dir($hook_dir)) { + $has_hooks = 1; + } + + if ($has_hooks && ! $dh{NOSCRIPTS}) { + autoscript($package, 'postinst', 'postinst-initramfs-hook'); + autoscript($package, 'postrm', 'postrm-initramfs-hook') + } +} + +=head1 SEE ALSO + +L +L +L + +This program is a part of debhelper. + +=head1 AUTHOR + +Niels Thykier + +=cut diff -Nru debhelper-11.1.6ubuntu1/dh_installlogcheck debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installlogcheck --- debhelper-11.1.6ubuntu1/dh_installlogcheck 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installlogcheck 2018-12-18 19:49:57.000000000 +0000 @@ -58,7 +58,7 @@ init(); -# PROMISE: DH NOOP WITHOUT logcheck.cracking logcheck.violations logcheck.violations.ignore logcheck.ignore.workstation logcheck.ignore.server logcheck.ignore.paranoid +# PROMISE: DH NOOP WITHOUT logcheck.cracking logcheck.violations logcheck.violations.ignore logcheck.ignore.workstation logcheck.ignore.server logcheck.ignore.paranoid cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installlogrotate debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installlogrotate --- debhelper-11.1.6ubuntu1/dh_installlogrotate 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installlogrotate 2018-12-18 19:49:57.000000000 +0000 @@ -38,7 +38,7 @@ init(); -# PROMISE: DH NOOP WITHOUT logrotate +# PROMISE: DH NOOP WITHOUT logrotate cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installman debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installman --- debhelper-11.1.6ubuntu1/dh_installman 2018-02-04 18:01:59.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installman 2018-12-18 19:49:57.000000000 +0000 @@ -140,12 +140,12 @@ }); -# PROMISE: DH NOOP WITHOUT pkgfile-logged(manpages) tmp(usr/share/man) +# PROMISE: DH NOOP WITHOUT pkgfile-logged(manpages) tmp(usr/share/man) cli-options() my (@sofiles, @sodests); my @all_packages = getpackages(); -my $default_error_handler = compat(10) ? \&glob_expand_error_handler_warn_and_discard : \&glob_expand_error_handler_reject; +my $default_error_handler = compat(10) ? \&glob_expand_error_handler_reject_nomagic_warn_discard : \&glob_expand_error_handler_reject; my $nodocs = is_build_profile_active('nodoc') || get_buildoption('nodoc') ? 1 : 0; # We cannot assume documentation is built under nodoc, but if it is we must flag it as handled # or dh_missing might make noise. @@ -272,7 +272,7 @@ }); # Now utf-8 conversion. -if (defined `man --version`) { +if (defined(`man --version`)) { my (@manpages_to_reencode, @issues); for my $package (@{$dh{DOPACKAGES}}) { next if is_udeb($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installmenu debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installmenu --- debhelper-11.1.6ubuntu1/dh_installmenu 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installmenu 2018-12-18 19:49:57.000000000 +0000 @@ -55,7 +55,7 @@ init(); -# PROMISE: DH NOOP WITHOUT menu menu-method +# PROMISE: DH NOOP WITHOUT menu menu-method cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installmime debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installmime --- debhelper-11.1.6ubuntu1/dh_installmime 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installmime 2018-12-18 19:49:57.000000000 +0000 @@ -41,7 +41,7 @@ init(); -# PROMISE: DH NOOP WITHOUT mime sharedmimeinfo +# PROMISE: DH NOOP WITHOUT mime sharedmimeinfo cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installmodules debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installmodules --- debhelper-11.1.6ubuntu1/dh_installmodules 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installmodules 2018-12-18 19:49:57.000000000 +0000 @@ -86,7 +86,7 @@ return sort(keys(%versions)); } -# PROMISE: DH NOOP WITHOUT modprobe tmp(lib/modules) +# PROMISE: DH NOOP WITHOUT modprobe tmp(lib/modules) cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installpam debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installpam --- debhelper-11.1.6ubuntu1/dh_installpam 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installpam 2018-12-18 19:49:57.000000000 +0000 @@ -47,7 +47,7 @@ init(); -# PROMISE: DH NOOP WITHOUT pam +# PROMISE: DH NOOP WITHOUT pam cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installppp debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installppp --- debhelper-11.1.6ubuntu1/dh_installppp 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installppp 2018-12-18 19:49:57.000000000 +0000 @@ -51,7 +51,7 @@ init(); -# PROMISE: DH NOOP WITHOUT ppp.ip-up ppp.ip-down +# PROMISE: DH NOOP WITHOUT ppp.ip-up ppp.ip-down cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installsystemd debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installsystemd --- debhelper-11.1.6ubuntu1/dh_installsystemd 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installsystemd 2018-12-18 19:49:57.000000000 +0000 @@ -16,61 +16,55 @@ =head1 SYNOPSIS -B [S>] [B<--restart-after-upgrade>] [B<--no-stop-on-upgrade>] [B<--no-enable>] [B<--name=>I] [S ...>] +B [S>] [B<--restart-after-upgrade>] [B<--no-stop-on-upgrade>] [B<--no-enable>] [B<--no-start>] [B<--name=>I] [S ...>] =head1 DESCRIPTION -B is a debhelper program that is responsible for enabling, -disabling, starting, stopping and restarting systemd unit files. +B is a debhelper program that is responsible for +installing package maintainer supplied systemd unit files. -In the simple case, it finds all unit files installed by a package (e.g. -bacula-fd.service) and enables them. It is not necessary that the machine -actually runs systemd during package installation time, enabling happens on all -machines in order to be able to switch from sysvinit to systemd and back. - -For only generating blocks for specific service files, you need to pass them as -arguments, e.g. B and B. +It also finds the service files installed by a package and generates +F, F, and F code blocks for enabling, +disabling, starting, stopping, and restarting the corresponding +systemd services, when the package is installed, updated, or +removed. These snippets are added to the maintainer scripts by +L. + +L is used to enable and disable systemd units, +thus it is not necessary that the machine actually runs systemd during +package installation time, enabling happens on all machines in order +to be able to switch from sysvinit to systemd and back. + +B operates on all unit files installed by a +package. For only generating blocks for specific unit files, pass them +as arguments, C. Specific unit files +can be excluded from processing using the B<-X> common L +option. =head1 FILES =over 4 -=item debian/I.service, debian/I@.service +=item debian/I.mount, + debian/I.path, + debian/I@.path, + debian/I.service, + debian/I@.service, + debian/I.socket, + debian/I@.socket, + debian/I.target, + debian/I@.target, + debian/I.timer, + debian/I@.timer -If this exists, it is installed into lib/systemd/system/I.service (or -lib/systemd/system/I@.service) in the package build directory. +If any of those files exists, they are installed into +F in the package build directory. =item debian/I.tmpfile -If this exists, it is installed into usr/lib/tmpfiles.d/I.conf in the -package build directory. (The tmpfiles.d mechanism is currently only used -by systemd.) - -=item debian/I.target, debian/I@.target - -If this exists, it is installed into lib/systemd/system/I.target (or -lib/systemd/system/I@.target) in the package build directory. - -=item debian/I.socket, debian/I@.socket - -If this exists, it is installed into lib/systemd/system/I.socket (or -lib/systemd/system/I@.socket) in the package build directory. - -=item debian/I.mount - -If this exists, it is installed into lib/systemd/system/I.mount -in the package build directory. - -=item debian/I.path, debian/I@.path - -If this exists, it is installed into lib/systemd/system/I.path (or -lib/systemd/system/I@.path) in the package build directory. - -=item debian/I.timer, debian/I@.timer - -If this exists, it is installed into lib/systemd/system/I.timer (or -lib/systemd/system/I@.timer) in the package build directory. +If this exists, it is installed into F in the +package build directory. Note that the C mechanism is +currently only used by systemd. =back @@ -88,12 +82,19 @@ =item B<--name=>I -Install the service file as I instead of the default filename, -which is the I. When this parameter is used, -B looks for and installs files named -F instead of the usual F. -Moreover, maintainer scripts are only generated for units that match the given -I. +This option controls several things. + +It changes the name that B uses when it looks for +maintainer provided systemd unit files as listed in the L +section. As an example, B will look for +F<<< IB<< I >>I<.service> >>> instead of +F<< I >>). These unit files are installed as F<< +I >> (in the example, it would be installed as +F<<< B<< I >>I<.service> >>>). + +Furthermore, if no unit files are passed explicitly as command line +arguments, B will only act on unit files called +I (rather than all unit files found in the package). =item B<--restart-after-upgrade> @@ -128,14 +129,23 @@ enabled. Please remember to also use B<--no-enable> if the services should not be enabled. +=item S ...> + +Only process and generate maintscripts for the installed unit files +with the (base)name I. + +Note: B will still install unit files from +F but it will not generate any maintscripts for them unless +they are explicitly listed in S ...> + =back =head1 NOTES -Note that this command is not idempotent. L should be called -between invocations of this command (with the same arguments). Otherwise, it -may cause multiple instances of the same text to be added to maintainer -scripts. +This command is not idempotent. L should be called between +invocations of this command (with the same arguments). Otherwise, it +may cause multiple instances of the same text to be added to +maintainer scripts. =cut @@ -148,13 +158,23 @@ "no-restart-on-upgrade" => \$dh{R_FLAG}, "no-start" => \$dh{NO_START}, "R|restart-after-upgrade!" => \$dh{RESTART_AFTER_UPGRADE}, - "no-also" => \$dh{NO_ALSO}, + "no-also" => \$dh{NO_ALSO}, # undocumented option }); +sub quote { + # Add single quotes around the argument. + return '\'' . $_[0] . '\''; +} + +sub uniq { + my %seen; + return grep { !$seen{$_}++ } @_; +} + sub contains_install_section { my ($unit_path) = @_; - open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) to check for [Install]: $!"); + open(my $fh, '<', $unit_path) or error("Cannot open($unit_path): $!"); while (my $line = <$fh>) { chomp($line); @@ -164,6 +184,13 @@ return 0; } +sub has_sysv_equivalent { + my ($tmpdir, $unit) = @_; + + $unit =~ s/\.(?:mount|service|socket|target|path)$//g; + return -f "$tmpdir/etc/init.d/$unit"; +} + sub install_unit { my ($package, $script, $pkgsuffix, $path, $installsuffix) = @_; $installsuffix = $installsuffix || $pkgsuffix; @@ -173,26 +200,22 @@ install_file($unit, "${path}/${script}.${installsuffix}"); } -# Extracts the Also= or Alias= line(s) from a unit file. -# In case this produces horribly wrong results, you can pass --no-also, but -# that should really not be necessary. Please report bugs to -# pkg-systemd-maintainers. +# Extracts the directive values from a unit file. Handles repeated +# directives in the same unit file. Assumes values can only be +# composed of lists of unit names. This is good enough for the 'Also=' +# and 'Alias=' directives handled here. sub extract_key { my ($unit_path, $key) = @_; my @values; - return @values if $dh{NO_ALSO}; - - open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) for extracting the Also= line(s): $!"); + open(my $fh, '<', $unit_path) or error("Cannot open($unit_path): $!"); while (my $line = <$fh>) { chomp($line); - # The keys parsed from the unit file below can only have - # unit names as values. Since unit names can't have - # whitespace in systemd, simply use split and strip any - # leading/trailing quotes. See systemd-escape(1) for - # examples of valid unit names. + # Since unit names can't have whitespace in systemd, simply + # use split and strip any leading/trailing quotes. See + # systemd-escape(1) for examples of valid unit names. if ($line =~ /^\s*$key=(.+)$/i) { for my $value (split(/\s+/, $1)) { $value =~ s/^(["'])(.*)\g1$/$2/; @@ -200,212 +223,206 @@ } } } + close($fh); return @values; } +sub list_installed_units { + my ($tmpdir, $aliases) = @_; -# PROMISE: DH NOOP WITHOUT tmp(lib/systemd/system) tmp(usr/lib/tmpfiles.d) tmp(etc/tmpfiles.d) mount path service socket target tmpfile timer + my $lib_systemd_system = "$tmpdir/lib/systemd/system"; + my @installed; -my %requested_files = map { basename($_) => 1 } @ARGV; -my %installed_files; + return unless -d $lib_systemd_system; + opendir(my $dh, "$lib_systemd_system") or error("Cannot opendir($lib_systemd_system): $!"); -my %snippet_options = ('snippet-order' => 'service'); + foreach my $name (readdir($dh)) { + my $path = "$lib_systemd_system/$name"; + next unless -f $path; + if (-l "$path") { + my $dest = basename(readlink($path)); + $aliases->{$dest} //= [ ]; + push @{$aliases->{$dest}}, $name; + } else { + push @installed, $name; + } + } + closedir($dh); + return @installed; +} + + +# PROMISE: DH NOOP WITHOUT tmp(lib/systemd/system) tmp(usr/lib/tmpfiles.d) tmp(etc/tmpfiles.d) mount path service socket target tmpfile timer cli-options() + + +# Install package maintainer supplied unit files foreach my $package (@{$dh{DOPACKAGES}}) { my $tmpdir = tmpdir($package); - my (@installed_units, @start_units, @enable_units, %aliases, @tmpfiles); - # Figure out what filename to install it as. - my $script; - if (defined $dh{NAME}) { - $script=$dh{NAME}; - } - else { - $script=$package; + # Intall all unit files in the debian/ directory with names in the + # form $package.(service|target|socket|path|timer|mount|tmpfile) + # and their templated versison when relevant. + + # This can be modified with the --name option to look for unit + # files with names in the form $package.$name.(service|...) and + # $name.(service|target|socket|path|timer|mount|tmpfile) and their + # templated version when relevant. + my $name = $dh{NAME} // $package; + + for my $type (qw(service target socket path timer)) { + install_unit($package, $name, $type, "$tmpdir/lib/systemd/system"); + install_unit("${package}@", "${name}@", $type, "$tmpdir/lib/systemd/system"); } - for my $service_type (qw(service target socket path timer)) { - install_unit($package, $script, $service_type, "$tmpdir/lib/systemd/system"); - install_unit("${package}@", "${script}@", $service_type, "$tmpdir/lib/systemd/system"); - } + install_unit($package, $name, 'mount', "$tmpdir/lib/systemd/system"); + install_unit($package, $name, 'tmpfile', "$tmpdir/usr/lib/tmpfiles.d", 'conf'); +} + + +# Add postinst code blocks to handle tmpfiles +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmpdir = tmpdir($package); + my @tmpfiles; - install_unit($package, $script, 'mount', "$tmpdir/lib/systemd/system"); - install_unit($package, $script, 'tmpfile', "$tmpdir/usr/lib/tmpfiles.d", 'conf'); + my @dirs = grep { -d } map { "${tmpdir}/$_" } qw(usr/lib/tmpfiles.d etc/tmpfiles.d); - my $oldcwd = getcwd(); find({ wanted => sub { my $name = $File::Find::name; return unless -f $name; - return unless $name =~ m,^\Q${tmpdir}\E/lib/systemd/system/[^/]+$,; - if (-l) { - my $target = abs_path(readlink()); - $target =~ s,^\Q${oldcwd}\E/,,g; - $aliases{$target} = [ $_ ]; - } else { - push @installed_units, $name; - } - }, + push(@tmpfiles, basename($name)); }, no_chdir => 1, - }, "${tmpdir}/lib/systemd/system") if -d "${tmpdir}/lib/systemd/system"; + }, @dirs) if @dirs; - # Handle either only the unit files which were passed as arguments or - # all unit files that are installed in this package. - my @args; - if (@ARGV > 0) { + if (@tmpfiles) { + autoscript($package, 'postinst', 'postinst-init-tmpfiles', { 'TMPFILES' => join(' ', sort @tmpfiles) }); + } +} + + +# Add postinst, prerm, and postrm code blocks to handle activation, +# deactivation, start and stopping of services when the package is +# installed, upgraded or removed. +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmpdir = tmpdir($package); + my (@args, @start_units, @enable_units, %aliases); + + my @installed_units = list_installed_units($tmpdir, \%aliases); + + # Handle either only the unit files which were passed as arguments + # or all unit files that are installed in this package. + if (@ARGV) { @args = @ARGV; } elsif ($dh{NAME}) { - # treat --name flag as if the corresponding units were passed in the command line - @args = grep /(^|\/)$dh{NAME}\.(mount|path|service|socket|target|tmpfile)$/, @installed_units; + # Treat --name option as if the corresponding unit names were + # passed in the command line. + @args = grep /(^|\/)$dh{NAME}\.(mount|path|service|socket|target|timer)$/, @installed_units; } else { @args = @installed_units; } - # support excluding units via -X + # Support excluding units via the -X debhelper common option. foreach my $x (@{$dh{EXCLUDE}}) { @args = grep !/(^|\/)$x$/, @args; } - # This hash prevents us from looping forever in the following while loop. - # An actual real-world example of such a loop is systemd’s - # systemd-readahead-drop.service, which contains + # This hash prevents us from looping forever in the following + # while loop. An actual real-world example of such a loop is + # systemd's systemd-readahead-drop.service, which contains # Also=systemd-readahead-collect.service, and that file in turn - # contains Also=systemd-readahead-drop.service, thus forming an endless - # loop. + # contains Also=systemd-readahead-drop.service, thus forming an + # endless loop. my %seen; - # We use while/shift because we push to the list in the body. - while (@args) { - my $name = shift @args; - my $base = basename($name); - # Try to make the path absolute, so that the user can call - # dh_installsystemd bacula-fd.service - if ($base eq $name) { - # NB: This works because @installed_units contains - # files from precisely one directory. - my ($full) = grep { basename($_) eq $base } @installed_units; - if (defined($full)) { - $name = $full; - } else { - warning(qq|Could not find "$name" in the /lib/systemd/system directory of $package. | . - qq|This could be a typo, or using Also= with a service file from another package. | . - qq|Please check carefully that this message is harmless.|); - } - } + # Must use while and shift because the loop alters the list. + while (@args) { + my $unit = shift @args; + my $path = "${tmpdir}/lib/systemd/system/${unit}"; - $installed_files{$base} = 1 if exists($requested_files{$base}); + error("Package '$package' does not install unit '$unit'.") unless (-f $path); - # Skip template service files like e.g. getty@.service. - # Enabling, disabling, starting or stopping those services - # without specifying the instance (e.g. getty@ttyS0.service) is - # not useful. - if ($name =~ /\@/) { - next; + # Skip template service files. Enabling, disabling, starting + # or stopping those services without specifying the instance + # is not useful. + next if ($unit =~ /\@/); + + # Handle all unit files specified via Also= explicitly. This + # is not necessary for enabling, but for disabling, as we + # cannot read the unit file when disabling as it has already + # been deleted. The undocumented --no-also option disables + # handling of units linked via Also=. This option is provided + # only to suport a very specific use case in network-manager. + unless ($dh{NO_ALSO}) { + push @args, $_ for grep { !$seen{$_}++ } extract_key($path, 'Also'); } - # Handle all unit files specified via Also= explicitly. - # This is not necessary for enabling, but for disabling, as we - # cannot read the unit file when disabling (it was already - # deleted). - my @also = grep { !exists($seen{$_}) } extract_key($name, 'Also'); - $seen{$_} = 1 for @also; - @args = (@args, @also); - - push @{$aliases{$name}}, $_ for extract_key($name, 'Alias'); - my @sysv = grep { - my $base = $_; - $base =~ s/\.(?:mount|service|socket|target|path)$//g; - -f "$tmpdir/etc/init.d/$base" - } ($base, @{$aliases{$name}}); - if (@sysv == 0 && !grep { $_ eq $name } @start_units) { - push @start_units, $name; - } + # Extract unit aliases. + push @{$aliases{$unit}}, $_ for extract_key($path, 'Alias'); - if (contains_install_section($name) && !grep { $_ eq $name } @enable_units) { - push @enable_units, $name; + # In compat 11 (and earlier), dh_installinit will handle services with + # a sysv-equivalent service. In compat 12, dh_installsystemd will + # take care of it. + if (not compat(11) or not grep { has_sysv_equivalent($tmpdir, $_) } ($unit, @{$aliases{$unit}})) { + push @start_units, $unit; } - } - # Include postinst-init-tmpfiles if the package ships any files - # in /usr/lib/tmpfiles.d or /etc/tmpfiles.d - if (-d $tmpdir) { - my @dirs = grep { -d } map { "${tmpdir}/$_" } qw(usr/lib/tmpfiles.d etc/tmpfiles.d); - find({ - wanted => sub { - my $name = $File::Find::name; - return unless -f $name; - $name =~ s/^\Q$tmpdir\E//g; - push(@tmpfiles, $name); - }, - no_chdir => 1, - }, @dirs) if @dirs; - if (@tmpfiles > 0) { - autoscript($package, 'postinst', 'postinst-init-tmpfiles', { 'TMPFILES' => join(' ', sort @tmpfiles) }); + if (contains_install_section($path)) { + push @enable_units, $unit; } } + @enable_units = map { quote($_) } uniq sort @enable_units; + @start_units = map { quote($_) } uniq sort @start_units; + + my %options = ('snippet-order' => 'service'); + if (@enable_units) { - for my $unit (sort @enable_units) { - my $base = q{'} . basename($unit) . q{'}; - if ($dh{NO_ENABLE}) { - autoscript($package, 'postinst', 'postinst-systemd-dont-enable', { 'UNITFILE' => $base }, - \%snippet_options); - } else { - autoscript($package, 'postinst', 'postinst-systemd-enable', { 'UNITFILE' => $base }, - \%snippet_options); - } + for my $unit (@enable_units) { + my $snippet = $dh{NO_ENABLE} ? 'postinst-systemd-dont-enable' : 'postinst-systemd-enable'; + autoscript($package, 'postinst', $snippet, { 'UNITFILE' => $unit }, \%options); } - my $enableunitargs = join(' ', sort map { q{'} . basename($_) . q{'} } @enable_units); - autoscript($package, 'postrm', 'postrm-systemd', {'UNITFILES' => $enableunitargs }); + autoscript($package, 'postrm', 'postrm-systemd', {'UNITFILES' => join(' ', @enable_units) }); } - + if (@start_units) { - # The $package and $sed parameters are always the same. - # This wrapper function makes the following logic easier to read. - my $startunitargs = join(' ', sort map { q{'} . basename($_) . q{'} } @start_units); - my $start_autoscript = sub { - my ($script, $filename) = @_; - autoscript($package, $script, $filename, { 'UNITFILES' => $startunitargs }, - \%snippet_options); - }; + my $replace = { 'UNITFILES' => join(' ', @start_units) }; if ($dh{RESTART_AFTER_UPGRADE}) { - my $snippet = "postinst-systemd-restart" . ($dh{NO_START} ? "nostart" : ""); - $start_autoscript->("postinst", $snippet); + my $snippet; + if ($dh{NO_START}) { + $snippet = 'postinst-systemd-restartnostart'; + $replace->{RESTART_ACTION} = 'try-restart'; + } else { + $snippet = 'postinst-systemd-restart'; + $replace->{RESTART_ACTION} = 'restart'; + } + autoscript($package, 'postinst', $snippet, $replace, \%options); } elsif (!$dh{NO_START}) { - # We need to stop/start before/after the upgrade. - $start_autoscript->("postinst", "postinst-systemd-start"); + # (stop|start) service (before|after) upgrade + autoscript($package, 'postinst', 'postinst-systemd-start', $replace, \%options); } - $start_autoscript->("postrm", "postrm-systemd-reload-only"); - if ($dh{R_FLAG} || $dh{RESTART_AFTER_UPGRADE}) { # stop service only on remove - $start_autoscript->("prerm", "prerm-systemd-restart"); + autoscript($package, 'prerm', 'prerm-systemd-restart', $replace, \%options); } elsif (!$dh{NO_START}) { # always stop service - $start_autoscript->("prerm", "prerm-systemd"); + autoscript($package, 'prerm', 'prerm-systemd', $replace, \%options); } - } -} -if (%requested_files) { - my $any_missing = 0; - for my $name (sort(keys(%requested_files))) { - if (not exists($installed_files{$name})) { - warning(qq{Requested unit "$name" but it was not found in any package acted on.}); - $any_missing = 1; - } + # Run this with "default" order so it is always after other + # service related autosnippets. + autoscript($package, 'postrm', 'postrm-systemd-reload-only', $replace); } - error("Could not handle all of the requested services") if $any_missing; } =head1 SEE ALSO -L +L, L, L =head1 AUTHORS diff -Nru debhelper-11.1.6ubuntu1/dh_installsystemduser debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installsystemduser --- debhelper-11.1.6ubuntu1/dh_installsystemduser 1970-01-01 00:00:00.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installsystemduser 2018-12-18 19:49:57.000000000 +0000 @@ -0,0 +1,270 @@ +#!/usr/bin/perl -w + +=head1 NAME + +dh_installsystemduser - install systemd unit files + +=cut + +use strict; +use warnings; +use Debian::Debhelper::Dh_Lib; + +our $VERSION = DH_BUILTIN_VERSION; + +=head1 SYNOPSIS + +B [S>] [B<--no-enable>] [B<--name=>I] [S ...>] + +=head1 DESCRIPTION + +B finds the systemd user instance service files +installed by a package and generates F, and F code +blocks for enabling and disabling the corresponding systemd user +instance services, when the package is installed, updated, or +removed. These snippets are added to the maintainer scripts by +L. + +L is used to enable and disable the systemd +units, thus it is not necessary that the machine actually runs systemd +during package installation time, enabling happens on all machines. + +B operates on all user instance unit files +installed by a package. For only generating blocks for specific unit +files, pass them as arguments. Specific unit files can be excluded +from processing using the B<-X> common L option. + +=head1 FILES + +=over 4 + +=item debian/I.user.path, + debian/I@.user.path, + debian/I.user.service, + debian/I@.user.service, + debian/I.user.socket, + debian/I@.user.socket, + debian/I.user.target, + debian/I@.user.target, + debian/I.user.timer, + debian/I@.user.timer + +If any of those files exists, they are installed into +F in the package build directory removing the +F<.user> file name part. + +=back + +=head1 OPTIONS + +=over 4 + +=item B<--name=>I + +Install the service file as I instead of the default +filename I. When this parameter is used, +B looks for and installs files named +F instead of the usual +F. Moreover, maintainer scripts are only +generated for units that match the given I. + +=item B<--no-enable> + +Disable the service(s) on purge, but do not enable them on install. + +=back + +=head1 NOTES + +This command is not idempotent. L should be called between +invocations of this command (with the same arguments). Otherwise, it +may cause multiple instances of the same text to be added to +maintainer scripts. + +=cut + +# PROMISE: DH NOOP WITHOUT tmp(usr/lib/systemd/user) user.service + +init(options => { + "no-enable" => \$dh{NO_ENABLE}, +}); + +sub quote { + # Add single quotes around the argument. + return '\'' . $_[0] . '\''; +} + +sub uniq { + my %seen; + return grep { !$seen{$_}++ } @_; +} + +sub contains_install_section { + my ($unit_path) = @_; + + open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) to check for [Install]: $!"); + + while (my $line = <$fh>) { + chomp($line); + return 1 if $line =~ /^\s*\[Install\]$/i; + } + close($fh); + return 0; +} + +sub install_user_unit { + my ($package, $name, $suffix) = @_; + + my $tmpdir = tmpdir($package); + my $path = "$tmpdir/usr/lib/systemd/user"; + my $unit = pkgfile($package, "user.$suffix"); + return if $unit eq ''; + + install_dir($path); + install_file($unit, "$path/$name.$suffix"); +} + +# Extracts the directive values from a unit file. Handles repeated +# directives in the same unit file. Assumes values can only be +# composed of lists of unit names. This is good enough for the 'Also=' +# and 'Alias=' directives handled here. +sub extract_key { + my ($unit_path, $key) = @_; + my @values; + + open(my $fh, '<', $unit_path) or error("Cannot open($unit_path): $!"); + + while (my $line = <$fh>) { + chomp($line); + + # Since unit names can't have whitespace in systemd, simply + # use split and strip any leading/trailing quotes. See + # systemd-escape(1) for examples of valid unit names. + if ($line =~ /^\s*$key=(.+)$/i) { + for my $value (split(/\s+/, $1)) { + $value =~ s/^(["'])(.*)\g1$/$2/; + push @values, $value; + } + } + } + + close($fh); + return @values; +} + +sub list_installed_user_units { + my ($tmpdir, $aliases) = @_; + + my $lib_systemd_user = "$tmpdir/usr/lib/systemd/user"; + my @installed; + + return unless -d $lib_systemd_user; + opendir(my $dh, $lib_systemd_user) or error("Cannot opendir($lib_systemd_user): $!"); + + foreach my $name (readdir($dh)) { + my $path = "$lib_systemd_user/$name"; + next unless -f $path; + if (-l $path) { + my $dest = basename(readlink($path)); + $aliases->{$dest} //= [ ]; + push @{$aliases->{$dest}}, $name; + } else { + push @installed, $name; + } + } + + closedir($dh); + return @installed; +} + +# Install package maintainer provided unit files. +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmpdir = tmpdir($package); + + # unit file name + my $name = $dh{NAME} // $package; + + for my $type (qw(service target socket path timer)) { + install_user_unit($package, $name, $type); + install_user_unit("${package}@", "${name}@", $type); + } +} + +# Generate postinst and prerm code blocks to enable and disable units +foreach my $package (@{$dh{DOPACKAGES}}) { + my (@args, @enable_units, %aliases); + + my $tmpdir = tmpdir($package); + my @units = list_installed_user_units($tmpdir, \%aliases); + + # Handle either only the unit files which were passed as arguments + # or all unit files that are installed in this package. + if (@ARGV) { + @args = @ARGV; + } + elsif ($dh{NAME}) { + # Treat --name flag as if the corresponding units were passed + # in the command line. + @args = grep /(^|\/)$dh{NAME}\.(service|target|socket|path|timer)$/, @units; + } + else { + @args = @units; + } + + # Support excluding units via the -X debhelper common option. + foreach my $x (@{$dh{EXCLUDE}}) { + @args = grep !/(^|\/)$x$/, @args; + } + + # This hash prevents us from looping forever in the following + # while loop. An actual real-world example of such a loop is + # systemd's systemd-readahead-drop.service, which contains + # Also=systemd-readahead-collect.service, and that file in turn + # contains Also=systemd-readahead-drop.service, thus forming an + # endless loop. + my %seen; + + # Must use while and shift because the loop alters the list. + while (@args) { + my $name = shift @args; + my $path = "${tmpdir}/usr/lib/systemd/user/${name}"; + + error("User unit file \"$name\" not found in package \"$package\".") if ! -f $path; + + # Skip template service files. Enabling or disabling those + # services without specifying the instance is not useful. + next if ($name =~ /\@/); + + # Handle all unit files specified via Also= explicitly. This + # is not necessary for enabling, but for disabling, as we + # cannot read the unit file when disabling as it has already + # been deleted. + push @args, $_ for grep { !$seen{$_}++ } extract_key($path, 'Also'); + + push @enable_units, $name if contains_install_section($path); + } + + @enable_units = map { quote($_) } sort uniq @enable_units; + + if (@enable_units) { + # The generated maintainer script code blocks use the --user + # option that was added to deb-systemd-helper in version 1.52. + addsubstvar($package, 'misc:Depends', 'init-system-helpers', ">= 1.52"); + + my $postinst = $dh{NO_ENABLE} ? 'postinst-systemd-user-dont-enable' : 'postinst-systemd-user-enable'; + foreach my $unit (@enable_units) { + autoscript($package, 'postinst', $postinst, { 'UNITFILE' => $unit }); + } + autoscript($package, 'postrm', 'postrm-systemd-user', { 'UNITFILES' => join(' ', @enable_units) }); + } +} + +=head1 SEE ALSO + +L, L, L + +=head1 AUTHORS + +pkg-systemd-maintainers@lists.alioth.debian.org + +=cut diff -Nru debhelper-11.1.6ubuntu1/dh_installudev debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installudev --- debhelper-11.1.6ubuntu1/dh_installudev 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installudev 2018-12-18 19:49:57.000000000 +0000 @@ -55,7 +55,9 @@ =cut -init(); +init(options => { + "priority=s" => \$dh{PRIORITY}, +}); # The priority used to look like z60_; # we need to calculate that old value to handle @@ -76,7 +78,7 @@ $old_priority.="_"; } -# PROMISE: DH NOOP WITHOUT udev +# PROMISE: DH NOOP WITHOUT udev cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installwm debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installwm --- debhelper-11.1.6ubuntu1/dh_installwm 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installwm 2018-12-18 19:49:57.000000000 +0000 @@ -49,6 +49,11 @@ Do not modify F/F scripts. Turns this command into a no-op. +=item B<-A>, B<--all> + +Modify scripts for window managers specified by command line +parameters in ALL packages acted on, not just the first. + =item I ... Window manager programs to register. @@ -63,7 +68,9 @@ =cut -init(); +init(options => { + "priority=s" => \$dh{PRIORITY}, +}); if (! defined $dh{PRIORITY}) { $dh{PRIORITY}=20; @@ -79,7 +86,7 @@ my $nodocs = is_build_profile_active('nodoc') || get_buildoption('nodoc') ? 1 : 0; -# PROMISE: DH NOOP WITHOUT wm +# PROMISE: DH NOOP WITHOUT wm cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); diff -Nru debhelper-11.1.6ubuntu1/dh_installxfonts debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installxfonts --- debhelper-11.1.6ubuntu1/dh_installxfonts 2018-03-29 15:17:29.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_installxfonts 2018-12-18 19:49:57.000000000 +0000 @@ -49,7 +49,7 @@ init(); -# PROMISE: DH NOOP WITHOUT tmp(usr/share/fonts/X11) +# PROMISE: DH NOOP WITHOUT tmp(usr/share/fonts/X11) cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); @@ -86,7 +86,7 @@ { 'CMDS' => join(";", @cmds, @cmds_postrm) }); if (@cmds_postrm) { - addsubstvar($package, "misc:Depends", "xfont-utils", ">= 1:7.5+2"); + addsubstvar($package, "misc:Depends", "xfonts-utils", ">= 1:7.5+2"); } else { addsubstvar($package, "misc:Depends", "xfonts-utils"); } diff -Nru debhelper-11.1.6ubuntu1/dh_link debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_link --- debhelper-11.1.6ubuntu1/dh_link 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_link 2018-12-18 19:49:57.000000000 +0000 @@ -56,7 +56,7 @@ In each pair the source file (called B by L) comes first and is followed by the destination file (called B by L). Thus the pairs of source and destination files in each line -are give in the same order as they would be given to L. +are given in the same order as they would be given to L. In contrast to L, source and destination paths must be absolute (the leading slash is optional). diff -Nru debhelper-11.1.6ubuntu1/dh_lintian debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_lintian --- debhelper-11.1.6ubuntu1/dh_lintian 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_lintian 2018-12-18 19:49:57.000000000 +0000 @@ -42,7 +42,7 @@ init(); -# PROMISE: DH NOOP WITHOUT lintian-overrides +# PROMISE: DH NOOP WITHOUT lintian-overrides cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { next if is_udeb($package); diff -Nru debhelper-11.1.6ubuntu1/dh_listpackages debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_listpackages --- debhelper-11.1.6ubuntu1/dh_listpackages 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_listpackages 2018-07-22 18:26:51.000000000 +0000 @@ -23,6 +23,8 @@ will change the list to match the packages other debhelper commands would act on if passed the same options. +Packages are listed in the order they appear in F. + =cut $dh{BLOCK_NOOP_WARNINGS}=1; diff -Nru debhelper-11.1.6ubuntu1/dh_makeshlibs debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_makeshlibs --- debhelper-11.1.6ubuntu1/dh_makeshlibs 2018-01-22 07:17:56.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_makeshlibs 2018-07-22 18:26:51.000000000 +0000 @@ -64,24 +64,70 @@ =item B<--version-info>, B<--version-info=>I -By default, the shlibs file generated by this program does not make packages -depend on any particular version of the package containing the shared -library. It may be necessary for you to add some version dependency -information to the shlibs file. If B<-V> is specified with no dependency -information, the current upstream version of the package is plugged into a -dependency that looks like "I B<(E>= IB<)>". Note that in -debhelper compatibility levels before v4, the Debian part of the package -version number is also included. If B<-V> is specified with parameters, the -parameters can be used to specify the exact dependency information needed -(be sure to include the package name). - -Beware of using B<-V> without any parameters; this is a conservative setting -that always ensures that other packages' shared library dependencies are at -least as tight as they need to be (unless your library is prone to changing -ABI without updating the upstream version number), so that if the -maintainer screws up then they won't break. The flip side is that packages -might end up with dependencies that are too tight and so find it harder to -be upgraded. +If a shlibs file is generated by this program, this option controls +what version will be used in the dependency relation. + +In compat 12 and later, B defaults to B<-VUpstream-Version>. +In compat 11 and earlier the default behaved like B<-VNone>.. + +The B tool can generate dependencies in three variants: + +=over 4 + +=item B<-VUpstream-Version> + +The dependency will be "I B<(E>= IB<)>". +Note that I is case-sensitive and must be written +exactly as shown here. + +This is a conservative setting that always ensures that other packages' +shared library dependencies are at least as tight as they need to be +(unless the library is prone to changing ABI without updating the +upstream version number). + +The flip side is that packages might end up with dependencies that are +too tight in some cases (note a symbols file can mitigate this issue). +This is often of minor temporary inconvenience and usually a lot +better than the fall out caused by forgetting to bump the dependency +information. + +This explicit form was added in debhelper/11.3. In previous versions, +a B<-V> without any dependency information was used instead (and that +form still works) + +=item B<-VNone> + +The dependency will be "I". Note that I is +case-sensitive and must be written exactly as shown here. + +This form is generally unsafe with the only exception being if upstream +does not extend the ABI in any way. However, most upstreams improve their +interfaces over time and packagers are recommended to use +B<-VUpstream-Version> (or one of the other forms of B<-V>I). + +Alternatively, this may be sufficient if (and only if) the package uses +symbol versioning (see L) and does I build any +udeb packages. Note that symbols are not supported for udeb packages, +which solely relies on shlibs for dependency handling. + +=item B<-V>I + +In this case, the value passed to B<-V> will be used as a dependency +relation. The I should generally be of the form +"I B<(E>= IB<)>". Remember +to include the package name. + +Note that debhelper will use the value I with no sanity +checking or modification. In I cases, this is needed to +generate a dependency on a different package than the one containing +the library. + +=back + +When choosing a value for this option, please keep mind that if the +package provides a symbols file, then that it generally preferred over +the shlibs file for regular .deb packages. See L +for more information on this topic. =item B<-n>, B<--no-scripts> @@ -110,13 +156,13 @@ =over 4 -=item B +=item B Assuming this is a package named F, generates a shlibs file that looks something like: libfoobar 1 libfoobar1 -=item B +=item B Assuming the current version of the package is 1.1-3, generates a shlibs file that looks something like: @@ -149,6 +195,10 @@ my (%seen, $unversioned_so); my $need_ldconfig = 0; + # Note that since each package can have a shlibs file independently of + # each other, we need to make these local. + my $v_flag_set = $dh{V_FLAG_SET}; + my $v_flag = $dh{V_FLAG} // ''; my $shlibs_file = pkgfile($package, 'shlibs'); rm_files("$tmp/DEBIAN/shlibs"); @@ -190,18 +240,22 @@ } my $deps=$package; - if ($dh{V_FLAG_SET}) { + if ($v_flag_set) { if ($shlibs_file) { warning("The provided ${shlibs_file} file overwrites -V"); - # Clear the flag to avoid duplicate warnings. Note - # we can safely fallthrough as the result will be - # replaced regardless. - $dh{V_FLAG_SET} = 0; + # Clear the flag to avoid duplicate warnings. + $v_flag_set = 0; + $v_flag = ''; + } else { + # Set the default "-V" (with no value) is passed. + $v_flag = 'Upstream-Version' if $v_flag eq ''; } - if ($dh{V_FLAG} ne '') { - $deps=$dh{V_FLAG}; - } - else { + } elsif ($v_flag eq '') { + # Set the default if "-V" is omitted. + $v_flag = compat(11) ? 'None' : 'Upstream-Version'; + } + if ($v_flag ne '') { + if ($v_flag eq 'Upstream-Version') { # Call isnative because it sets $dh{VERSION} # as a side effect. isnative($package); @@ -210,7 +264,9 @@ # debian revision, while new do not. # Remove debian version, if any. $version =~ s/-[^-]+$//; - $deps="$package (>= $version)"; + $deps = "$package (>= $version)"; + } elsif ($v_flag ne 'None') { + $deps = $v_flag; } } if (defined($library) && defined($major) && defined($deps) && diff -Nru debhelper-11.1.6ubuntu1/dh_md5sums debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_md5sums --- debhelper-11.1.6ubuntu1/dh_md5sums 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_md5sums 2018-12-18 19:49:57.000000000 +0000 @@ -61,51 +61,59 @@ install_dir("$tmp/DEBIAN"); # Check if we should exclude conffiles. - my $exclude=""; + my %conffiles; if (! $dh{INCLUDE_CONFFILES} && -r "$tmp/DEBIAN/conffiles") { # Generate exclude regexp. open(my $fd, '<', "$tmp/DEBIAN/conffiles") or die("open $tmp/DEBIAN/conffiles failed: $!"); - while (<$fd>) { - chomp; - s/^\///; - $exclude.="! -path \"./$_\" "; + while (my $line = <$fd>) { + chomp($line); + $line =~ s/^\///; + $conffiles{$line} = 1; } close($fd); } - # See if we should exclude other files. - if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') { - $exclude.="! \\( $dh{EXCLUDE_FIND} \\) "; - } - - my $find="find . -type f $exclude ! -regex './DEBIAN/.*' -printf '%P\\0'"; - complex_doit("(cd $tmp >/dev/null ; $find | LC_ALL=C sort -z | xargs -r0 md5sum | " . - q{perl -pe 'if (s@^\\\\@@) { s/\\\\\\\\/\\\\/g; }' > DEBIAN/md5sums) >/dev/null}); - # If the file's empty, no reason to waste inodes on it. - if (-z "$tmp/DEBIAN/md5sums") { - rm_files("$tmp/DEBIAN/md5sums"); - } - else { - reset_perm_and_owner(0644, "$tmp/DEBIAN/md5sums"); - } + generate_md5sums_file($tmp, \%conffiles); if ( -d $dbgsym_tmp) { install_dir("${dbgsym_tmp}/DEBIAN"); - - $find = "find . -type f ! -regex './DEBIAN/.*' -printf '%P\\0'"; - complex_doit("(cd $dbgsym_tmp >/dev/null ; $find | LC_ALL=C sort -z | xargs -r0 md5sum | " . - q{perl -pe 'if (s@^\\\\@@) { s/\\\\\\\\/\\\\/g; }' > DEBIAN/md5sums) >/dev/null}); - # If the file's empty, no reason to waste inodes on it. - if (-z "${dbgsym_tmp}/DEBIAN/md5sums") { - rm_files("${dbgsym_tmp}/DEBIAN/md5sums"); - } - else { - reset_perm_and_owner(0644, "${dbgsym_tmp}/DEBIAN/md5sums"); - } + generate_md5sums_file($dbgsym_tmp); } } }; +sub generate_md5sums_file { + my ($tmpdir, $conffiles) = @_; + my $find_pid = open(my $find_fd, '-|') // error("fork failed: $!"); + my (@files, $pipeline_pid); + if (not $find_pid) { + # Child + chdir($tmpdir) or error("chdir($tmpdir) failed: $!"); + exec { 'find' } 'find', '-type', 'f', '!', '-regex', './DEBIAN/.*', '-printf', "%P\\0"; + } + local $/ = "\0"; # NUL-terminated input/"lines" + while (my $line = <$find_fd>) { + chomp($line); + next if excludefile($line); + next if $conffiles and %{$conffiles} and exists($conffiles->{$line}); + push(@files, $line); + } + close($find_fd) or error_exitcode("find -type f ! -regex './DEBIAN/.*' -printf '%P\\0'"); + @files = sort(@files); + verbose_print("cd $tmpdir >/dev/null && " . q{xargs -r0 md5sum | perl -pe 'if (s@^\\\\@@) { s/\\\\\\\\/\\\\/g; }' > DEBIAN/md5sums}); + $pipeline_pid = open(my $pipeline_fd, '|-') // error("fork failed: $!"); + if (not $pipeline_pid) { + # Child + chdir($tmpdir) or error("chdir($tmpdir) failed: $!"); + exec { 'sh' } '/bin/sh', '-c', q{xargs -r0 md5sum | perl -pe 'if (s@^\\\\@@) { s/\\\\\\\\/\\\\/g; }' > DEBIAN/md5sums}; + } + + printf {$pipeline_fd} "%s\0", $_ for @files; # @files include NUL-terminator + close($pipeline_fd) or error_exitcode("cd $tmpdir >/dev/null && xargs -r0 md5sum | perl -pe 'if (s@^\\\\@@) { s/\\\\\\\\/\\\\/g; }' > DEBIAN/md5sums"); + reset_perm_and_owner(0644, "${tmpdir}/DEBIAN/md5sums"); + return; +} + =head1 SEE ALSO L diff -Nru debhelper-11.1.6ubuntu1/dh_missing debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_missing --- debhelper-11.1.6ubuntu1/dh_missing 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_missing 2019-02-09 11:11:23.000000000 +0000 @@ -21,9 +21,11 @@ B compares the list of installed files with the files in the source directory. If any of the files (and symlinks) in the source directory were not installed to somewhere, it will warn on stderr -about that (B<--list-missing>) or fail (B<--fail-missing>). Please -note that without either of these options, B will silently -do nothing. +about that (B<--list-missing>) or fail (B<--fail-missing>). + +Please note that in compat 11 and earlier without either of these +options, B will silently do nothing. From compat 12 on, +B<--list-missing> is the default. This may be useful if you have a large package and want to make sure that you don't miss installing newly added files in new upstream releases. @@ -57,8 +59,12 @@ Warn on stderr about source files not installed to somewhere. -Note that files that are excluded from being moved via the B<-X> option are not -warned about. +Note that many dh-tools acting on a path will mark the path as +installed even if it has been excluded via B<-X> or B<--exclude>. +This is also seen when a dh-tool is acting on a directory and +exclusion is used to ignore some files in the directory. In either +case, this will make B silently assume the excluded files +have been handled. This is the default in compat 12 and later. diff -Nru debhelper-11.1.6ubuntu1/dh_strip debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_strip --- debhelper-11.1.6ubuntu1/dh_strip 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_strip 2019-02-09 10:16:40.000000000 +0000 @@ -137,7 +137,7 @@ =cut init(options => { - "keep-debug" => \$dh{K_FLAG}, + 'keep-debug|keep|k' => \$dh{K_FLAG}, 'dbgsym-migration=s' => \$dh{MIGRATE_DBGSYM}, 'automatic-dbgsym!' => \$dh{ENABLE_DBGSYM}, # Deprecated variants @@ -291,6 +291,7 @@ } else { # For dbgsyms, we need build-id (else it will not be # co-installable). + warning("Could not find the BuildID in $file"); return if $use_build_id > 1; } } @@ -374,6 +375,14 @@ doit($strip, '--strip-debug', '--remove-section=.comment', '--remove-section=.note', '--enable-deterministic-archives', $_); } + if (-d "$tmp/usr/lib/debug/.dwz" and ($use_build_id > 1 or $dh{DEBUGPACKAGE})) { + my @files = glob_expand(["$tmp/usr/lib/debug/.dwz"], \&glob_expand_error_handler_reject, '*'); + install_dir("$debugtmp/usr/lib/debug/.dwz"); + xargs(\@files, 'cp', '--reflink=auto', "-a", XARGS_INSERT_PARAMS_HERE, "$debugtmp/usr/lib/debug/.dwz"); + doit('rm', '-fr', "$tmp/usr/lib/debug/.dwz"); + doit('rmdir', '-p', '--ignore-fail-on-non-empty', "$tmp/usr/lib/debug"); + } + if ($no_auto_dbgsym and $use_build_id > 1) { # When DEB_BUILD_OPTIONS contains noautodbgsym, remove the # dbgsym dir and clear the build-ids. diff -Nru debhelper-11.1.6ubuntu1/dh_systemd_start debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_systemd_start --- debhelper-11.1.6ubuntu1/dh_systemd_start 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_systemd_start 2018-12-18 19:49:57.000000000 +0000 @@ -232,13 +232,24 @@ # The $package and $sed parameters are always the same. # This wrapper function makes the following logic easier to read. my $sd_autoscript = sub { - my ($script, $filename) = @_; - autoscript($package, $script, $filename, { 'UNITFILES' => $unitargs }); + my ($script, $filename, $restart_action) = @_; + my $replace = { + 'UNITFILES' => $unitargs, + 'RESTART_ACTION' => $restart_action // '', + }; + autoscript($package, $script, $filename, $replace); }; if ($dh{RESTART_AFTER_UPGRADE}) { - my $snippet = "postinst-systemd-restart" . ($dh{NO_START} ? "nostart" : ""); - $sd_autoscript->("postinst", $snippet); + my ($snippet, $restart_action); + if ($dh{NO_START}) { + $snippet = 'postinst-systemd-restartnostart'; + $restart_action = 'try-restart'; + } else { + $snippet = 'postinst-systemd-restart'; + $restart_action = 'restart'; + } + $sd_autoscript->("postinst", $snippet, $restart_action); } elsif (!$dh{NO_START}) { # We need to stop/start before/after the upgrade. $sd_autoscript->("postinst", "postinst-systemd-start"); diff -Nru debhelper-11.1.6ubuntu1/dh_testroot debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_testroot --- debhelper-11.1.6ubuntu1/dh_testroot 2018-02-20 19:52:41.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_testroot 2018-09-02 07:02:06.000000000 +0000 @@ -12,33 +12,52 @@ =head1 DESCRIPTION -B is used to determine if the package has access to at -least the level of root access that it declared it needed via the -Rules-Requires-Root (R³) field. +B is used to determine if the target is being run with +sufficient access to (fake)root. -The following is how B behaves based on the effective -value of the R³ field: +The definition of sufficient access depends on whether the builder +(the tool invoking the F target) supports the +I (R³) field. If the builder supports R³, then +it will set the environment variable I and +B will validate that the builder followed the minimum +requirements for the given value of I. + +If the builder does not support I, then it will +not set the I environment variable. This +will in turn make B (and the rest of debhelper) fall back +to assuming that (fake)root is implied. + +The following is a summary of how B behaves based on the +I environment variable (leading and trailing +whitespace in the variable is ignored). =over 4 -=item "binary-targets" +=item - -B asserts that it is run as root or under L. +If unset, or set to C, then B asserts +that it is run as root or under L. -=item "no" +=item - -B returns successfully. +If set to C, then B returns successfully (without +performing any additional checks). -=item Any other value than the above +=item - -B asserts that it is either run as root (or under -L) or the builder has provided the B -environment variable (e.g. via dpkg-buildpackage -r). +If set to any other value than the above, then B asserts +that it is either run as root (or under L) or the builder +has provided the B environment variable (e.g. via +dpkg-buildpackage -r). =back -For backwards compatibility, B will consider the absence -of the R³ field as if the R³ field was set to "binary-targets". +Please note that B does I read the +I field. Which implies that B may +produce incorrect result if the builder lies in +I. On the flip side, it also enables things +like testing for what will happen when I is +set to a given value. =cut diff -Nru debhelper-11.1.6ubuntu1/dh_ucf debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_ucf --- debhelper-11.1.6ubuntu1/dh_ucf 2018-03-29 15:15:40.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_ucf 2018-12-18 19:49:57.000000000 +0000 @@ -67,7 +67,7 @@ init(); -# PROMISE: DH NOOP WITHOUT ucf +# PROMISE: DH NOOP WITHOUT ucf cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $file=pkgfile($package,"ucf"); diff -Nru debhelper-11.1.6ubuntu1/dh_usrlocal debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_usrlocal --- debhelper-11.1.6ubuntu1/dh_usrlocal 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/dh_usrlocal 2018-12-18 19:49:57.000000000 +0000 @@ -33,18 +33,19 @@ L for an explanation of debhelper maintainer script snippets. -When the I field is not (effectively) -I, the directories in F will have -ownership root:staff and the mode will be 02775. These values have -been chosen to comply with the recommendations of the Debian policy -for directories in F. +When the I environment variable is not (effectively) +I, the directories in F will be handled as if +they were owned by root:root (see below). -When I has an effective value of +When the I environment variable has an effective value of I, the owners, groups and permissions will be -preserved with one exception. If the directory is owned by root:root, -then ownership will be reset to root:staff and mode will be reset to -02775. This is useful, since that is the group and mode policy -recommends for directories in F. +preserved with the sole exception where the directory is owned by root:root. + +If a directory is owned by root:root, then ownership will be determined +at install time. The ownership and permission bits will either be root:root +mode 0755 or root:staff mode 02775. The actual choice depends on whether +the system has F (as documented in the Debian +Policy Manual §9.1.2 since version 4.1.4) =head1 OPTIONS @@ -70,61 +71,64 @@ init(); -# PROMISE: DH NOOP WITHOUT tmp(usr/local) +# PROMISE: DH NOOP WITHOUT tmp(usr/local) cli-options() foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp = tmpdir($package); if (-d "$tmp/usr/local") { my (@dirs, @justdirs); - find({bydepth => 1, - no_chdir => 1, - wanted => sub { - my $fn = $File::Find::name; - if (-d $fn) { - my $user = 'root'; - my $group = 'staff'; - my $mode = '02775'; - if (should_use_root()) { - my $stat = stat $fn; - $user = getpwuid $stat->uid; - $group = getgrgid $stat->gid; - $mode = sprintf "%04lo", ($stat->mode & 07777); - if ($stat->uid == 0 && $stat->gid == 0) { - $group = 'staff'; - $mode = '02775'; - } - } - - - - $fn =~ s!^\Q$tmp\E!!; - return if $fn eq '/usr/local'; - - # @dirs is in parents-first order for dir creation... - unshift @dirs, "$fn $mode $user $group"; - # ...whereas @justdirs is depth-first for removal. - push @justdirs, $fn; - doit('rmdir', $_); - } - else { - warning("$fn is not a directory"); - } + find({no_chdir => 1, + preprocess => sub { + # Ensure a reproducible traversal. + return sort @_; + }, + postprocess => sub { + # Uninstall, unless a direct child of /usr/local. + $_ = $File::Find::dir; + s!^\Q$tmp\E!!; + push @justdirs, $_ if m!/usr/local/.*/!; + # Remove a directory after its childs. + doit('rmdir', $File::Find::dir); + }, + wanted => sub { + # rmdir would fail later anyways. + error("${File::Find::name} is not a directory") + if not -d $File::Find::name; + # Install directory before its childs. + my $fn = $File::Find::name; + $fn =~ s!^\Q$tmp\E!!; + return if $fn eq '/usr/local'; + # Detect some obvious cases of "this will not end + # well". We rely on what "while read dir ... ; do" + # can handle for correctness. + if ($fn =~ m{[\s!'"\$()*#;<>?@\[\]\\`|]}) { + error("Cannot generate a correct shell script for $fn due to shell metacharacters"); + } + if (should_use_root()) { + my $stat = stat $File::Find::dir; + if ($stat->uid == 0 && $stat->gid == 0) { + # Figure out the ownership and permission at runtime + # (required by Policy 9.1.2) + push(@dirs, "$fn default"); + } else { + my $user = getpwuid $stat->uid; + my $group = getgrgid $stat->gid; + my $mode = sprintf "%04lo", ($stat->mode & 07777); + push @dirs, "$fn $mode $user $group"; + } + } else { + # Figure out the ownership and permission at runtime + # (required by Policy 9.1.2) + push(@dirs, "$fn default"); + } }}, "$tmp/usr/local"); - doit('rmdir', "$tmp/usr/local"); - - my $bs = "\\"; # A single plain backslash - my $ebs = $bs x 2; # Escape the backslash from the shell - # This constructs the body of a 'sed' c\ expression which - # is parsed by the shell in double-quotes - my $dirs = join("$ebs\n", sort @dirs); - pop @justdirs; # don't remove directories directly in /usr/local - my $justdirs = join("$ebs\n", reverse sort @justdirs); + if (! $dh{NOSCRIPTS}) { autoscript($package,"postinst", "postinst-usrlocal", - "/#DIRS#/ c${ebs}\n${dirs}"); + { 'DIRS' => join ("\n", @dirs)}) if @dirs; autoscript($package,"prerm", "prerm-usrlocal", - "/#JUSTDIRS#/ c${ebs}\n${justdirs}") if length $justdirs; + { 'JUSTDIRS' => join ("\n", @justdirs)}) if @justdirs; } } } diff -Nru debhelper-11.1.6ubuntu1/doc/PROGRAMMING debhelper-12.1.1ubuntu1~ubuntu18.04.1/doc/PROGRAMMING --- debhelper-11.1.6ubuntu1/doc/PROGRAMMING 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/doc/PROGRAMMING 2018-12-18 19:49:57.000000000 +0000 @@ -114,7 +114,6 @@ only be used inside complex_doit(), not in doit(). -d D_FLAG you decide what this means to your program --k K_FLAG used to turn on keeping of something -P TMPDIR package build directory (implies only one package is being acted on) -u U_PARAMS will be set to a string, that is typically @@ -129,7 +128,6 @@ those processed here), will apply to all binary packages the program acts on, not just the first ---priority PRIORITY will be set to a number --mainpackage MAINPACKAGE controls which package is treated as the main package to act on --name NAME a name to use for installed files, instead of @@ -186,7 +184,7 @@ complex_doit($command) Pass this function a string that is a shell command, it will run it similarly to how doit() does. You can pass more complicated commands - to this (ie, commands involving piping redirection), however, you + to this (i.e. commands involving piping redirection), however, you have to worry about things like escaping shell metacharacters. verbose_print($message) Pass this command a string, and it will echo it if $dh{VERBOSE} is set. @@ -232,7 +230,7 @@ # PROMISE: DH NOOP WITHOUT pkgfilea pkgfile-logged(pkgfileb) tmp(need/this) The "pkgfile-logged" hint notifies dh that the helper logs these files - via "log_intalled_files". This means dh will sometimes need to run it + via "log_installed_files". This means dh will sometimes need to run it even when it is a NO OP because it has to log what it would have installed to avoid dh_missing complaining about missing files. @@ -279,7 +277,7 @@ - binary package that gets the item - name of the substvar to add the item to - the package that will be depended on - - version info for the package (optional) (ie: ">= 1.1") + - version info for the package (optional) (i.e. ">= 1.1") - if this last parameter is passed, the thing that would be added is removed instead. This can be useful to ensure that a debhelper command is idempotent. (However, we generally don't bother, @@ -340,7 +338,7 @@ install_dir($dir) Create the directory denoted by the path $dir and all parent entries as well (as needed). - If the directory already exists, the function does not. + If the directory already exists, the function does nothing. install_file($src, $dest) Installs $src into $dest with mode 0644. The parent dir of $dest must exist (can be created with install_dir). @@ -361,8 +359,7 @@ The file owner and group is set to "root:root". The change is only done on the exact paths listed (i.e. it is *not* recursive). - To avoid issue, please pass mode as a string (i.e. '0755' - rather than 0755). + Mode should be passed as an integer (not a string). open_gz($file) Open $file, read from it as a gzip-compressed file and return the file handle. @@ -382,7 +379,7 @@ processing of $package, which installed the files listed in @paths. This logfile will later be used by the dh_missing helper. Paths should be relative to the package root (i.e. the directory - containing "debian/") and should not have superflouos segments + containing "debian/") and should not have superfluous segments (e.g. avoid "foo/../bar" or "foo/./bar") If a directory is listed, it and all paths recursively beneath is also considered installed. @@ -475,8 +472,9 @@ * Replace "@{$dh{DOPACKAGES}}" with "getpackages()" and use "process_pkg($package)" to determine if the helper should actually install anything. - * Call "log_installed_files" once per package (even once that are not to - be acted on) with a list of source files that would be installed. + * Call "log_installed_files" once per package (even on the ones that + are not to be acted on) with a list of source files that would be + installed. - You can list entire directories even if there are files under it that are ignored. - Please call "log_installed_files" /even if/ the list is empty for that diff -Nru debhelper-11.1.6ubuntu1/.gitlab-ci.yml debhelper-12.1.1ubuntu1~ubuntu18.04.1/.gitlab-ci.yml --- debhelper-11.1.6ubuntu1/.gitlab-ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/.gitlab-ci.yml 2018-10-24 18:30:29.000000000 +0000 @@ -0,0 +1,23 @@ +tests-stable-backports: + stage: test + image: debian:stable-backports + script: + - apt-get update + - apt-get build-dep -y . + - dpkg-buildpackage -us -uc -tc + +tests-testing: + stage: test + image: debian:testing + script: + - apt-get update + - apt-get build-dep -y . + - dpkg-buildpackage -us -uc -tc + +tests-unstable: + stage: test + image: debian:unstable + script: + - apt-get update + - apt-get build-dep -y . + - dpkg-buildpackage -us -uc -tc diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/autoconf.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/autoconf.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/autoconf.pm 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/autoconf.pm 2018-12-18 19:49:57.000000000 +0000 @@ -8,7 +8,7 @@ use strict; use warnings; -use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value sourcepackage compat); +use Debian::Debhelper::Dh_Lib qw(%dh dpkg_architecture_value sourcepackage compat); use parent qw(Debian::Debhelper::Buildsystem::makefile); sub DESCRIPTION { @@ -38,7 +38,7 @@ push @opts, "--infodir=\${prefix}/share/info"; push @opts, "--sysconfdir=/etc"; push @opts, "--localstatedir=/var"; - if (defined $ENV{DH_QUIET} && $ENV{DH_QUIET} ne "") { + if ($dh{QUIET}) { push @opts, "--enable-silent-rules"; } else { push @opts, "--disable-silent-rules"; @@ -47,10 +47,10 @@ if (! compat(8)) { if (defined $multiarch) { push @opts, "--libdir=\${prefix}/lib/$multiarch"; - push @opts, "--libexecdir=\${prefix}/lib/$multiarch"; + push(@opts, "--libexecdir=\${prefix}/lib/$multiarch") if compat(11); } else { - push @opts, "--libexecdir=\${prefix}/lib"; + push(@opts, "--libexecdir=\${prefix}/lib") if compat(11); } } else { diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/cmake.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/cmake.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/cmake.pm 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/cmake.pm 2018-12-18 19:49:57.000000000 +0000 @@ -8,12 +8,11 @@ use strict; use warnings; -use Debian::Debhelper::Dh_Lib qw(compat dpkg_architecture_value error is_cross_compiling); -use parent qw(Debian::Debhelper::Buildsystem::makefile); +use Debian::Debhelper::Dh_Lib qw(%dh compat dpkg_architecture_value error is_cross_compiling); +use parent qw(Debian::Debhelper::Buildsystem); my @STANDARD_CMAKE_FLAGS = qw( -DCMAKE_INSTALL_PREFIX=/usr - -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var @@ -27,16 +26,39 @@ 'hurd' => 'GNU', ); +my %GNU_CPU2SYSTEM_PROCESSOR = ( + 'powerpc64le' => 'ppc64le', +); + +my %TARGET_BUILD_SYSTEM2CMAKE_GENERATOR = ( + 'makefile' => 'Unix Makefiles', + 'ninja' => 'Ninja', +); + sub DESCRIPTION { "CMake (CMakeLists.txt)" } +sub IS_GENERATOR_BUILD_SYSTEM { + return 1; +} + +sub SUPPORTED_TARGET_BUILD_SYSTEMS { + return qw(makefile ninja); +} + sub check_auto_buildable { my $this=shift; my ($step)=@_; if (-e $this->get_sourcepath("CMakeLists.txt")) { my $ret = ($step eq "configure" && 1) || - $this->SUPER::check_auto_buildable(@_); + $this->get_targetbuildsystem->check_auto_buildable(@_); + if ($this->check_auto_buildable_clean_oos_buildir(@_)) { + # Assume that the package can be cleaned (i.e. the build directory can + # be removed) as long as it is built out-of-source tree and can be + # configured. + $ret++ if not $ret; + } # Existence of CMakeCache.txt indicates cmake has already # been used by a prior build step, so should be used # instead of the parent makefile class. @@ -57,11 +79,25 @@ my $this=shift; # Standard set of cmake flags my @flags = @STANDARD_CMAKE_FLAGS; + my $backend = $this->get_targetbuildsystem->NAME; if (not compat(10)) { push(@flags, '-DCMAKE_INSTALL_RUNSTATEDIR=/run'); } + if (exists($TARGET_BUILD_SYSTEM2CMAKE_GENERATOR{$backend})) { + my $generator = $TARGET_BUILD_SYSTEM2CMAKE_GENERATOR{$backend}; + push(@flags, "-G${generator}"); + } + unless ($dh{QUIET}) { + push(@flags, "-DCMAKE_VERBOSE_MAKEFILE=ON"); + } + if ($ENV{CC}) { + push @flags, "-DCMAKE_C_COMPILER=" . $ENV{CC}; + } + if ($ENV{CXX}) { + push @flags, "-DCMAKE_CXX_COMPILER=" . $ENV{CXX}; + } if (is_cross_compiling()) { my $deb_host = dpkg_architecture_value("DEB_HOST_ARCH_OS"); if (my $cmake_system = $DEB_HOST2CMAKE_SYSTEM{$deb_host}) { @@ -69,21 +105,23 @@ } else { error("Cannot cross-compile - CMAKE_SYSTEM_NAME not known for ${deb_host}"); } - push @flags, "-DCMAKE_SYSTEM_PROCESSOR=" . dpkg_architecture_value("DEB_HOST_GNU_CPU"); - if ($ENV{CC}) { - push @flags, "-DCMAKE_C_COMPILER=" . $ENV{CC}; + my $gnu_cpu = dpkg_architecture_value("DEB_HOST_GNU_CPU"); + if (exists($GNU_CPU2SYSTEM_PROCESSOR{$gnu_cpu})) { + push @flags, "-DCMAKE_SYSTEM_PROCESSOR=" . $GNU_CPU2SYSTEM_PROCESSOR{$gnu_cpu}; } else { + push @flags, "-DCMAKE_SYSTEM_PROCESSOR=${gnu_cpu}"; + } + if (not $ENV{CC}) { push @flags, "-DCMAKE_C_COMPILER=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-gcc"; } - if ($ENV{CXX}) { - push @flags, "-DCMAKE_CXX_COMPILER=" . $ENV{CXX}; - } else { + if (not $ENV{CXX}) { push @flags, "-DCMAKE_CXX_COMPILER=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-g++"; } push(@flags, "-DPKG_CONFIG_EXECUTABLE=/usr/bin/" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-pkg-config"); push(@flags, "-DPKGCONFIG_EXECUTABLE=/usr/bin/" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-pkg-config"); - push(@flags, "-DCMAKE_INSTALL_LIBDIR=lib/" . dpkg_architecture_value("DEB_HOST_MULTIARCH")); + push(@flags, "-DQMAKE_EXECUTABLE=/usr/bin/" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-qmake"); } + push(@flags, "-DCMAKE_INSTALL_LIBDIR=lib/" . dpkg_architecture_value("DEB_HOST_MULTIARCH")); # CMake doesn't respect CPPFLAGS, see #653916. if ($ENV{CPPFLAGS} && ! compat(8)) { @@ -93,7 +131,7 @@ $this->mkdir_builddir(); eval { - $this->doit_in_builddir("cmake", $this->get_source_rel2builddir(), @flags, @_); + $this->doit_in_builddir("cmake", @flags, @_, $this->get_source_rel2builddir()); }; if (my $err = $@) { if (-e $this->get_buildpath("CMakeCache.txt")) { @@ -111,13 +149,16 @@ sub test { my $this=shift; - - # Unlike make, CTest does not have "unlimited parallel" setting (-j implies - # -j1). So in order to simulate unlimited parallel, allow to fork a huge - # number of threads instead. - my $parallel = ($this->get_parallel() > 0) ? $this->get_parallel() : 999; + my $target = $this->get_targetbuildsystem; $ENV{CTEST_OUTPUT_ON_FAILURE} = 1; - return $this->SUPER::test(@_, "ARGS+=-j$parallel"); + if ($target->NAME eq 'makefile') { + # Unlike make, CTest does not have "unlimited parallel" setting (-j implies + # -j1). So in order to simulate unlimited parallel, allow to fork a huge + # number of threads instead. + my $parallel = ($this->get_parallel() > 0) ? $this->get_parallel() : 999; + push(@_, "ARGS+=-j$parallel") + } + return $this->SUPER::test(@_); } 1 diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/makefile.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/makefile.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/makefile.pm 2018-02-24 15:58:51.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/makefile.pm 2018-12-02 14:45:30.000000000 +0000 @@ -84,9 +84,6 @@ if ($parallel == 0 or $parallel > 1) { # We have to use the empty string for "unlimited" $parallel = '' if $parallel == 0; - # -O is for synchronizing the output; only if STDOUT - # is not a TTY - unshift(@_, '-O') if not -t STDOUT; unshift(@_, "-j${parallel}"); } else { unshift(@_, '-j1'); @@ -134,9 +131,8 @@ # This is always called in the source directory, but generally # Makefiles are created (or live) in the build directory. return 1; - } elsif ($step eq "clean" && defined $this->get_builddir() && - $this->check_auto_buildable("configure")) - { + } elsif ($this->check_auto_buildable_clean_oos_buildir(@_) + and $this->check_auto_buildable('configure')) { # Assume that the package can be cleaned (i.e. the build directory can # be removed) as long as it is built out-of-source tree and can be # configured. This is useful for derivative buildsystems which diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/meson.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/meson.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/meson.pm 2018-02-12 18:17:45.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/meson.pm 2019-02-09 10:57:55.000000000 +0000 @@ -7,13 +7,22 @@ use strict; use warnings; -use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value is_cross_compiling doit warning error generated_file); -use parent qw(Debian::Debhelper::Buildsystem::ninja); +use Debian::Debhelper::Dh_Lib qw(compat dpkg_architecture_value is_cross_compiling doit warning error generated_file); +use parent qw(Debian::Debhelper::Buildsystem); sub DESCRIPTION { "Meson (meson.build)" } +sub IS_GENERATOR_BUILD_SYSTEM { + return 1; +} + +sub SUPPORTED_TARGET_BUILD_SYSTEMS { + return qw(ninja); +} + + sub check_auto_buildable { my $this=shift; my ($step)=@_; @@ -22,7 +31,14 @@ # Handle configure explicitly; inherit the rest return 1 if $step eq "configure"; - return $this->SUPER::check_auto_buildable(@_); + my $ret = $this->get_targetbuildsystem->check_auto_buildable(@_); + if ($ret == 0 and $this->check_auto_buildable_clean_oos_buildir(@_)) { + # Assume that the package can be cleaned (i.e. the build directory can + # be removed) as long as it is built out-of-source tree and can be + # configured. + $ret++; + } + return $ret; } sub new { @@ -45,7 +61,7 @@ push @opts, "--localstatedir=/var"; my $multiarch=dpkg_architecture_value("DEB_HOST_MULTIARCH"); push @opts, "--libdir=lib/$multiarch"; - push @opts, "--libexecdir=lib/$multiarch"; + push(@opts, "--libexecdir=lib/$multiarch") if compat(11); if (is_cross_compiling()) { # http://mesonbuild.com/Cross-compilation.html @@ -68,7 +84,7 @@ # Make the file name absolute as meson will be called from the build dir. require Cwd; $cross_file =~ s{^\./}{}; - $cross_file = Cwd::cwd() . "/${cross_file}"; + $cross_file = Cwd::getcwd() . "/${cross_file}"; } push(@opts, '--cross-file', $cross_file); } @@ -88,4 +104,36 @@ } } +sub test { + my $this = shift; + my $target = $this->get_targetbuildsystem; + + eval { + if (compat(12) or $target->name ne 'ninja') { + $target->test(@_); + } else { + # In compat 13 with meson+ninja, we prefer using "meson test" + # over "ninja test" + my %options = ( + update_env => { + 'LC_ALL' => 'C.UTF-8', + } + ); + if ($this->get_parallel() > 0) { + $options{update_env}{MESON_TESTTHREADS} = $this->get_parallel(); + } + $this->doit_in_builddir(\%options, $this->{buildcmd}, "test", @_); + } + }; + if (my $err = $@) { + if (-e $this->get_buildpath("meson-logs/testlog.txt")) { + $this->doit_in_builddir('tail', '-v', '-n', '+0', 'meson-logs/testlog.txt'); + } + die $err; + } + return 1; +} + + + 1 diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/ninja.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/ninja.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/ninja.pm 2018-01-20 14:08:32.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/ninja.pm 2018-06-30 11:01:59.000000000 +0000 @@ -30,14 +30,6 @@ # This is always called in the source directory, but generally # Ninja files are created (or live) in the build directory. return 1; - } elsif ($step eq "clean" && defined $this->get_builddir() && - $this->check_auto_buildable("configure")) - { - # Assume that the package can be cleaned (i.e. the build directory can - # be removed) as long as it is built out-of-source tree and can be - # configured. This is useful for derivative buildsystems which - # generate Ninja files. - return 1; } return 0; } diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/python_distutils.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/python_distutils.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/python_distutils.pm 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/python_distutils.pm 2018-09-02 07:02:06.000000000 +0000 @@ -10,11 +10,11 @@ use strict; use warnings; use Cwd (); -use Debian::Debhelper::Dh_Lib qw(error); +use Debian::Debhelper::Dh_Lib qw(error deprecated_functionality); use parent qw(Debian::Debhelper::Buildsystem); sub DESCRIPTION { - "Python Distutils (setup.py)" + "Python Distutils (setup.py) [DEPRECATED]" } sub DEFAULT_BUILD_DIRECTORY { @@ -60,6 +60,9 @@ my $this=shift; my $step=shift; + deprecated_functionality('Please use the third-party "pybuild" build system instead of python-distutils', + 12); + return unless grep /$step/, qw(build install clean); if ($this->get_buildpath() ne $this->DEFAULT_BUILD_DIRECTORY()) { diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/qmake.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/qmake.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem/qmake.pm 2018-01-21 08:18:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem/qmake.pm 2018-07-22 18:26:51.000000000 +0000 @@ -8,7 +8,7 @@ use strict; use warnings; -use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value error generated_file is_cross_compiling); +use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value error is_cross_compiling); use parent qw(Debian::Debhelper::Buildsystem::makefile); my %OS_MKSPEC_MAPPING = ( @@ -63,38 +63,6 @@ } else { error("Cannot cross-compile: Missing entry for HOST OS ${host_os} for qmake's -spec option"); } - - my $filename = generated_file('_source', 'qmake-cross.conf'); - my $host_multiarch = dpkg_architecture_value("DEB_HOST_MULTIARCH"); - open(my $fh, '>', $filename) or error("open($filename) failed: $!"); - - $fh->print("[Paths]\n"); - $fh->print("Prefix=/usr\n"); - $fh->print("ArchData=lib/$host_multiarch/qt5\n"); - $fh->print("Binaries=lib/qt5/bin\n"); - $fh->print("Data=share/qt5\n"); - $fh->print("Documentation=share/qt5/doc\n"); - $fh->print("Examples=lib/$host_multiarch/qt5/examples\n"); - $fh->print("Headers=include/$host_multiarch/qt5\n"); - $fh->print("HostBinaries=lib/qt5/bin\n"); - $fh->print("HostData=lib/$host_multiarch/qt5\n"); - $fh->print("HostLibraries=lib/$host_multiarch\n"); - $fh->print("Imports=lib/$host_multiarch/qt5/imports\n"); - $fh->print("Libraries=lib/$host_multiarch\n"); - $fh->print("LibraryExecutables=lib/$host_multiarch/qt5/libexec\n"); - $fh->print("Plugins=lib/$host_multiarch/qt5/plugins\n"); - $fh->print("Qml2Imports=lib/$host_multiarch/qt5/qml\n"); - $fh->print("Settings=/etc/xdg\n"); - $fh->print("Translations=share/qt5/translations\n"); - - close($fh) or error("close($filename) failed: $!"); - if ($filename !~ m{^/}) { - # Make the file name absolute (just in case qmake cares). - require Cwd; - $filename =~ s{^\./}{}; - $filename = Cwd::cwd() . "/${filename}"; - } - push @options, ("-qtconf", $filename); } if ($ENV{CFLAGS}) { @@ -112,25 +80,6 @@ push @flags, "QMAKE_STRIP=:"; push @flags, "PREFIX=/usr"; - if (is_cross_compiling()) { - # qmake calls $$QMAKE_CXX in toolchain.prf to get a list of library/include paths, - # we need -early flag to make sure $$QMAKE_CXX is already properly set on that step. - push @flags, "-early"; - if ($ENV{CC}) { - push @flags, "QMAKE_CC=" . $ENV{CC}; - } else { - push @flags, "QMAKE_CC=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-gcc"; - } - if ($ENV{CXX}) { - push @flags, "QMAKE_CXX=" . $ENV{CXX}; - push @flags, "QMAKE_LINK=" . $ENV{CXX}; - } else { - push @flags, "QMAKE_CXX=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-g++"; - push @flags, "QMAKE_LINK=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-g++"; - } - push @flags, "PKG_CONFIG=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-pkg-config"; - } - $this->mkdir_builddir(); $this->doit_in_builddir($this->_qmake(), @options, @flags, @_); } @@ -145,6 +94,9 @@ } sub _qmake { + if (is_cross_compiling()) { + return dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-qmake"; + } return 'qmake'; } diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Buildsystem.pm 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Buildsystem.pm 2018-12-18 19:49:57.000000000 +0000 @@ -16,13 +16,25 @@ # name. Do not override this method unless you know what you are # doing. sub NAME { - my $this=shift; - my $class = ref($this) || $this; + my ($this) = @_; + my $class = ref($this); + my $target_name; + if ($class) { + # Do not assume that the target buildsystem has been provided. + # NAME could be called during an error in the constructor. + if ($this->IS_GENERATOR_BUILD_SYSTEM and $this->get_targetbuildsystem) { + $target_name = $this->get_targetbuildsystem->NAME; + } + } else { + $class = $this; + } if ($class =~ m/^.+::([^:]+)$/) { - return $1; + my $name = $1; + return "${name}+${target_name}" if defined($target_name); + return $name; } else { - error("ınvalid build system class name: $class"); + error("Invalid build system class name: $class"); } } @@ -37,6 +49,43 @@ "obj-" . dpkg_architecture_value("DEB_HOST_GNU_TYPE"); } +# Return 1 if the build system generator +sub IS_GENERATOR_BUILD_SYSTEM { + return 0; +} + +# Generator build-systems only +# The name of the supported target systems. The first one is +# assumed to be the default if DEFAULT_TARGET_BUILD_SYSTEM is +# not overridden. +sub SUPPORTED_TARGET_BUILD_SYSTEMS { + error("class lacking SUPPORTED_TARGET_BUILD_SYSTEMS"); +} + +# Generator build-systems only +# Name of default target build system if target is unspecified +# (e.g. --buildsystem=cmake instead of cmake+makefile). +sub DEFAULT_TARGET_BUILD_SYSTEM { + my ($this) = @_; + my @targets = $this->SUPPORTED_TARGET_BUILD_SYSTEMS; + # Assume they are listed in order. + return $targets[0]; +} + +# For regular build systems, the same as DESCRIPTION +# For generator based build systems, the DESCRIPTION of the generator build +# system + the target build system. Do not override this method unless you +# know what you are doing. +sub FULL_DESCRIPTION { + my ($this) = @_; + my $description = $this->DESCRIPTION; + return $description if not exists($this->{'targetbuildsystem'}); + my $target_build_system = $this->{'targetbuildsystem'}; + return $description if not defined($target_build_system); + my $target_desc = $target_build_system->FULL_DESCRIPTION; + return "${description} combined with ${target_desc}"; +} + # Constructs a new build system object. Named parameters: # - sourcedir- specifies source directory (relative to the current (top) # directory) where the sources to be built live. If not @@ -46,6 +95,8 @@ # DEFAULT_BUILD_DIRECTORY directory will be used. # - parallel - max number of parallel processes to be spawned for building # sources (-1 = unlimited; 1 = no parallel) +# - targetbuildsystem - The target build system for generator based build +# systems. Only set for generator build systems. # Derived class can override the constructor to initialize common object # parameters. Do NOT use constructor to execute commands or otherwise # configure/setup build environment. There is absolutely no guarantee the @@ -59,6 +110,23 @@ parallel => undef, cwd => Cwd::getcwd() }, $class); + # Setup the target buildsystem early, so e.g. _set_builddir also + # applies to the target build system. Useful if the generator + # and target does not agree on (e.g.) the default build dir. + my $target_bs_name; + if (exists $opts{targetbuildsystem}) { + $target_bs_name = $opts{targetbuildsystem}; + } + + $target_bs_name //= $this->DEFAULT_TARGET_BUILD_SYSTEM if $this->IS_GENERATOR_BUILD_SYSTEM; + + if (defined($target_bs_name)) { + my %target_opts = %opts; + delete($target_opts{'targetbuildsystem'}); + my $target_system =_create_buildsystem_instance($target_bs_name, 1, %target_opts); + $this->set_targetbuildsystem($target_system); + } + if (exists $opts{sourcedir}) { # Get relative sourcedir abs_path (without symlinks) my $abspath = Cwd::abs_path($opts{sourcedir}); @@ -73,6 +141,7 @@ if (defined $opts{parallel}) { $this->{parallel} = $opts{parallel}; } + return $this; } @@ -101,9 +170,42 @@ } } $this->{builddir} = $builddir; + # Use get as guard because this method is (also) called from the + # constructor before the target build system is setup. + if ($this->get_targetbuildsystem) { + $this->get_targetbuildsystem->{builddir} = $builddir; + }; return $builddir; } +sub set_targetbuildsystem { + my ($this, $target_system) = @_; + my $ok = 0; + my $target_bs_name = $target_system->NAME; + if (not $this->IS_GENERATOR_BUILD_SYSTEM) { + my $name = $this->NAME; + error("Cannot set a target build system: Buildsystem ${name} is not a generator build system"); + } + for my $supported_bs_name ($this->SUPPORTED_TARGET_BUILD_SYSTEMS) { + if ($supported_bs_name eq $target_bs_name) { + $ok = 1; + last; + } + } + if (not $ok) { + my $name = $this->NAME; + error("Buildsystem ${name} does not support ${target_bs_name} as target build system."); + } + $this->{'targetbuildsystem'} = $target_system +} + +# Returns the target build system if it is provided +sub get_targetbuildsystem { + my $this = shift; + return if not exists($this->{'targetbuildsystem'}); + return $this->{'targetbuildsystem'}; +} + # This instance method is called to check if the build system is able # to build a source package. It will be called during the build # system auto-selection process, inside the root directory of the debian @@ -137,6 +239,11 @@ $this->{warn_insource} = 1; $this->{builddir} = undef; } + if ($this->IS_GENERATOR_BUILD_SYSTEM) { + $this->get_targetbuildsystem->enforce_in_source_building(@_); + # Only warn in one build system. + delete($this->{warn_insource}); + } } # Derived class can call this method in its constructor to *prefer* @@ -155,6 +262,9 @@ error("default build directory is the same as the source directory." . " Please specify a custom build directory"); } + if ($this->IS_GENERATOR_BUILD_SYSTEM) { + $this->get_targetbuildsystem->prefer_out_of_source_building(@_); + } } } @@ -263,6 +373,9 @@ sub disable_parallel { my ($this) = @_; $this->{parallel} = 1; + if ($this->IS_GENERATOR_BUILD_SYSTEM) { + $this->get_targetbuildsystem->disable_parallel; + } } # When given a relative path to the build directory, converts it @@ -291,6 +404,17 @@ } } +sub check_auto_buildable_clean_oos_buildir { + my $this = shift; + my ($step) = @_; + # This only applies to clean + return 0 if $step ne 'clean'; + my $builddir = $this->get_builddir; + # If there is no builddir, then this rule does not apply. + return 0 if not defined($builddir) or not -d $builddir; + return 1; +} + sub _cd { my ($this, $dir)=@_; verbose_print("cd $dir"); @@ -359,14 +483,6 @@ return $this->_generic_doit_in_dir($this->get_buildpath, \&print_and_doit_noerror, @args); } -# Changes working directory to the build directory (if needed), -# calls print_and_complex_doit(@_) and changes working directory back to the -# top directory. -sub complex_doit_in_builddir { - my ($this, @args) = @_; - return $this->_in_dir($this->get_buildpath, \&print_and_complex_doit, @args); -} - # In case of out of source tree building, whole build directory # gets wiped (if it exists) and 1 is returned. If build directory # had 2 or more levels, empty parent directories are also deleted. @@ -412,6 +528,9 @@ " does not support building out of source tree. In source building enforced."); delete $this->{warn_insource}; } + if ($this->IS_GENERATOR_BUILD_SYSTEM) { + $this->get_targetbuildsystem->pre_building_step(@_); + } } # Instance method that is called after performing any step (see below). @@ -420,6 +539,9 @@ sub post_building_step { my $this=shift; my ($step)=@_; + if ($this->IS_GENERATOR_BUILD_SYSTEM) { + $this->get_targetbuildsystem->post_building_step(@_); + } } # The instance methods below provide support for configuring, @@ -430,26 +552,65 @@ # implement build system specific steps needed to build the # source. Arbitrary number of custom step arguments might be # passed. Default implementations do nothing. +# +# Note: For generator build systems, the default is to +# delegate the step to the target build system for all +# steps except configure. sub configure { my $this=shift; } sub build { my $this=shift; + if ($this->IS_GENERATOR_BUILD_SYSTEM) { + $this->get_targetbuildsystem->build(@_); + } } sub test { my $this=shift; + if ($this->IS_GENERATOR_BUILD_SYSTEM) { + $this->get_targetbuildsystem->test(@_); + } } # destdir parameter specifies where to install files. sub install { my $this=shift; - my $destdir=shift; + my ($destdir) = @_; + + if ($this->IS_GENERATOR_BUILD_SYSTEM) { + $this->get_targetbuildsystem->install(@_); + } } sub clean { my $this=shift; + + if ($this->IS_GENERATOR_BUILD_SYSTEM) { + $this->get_targetbuildsystem->clean(@_); + } +} + + +sub _create_buildsystem_instance { + my ($full_name, $required, %bsopts) = @_; + my @parts = split(m{[+]}, $full_name, 2); + my $name = $parts[0]; + my $module = "Debian::Debhelper::Buildsystem::$name"; + if (@parts > 1) { + if (exists($bsopts{'targetbuildsystem'})) { + error("Conflicting target buildsystem for ${name} (load as ${full_name}, but target configured in bsopts)"); + } + $bsopts{'targetbuildsystem'} = $parts[1]; + } + + eval "use $module"; + if ($@) { + return if not $required; + error("unable to load build system class '$name': $@"); + } + return $module->new(%bsopts); } 1 diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Dh_Buildsystems.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Dh_Buildsystems.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Dh_Buildsystems.pm 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Dh_Buildsystems.pm 2018-09-02 07:02:06.000000000 +0000 @@ -8,6 +8,7 @@ use strict; use warnings; +use Debian::Debhelper::Buildsystem; use Debian::Debhelper::Dh_Lib; use File::Spec; @@ -25,11 +26,12 @@ "makefile", "python_distutils", (compat(7) ? "perl_build" : ()), - "cmake", + "cmake+makefile", + "cmake+ninja", "ant", "qmake", "qmake_qt4", - "meson", + "meson+ninja", "ninja", ); @@ -44,16 +46,10 @@ my $opt_list; my $opt_parallel; -sub create_buildsystem_instance { - my ($system, $required, %bsopts) = @_; - my $module = "Debian::Debhelper::Buildsystem::$system"; - - eval "use $module"; - if ($@) { - return if not $required; - error("unable to load build system class '$system': $@"); - } +*create_buildsystem_instance = \&Debian::Debhelper::Buildsystem::_create_buildsystem_instance; +sub _insert_cmd_opts { + my (%bsopts) = @_; if (!exists $bsopts{builddir} && defined $opt_builddir) { $bsopts{builddir} = ($opt_builddir eq "") ? undef : $opt_builddir; } @@ -63,7 +59,7 @@ if (!exists $bsopts{parallel}) { $bsopts{parallel} = $opt_parallel; } - return $module->new(%bsopts); + return %bsopts; } # Autoselect a build system from the list of instances @@ -73,9 +69,15 @@ my $selected_level = 0; foreach my $inst (@_) { - # Only derived (i.e. more specific) build system can be - # considered beyond the currently selected one. - next if defined $selected && !$inst->isa(ref $selected); + # Only more specific build system can be considered beyond + # the currently selected one. + if (defined($selected)) { + my $ok = $inst->isa(ref($selected)) ? 1 : 0; + if (not $ok and $inst->IS_GENERATOR_BUILD_SYSTEM) { + $ok = 1 if $inst->get_targetbuildsystem->NAME eq $selected->NAME; + } + next if not $ok; + } # If the build system says it is auto-buildable at the current # step and it can provide more specific information about its @@ -95,24 +97,25 @@ sub load_buildsystem { my $system=shift; my $step=shift; + my %opts = _insert_cmd_opts(@_); my $system_options; if (defined($system) && ref($system) eq 'HASH') { $system_options = $system; $system = $system_options->{'system'}; } if (defined $system) { - my $inst = create_buildsystem_instance($system, 1, @_); + my $inst = create_buildsystem_instance($system, 1, %opts); return $inst; } else { # Try to determine build system automatically my @buildsystems; foreach $system (@BUILDSYSTEMS) { - push @buildsystems, create_buildsystem_instance($system, 1, @_); + push @buildsystems, create_buildsystem_instance($system, 1, %opts); } if (!$system_options || $system_options->{'enable-thirdparty'}) { foreach $system (@THIRD_PARTY_BUILDSYSTEMS) { - push @buildsystems, create_buildsystem_instance($system, 0, @_); + push @buildsystems, create_buildsystem_instance($system, 0, %opts); } } return autoselect_buildsystem($step, @buildsystems); @@ -121,7 +124,8 @@ sub load_all_buildsystems { my $incs=shift || \@INC; - my (%buildsystems, @buildsystems); + my %opts = _insert_cmd_opts(@_); + my (%buildsystems, %genbuildsystems, @buildsystems); foreach my $inc (@$incs) { my $path = File::Spec->catdir($inc, "Debian/Debhelper/Buildsystem"); @@ -129,8 +133,19 @@ foreach my $module_path (glob "$path/*.pm") { my $name = basename($module_path); $name =~ s/\.pm$//; - next if exists $buildsystems{$name}; - $buildsystems{$name} = create_buildsystem_instance($name, 1, @_); + next if exists $buildsystems{$name} or exists $genbuildsystems{$name}; + my $system = create_buildsystem_instance($name, 1, %opts); + if ($system->IS_GENERATOR_BUILD_SYSTEM) { + $genbuildsystems{$name} = 1; + for my $target_name ($system->SUPPORTED_TARGET_BUILD_SYSTEMS) { + my $full_name = "${name}+${target_name}"; + my $full_system = create_buildsystem_instance($name, 1, %opts, + 'targetbuildsystem' => $target_name); + $buildsystems{$full_name} = $full_system; + } + } else { + $buildsystems{$name} = $system; + } } } } @@ -209,22 +224,31 @@ my @buildsystems = load_all_buildsystems(); my %auto_selectable = map { $_ => 1 } @THIRD_PARTY_BUILDSYSTEMS; my $auto = autoselect_buildsystem($step, grep { ! $_->{thirdparty} || $auto_selectable{$_->NAME} } @buildsystems); - my $specified; + my $specified_text; + + if ($opt_buildsys) { + for my $inst (@buildsystems) { + my $full_name = $inst->NAME; + if ($full_name eq $opt_buildsys) { + $specified_text = $full_name; + } elsif ($inst->IS_GENERATOR_BUILD_SYSTEM and ref($inst)->NAME eq $opt_buildsys) { + my $default = $inst->DEFAULT_TARGET_BUILD_SYSTEM; + $specified_text = "${opt_buildsys}+${default} (default for ${opt_buildsys})"; + } + } + } # List build systems (including auto and specified status) foreach my $inst (@buildsystems) { - if (! defined $specified && defined $opt_buildsys && $opt_buildsys eq $inst->NAME()) { - $specified = $inst; - } - printf("%-20s %s", $inst->NAME(), $inst->DESCRIPTION()); + printf("%-20s %s", $inst->NAME(), $inst->FULL_DESCRIPTION()); print " [3rd party]" if $inst->{thirdparty}; print "\n"; } print "\n"; print "Auto-selected: ", $auto->NAME(), "\n" if defined $auto; - print "Specified: ", $specified->NAME(), "\n" if defined $specified; + print "Specified: ", $specified_text, "\n" if defined $specified_text; print "No system auto-selected or specified\n" - if ! defined $auto && ! defined $specified; + if ! defined $auto && ! defined $specified_text; } sub buildsystems_do { diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Dh_Getopt.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Dh_Getopt.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Dh_Getopt.pm 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Dh_Getopt.pm 2018-12-18 19:49:57.000000000 +0000 @@ -92,6 +92,7 @@ if (! exists $params{bundling} || $params{bundling}) { Getopt::Long::config("bundling"); } + Getopt::Long::config('no_ignore_case'); my @test; my %options=( @@ -107,7 +108,7 @@ "arch" => \&AddPackage, "p=s" => \&AddPackage, - "package=s" => \&AddPackage, + "package=s" => \&AddPackage, "N=s" => \&ExcludePackage, "no-package=s" => \&ExcludePackage, @@ -131,9 +132,6 @@ "d" => \$dh{D_FLAG}, - "k" => \$dh{K_FLAG}, - "keep" => \$dh{K_FLAG}, - "P=s" => \$dh{TMPDIR}, "tmpdir=s" => \$dh{TMPDIR}, @@ -144,8 +142,6 @@ "A" => \$dh{PARAMS_ALL}, "all" => \$dh{PARAMS_ALL}, - "priority=s" => \$dh{PRIORITY}, - "h|help" => \&showhelp, "mainpackage=s" => \$dh{MAINPACKAGE}, diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Dh_Lib.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Dh_Lib.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Dh_Lib.pm 2018-03-30 08:00:57.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Dh_Lib.pm 2019-04-20 23:21:58.000000000 +0000 @@ -7,6 +7,7 @@ package Debian::Debhelper::Dh_Lib; use strict; use warnings; +use utf8; use constant { # Lowest compat level supported @@ -14,8 +15,11 @@ # Lowest compat level that does *not* cause deprecation # warnings 'LOWEST_NON_DEPRECATED_COMPAT_LEVEL' => 9, + # Lowest compat level to generate "debhelper-compat (= X)" + # relations for. + 'LOWEST_VIRTUAL_DEBHELPER_COMPAT_LEVEL' => 9, # Highest compat level permitted - 'MAX_COMPAT_LEVEL' => 12, + 'MAX_COMPAT_LEVEL' => 13, # Magic value for xargs 'XARGS_INSERT_PARAMS_HERE' => \'', #'# Hi emacs. # Magic value for debhelper tools to request "current version" @@ -31,40 +35,142 @@ 'DBGSYM_PACKAGE_TYPE' => 'ddeb', }; -use Errno qw(ENOENT); +use Errno qw(ENOENT EXDEV); use Exporter qw(import); use File::Glob qw(bsd_glob GLOB_CSH GLOB_NOMAGIC GLOB_TILDE); our (@EXPORT, %dh); -@EXPORT=qw(&init &doit &doit_noerror &complex_doit &verbose_print &error - &nonquiet_print &print_and_doit &print_and_doit_noerror - &warning &tmpdir &pkgfile &pkgext &pkgfilename &isnative - &autoscript &filearray &filedoublearray &is_build_profile_active - &getpackages &basename &dirname &xargs %dh &process_pkg - &compat &addsubstvar &delsubstvar &excludefile &package_arch - &package_is_arch_all &package_binary_arch &package_declared_arch - &is_udeb &debhelper_script_subst &escape_shell - &inhibit_log &load_log &write_log &commit_override_log - &dpkg_architecture_value &sourcepackage &make_symlink - &is_make_jobserver_unavailable &clean_jobserver_makeflags - &cross_command &set_buildflags &get_buildoption - &install_dh_config_file &error_exitcode &package_multiarch - &install_file &install_prog &install_lib &install_dir - &get_source_date_epoch &is_cross_compiling - &generated_file &autotrigger &package_section - &restore_file_on_clean &restore_all_files - &open_gz &reset_perm_and_owner &deprecated_functionality - &log_installed_files &buildarch &rename_path - &on_pkgs_in_parallel &on_selected_pkgs_in_parallel - &rm_files &make_symlink_raw_target &on_items_in_parallel - XARGS_INSERT_PARAMS_HERE &glob_expand_error_handler_reject - &glob_expand_error_handler_warn_and_discard &glob_expand - &glob_expand_error_handler_silently_ignore DH_BUILTIN_VERSION - &print_and_complex_doit &default_sourcedir &qx_cmd - &compute_doc_main_package &is_so_or_exec_elf_file &hostarch - &assert_opt_is_known_package &dbgsym_tmpdir &find_hardlinks - &should_use_root &gain_root_cmd DEFAULT_PACKAGE_TYPE - DBGSYM_PACKAGE_TYPE -); +@EXPORT = ( + # debhelper basis functionality +qw( + init + %dh + compat +), + # External command tooling API +qw( + doit + doit_noerror + qx_cmd + xargs + XARGS_INSERT_PARAMS_HERE + print_and_doit + print_and_doit_noerror + + complex_doit + escape_shell +), + # Logging/messaging/error handling +qw( + error + error_exitcode + warning + verbose_print + nonquiet_print +), + # Package related actions +qw( + getpackages + sourcepackage + tmpdir + dbgsym_tmpdir + default_sourcedir + pkgfile + pkgext + pkgfilename + package_is_arch_all + package_binary_arch + package_declared_arch + package_multiarch + package_section + package_arch + process_pkg + compute_doc_main_package + isnative + is_udeb +), + # File/path related actions +qw( + basename + dirname + install_file + install_prog + install_lib + install_dir + install_dh_config_file + make_symlink + make_symlink_raw_target + rename_path + find_hardlinks + rm_files + excludefile + is_so_or_exec_elf_file + is_empty_dir + reset_perm_and_owner + log_installed_files + + filearray + filedoublearray + glob_expand + glob_expand_error_handler_reject + glob_expand_error_handler_warn_and_discard + glob_expand_error_handler_silently_ignore + glob_expand_error_handler_reject_nomagic_warn_discard +), + # Generate triggers, substvars, maintscripts, build-time temporary files +qw( + autoscript + autotrigger + addsubstvar + delsubstvar + + generated_file + restore_file_on_clean +), + # Split tasks among different cores +qw( + on_pkgs_in_parallel + on_items_in_parallel + on_selected_pkgs_in_parallel +), + # R³ framework +qw( + should_use_root + gain_root_cmd + +), + # Architecture, cross-tooling, build options and profiles +qw( + dpkg_architecture_value + hostarch + cross_command + is_cross_compiling + is_build_profile_active + get_buildoption +), + # Other +qw( + open_gz + get_source_date_epoch + deprecated_functionality +), + # Special-case functionality (e.g. tool specific), debhelper(-core) functionality and deprecated functions +qw( + inhibit_log + load_log + write_log + commit_override_log + debhelper_script_subst + is_make_jobserver_unavailable + clean_jobserver_makeflags + set_buildflags + DEFAULT_PACKAGE_TYPE + DBGSYM_PACKAGE_TYPE + DH_BUILTIN_VERSION + assert_opt_is_known_package + restore_all_files + + buildarch +)); # The Makefile changes this if debhelper is installed in a PREFIX. my $prefix="/usr"; @@ -79,6 +185,18 @@ (?: - [0-9A-Za-z.+:~]+ )* # Optional debian revision (+ upstreams versions with hyphens) /xoa; +# From Policy 5.1: +# +# The field name is composed of US-ASCII characters excluding control +# characters, space, and colon (i.e., characters in the ranges U+0021 +# (!) through U+0039 (9), and U+003B (;) through U+007E (~), +# inclusive). Field names must not begin with the comment character +# (U+0023 #), nor with the hyphen character (U+002D -). +our $DEB822_FIELD_REGEX = qr/ + [\x21\x22\x24-\x2C\x2F-\x39\x3B-\x7F] # First character + [\x21-\x39\x3B-\x7F]* # Subsequent characters (if any) + /xoa; + sub init { my %params=@_; @@ -140,7 +258,7 @@ # make sure verbose is on. Otherwise, check DH_QUIET. if (defined $ENV{DH_VERBOSE} && $ENV{DH_VERBOSE} ne "") { $dh{VERBOSE}=1; - } elsif (defined $ENV{DH_QUIET} && $ENV{DH_QUIET} ne "") { + } elsif (defined $ENV{DH_QUIET} && $ENV{DH_QUIET} ne "" || get_buildoption("terse")) { $dh{QUIET}=1; } @@ -338,6 +456,7 @@ chdir($dir) or error("chdir(\"${dir}\) failed: $!"); } } + open(STDIN, '<', '/dev/null') or error("redirect STDIN failed: $!"); if (defined(my $output = $options->{stdout})) { open(STDOUT, '>', $output) or error("redirect STDOUT failed: $!"); } @@ -421,19 +540,6 @@ } } -# Run a command and display the command to stdout except when quiet -# Use print_and_doit() if you can, instead of this function, because -# this function forks a shell. However, this function can handle more -# complicated stuff like redirection. -sub print_and_complex_doit { - nonquiet_print(join(" ",@_)); - - if (! $dh{NO_ACT}) { - # The join makes system get a scalar so it forks off a shell. - system(join(" ", @_)) == 0 || error_exitcode(join(" ", @_)) - } -} - sub error_exitcode { my $command=shift; @@ -535,8 +641,16 @@ } return 1 if $dh{NO_ACT}; if (not rename($source, $dest)) { - my $files = escape_shell($source, $dest); - error("mv $files: $!") + my $ok = 0; + if ($! == EXDEV) { + # Replay with a fork+exec to handle crossing two mount + # points (See #897569) + $ok = _doit('mv', $source, $dest); + } + if (not $ok) { + my $files = escape_shell($source, $dest); + error("mv $files: $!"); + } } return 1; } @@ -653,7 +767,8 @@ # Output a warning. sub warning { - my $message=shift; + my ($message) = @_; + $message //= ''; print STDERR basename($0).": $message\n"; } @@ -683,6 +798,12 @@ my $warned_compat = $ENV{DH_INTERNAL_TESTSUITE_SILENT_WARNINGS} ? 1 : 0; my $c; + # Used mainly for testing + sub resetcompat { + undef $c; + undef $compat_from_bd; + } + sub compat { my $num=shift; my $nowarn=shift; @@ -708,7 +829,7 @@ error("debian/compat must contain a positive number (found: \"${new_compat}\")"); } if (defined($compat_from_bd) and $compat_from_bd != -1) { - warning("Please specific the debhelper compat level exactly once."); + warning("Please specify the debhelper compat level exactly once."); warning(" * debian/compat requests compat ${new_compat}."); warning(" * debian/control requests compat ${compat_from_bd} via \"debhelper-compat (= ${compat_from_bd})\""); error("debhelper compat level specified both in debian/compat and via build-dependency on debhelper-compat"); @@ -884,22 +1005,33 @@ # As a side effect, sets $dh{VERSION} to the version of this package. { # Caches return code so it only needs to run dpkg-parsechangelog once. - my %isnative_cache; + my (%isnative_cache, %pkg_version); sub isnative { - my $package=shift; - - return $isnative_cache{$package} if defined $isnative_cache{$package}; + my ($package) = @_; + my $cache_key = $package; - if (not %isnative_cache) { - require Dpkg::Changelog::Parse; + if (exists($isnative_cache{$cache_key})) { + $dh{VERSION} = $pkg_version{$cache_key}; + return $isnative_cache{$cache_key}; } # Make sure we look at the correct changelog. - my $isnative_changelog=pkgfile($package,"changelog"); + my $isnative_changelog = pkgfile($package,"changelog"); if (! $isnative_changelog) { - $isnative_changelog="debian/changelog"; + $isnative_changelog = "debian/changelog"; + $cache_key = '_source'; + # check if we looked up the default changelog + if (exists($isnative_cache{$cache_key})) { + $dh{VERSION} = $pkg_version{$cache_key}; + return $isnative_cache{$cache_key}; + } } + + if (not %isnative_cache) { + require Dpkg::Changelog::Parse; + } + my $res = Dpkg::Changelog::Parse::changelog_parse( file => $isnative_changelog, compression => 0, @@ -907,19 +1039,20 @@ if (not defined($res)) { error("No changelog entries for $package!? (changelog file: ${isnative_changelog})"); } - # Get the package version. - $dh{VERSION} = $res->{'Version'}; - # Did the changelog parse fail? - if ($dh{VERSION} eq q{}) { - error("changelog parse failure"); + my $version = $res->{'Version'}; + # Do we have a valid version? + if (not defined($version) or not $version->is_valid) { + error("changelog parse failure; invalid or missing version"); } + # Get and cache the package version. + $dh{VERSION} = $pkg_version{$cache_key} = $version->as_string; # Is this a native Debian package? if (index($dh{VERSION}, '-') > -1) { - return $isnative_cache{$package}=0; + return $isnative_cache{$cache_key} = 0; } else { - return $isnative_cache{$package}=1; + return $isnative_cache{$cache_key} = 1; } } } @@ -1187,6 +1320,20 @@ return; } +# Emulates the "old" glob mechanism; not recommended for new code as +# it permits some globs expand to nothing with only a warning. +sub glob_expand_error_handler_reject_nomagic_warn_discard { + my ($pattern, $dir_ref) = @_; + for my $dir (@{$dir_ref}) { + my $full_pattern = "$dir/$pattern"; + my @matches = bsd_glob($full_pattern, GLOB_CSH & ~(GLOB_TILDE)); + if (@matches) { + goto \&glob_expand_error_handler_reject; + } + } + goto \&glob_expand_error_handler_warn_and_discard; +} + sub glob_expand_error_handler_silently_ignore { return; } @@ -1230,7 +1377,7 @@ require Cwd; my $cmd=Cwd::abs_path($file); $ENV{"DH_CONFIG_ACT_ON_PACKAGES"} = join(",", @{$dh{"DOPACKAGES"}}); - open (DH_FARRAY_IN, "$cmd |") || error("cannot run $file: $!"); + open(DH_FARRAY_IN, '-|', $cmd) || error("cannot run $file: $!"); delete $ENV{"DH_CONFIG_ACT_ON_PACKAGES"}; } else { @@ -1240,9 +1387,17 @@ my @ret; while () { chomp; - if (not $x) { - next if /^#/ || /^$/; + if ($x) { + if (m/^\s++$/) { + error("Executable config file $file produced a non-empty whitespace-only line"); + } + } else { + s/^\s++//; + next if /^#/; + s/\s++$//; } + # We always ignore/permit empty lines + next if $_ eq ''; my @line; if (defined($globdir) && ! $x) { @@ -1269,7 +1424,22 @@ if (!close(DH_FARRAY_IN)) { if ($x) { - error("Error closing fd/process for $file: $!") if $!; + my ($err, $proc_err) = ($!, $?); + error("Error closing fd/process for $file: $err") if $err; + # The interpreter did not like the file for some reason. + # Lets check if the maintainer intended it to be + # executable. + if (not is_so_or_exec_elf_file($file) and not _has_shbang_line($file)) { + warning("$file is marked executable but does not appear to an executable config."); + warning(); + warning("If $file is intended to be an executable config file, please ensure it can"); + warning("be run as a stand-alone script/program (e.g. \"./${file}\")"); + warning("Otherwise, please remove the executable bit from the file (e.g. chmod -x \"${file}\")"); + warning(); + warning('Please see "Executable debhelper config files" in debhelper(7) for more information.'); + warning(); + } + $? = $proc_err; error_exitcode("$file (executable config)"); } else { error("problem reading $file: $!"); @@ -1377,7 +1547,15 @@ # As a side effect, populates %package_arches and %package_types # with the types of all packages (not only those returned). my (%package_types, %package_arches, %package_multiarches, %packages_by_type, - %package_sections, $sourcepackage, %package_cross_type); + %package_sections, $sourcepackage, %package_cross_type, %dh_bd_sequences); + +# Resets the arrays; used mostly for testing +sub resetpackages { + undef $sourcepackage; + %package_types = %package_arches = %package_multiarches = + %packages_by_type = %package_sections = %package_cross_type = (); + %dh_bd_sequences = (); +} # Returns source package name sub sourcepackage { @@ -1400,9 +1578,10 @@ my $package=""; my $arch=""; my $section=""; + my $valid_pkg_re = qr{^${PKGNAME_REGEX}$}o; my ($package_type, $multiarch, %seen, @profiles, $source_section, $included_in_build_profile, $cross_type, $cross_target_arch, - %bd_fields, $bd_field_value); + %bd_fields, $bd_field_value, %seen_fields); if (exists $ENV{'DEB_BUILD_PROFILES'}) { @profiles=split /\s+/, $ENV{'DEB_BUILD_PROFILES'}; } @@ -1418,32 +1597,55 @@ s/\s+$//; next if m/^\s*+\#/; - if (/^Source:\s*(.*)/i) { - $sourcepackage = $1; - $bd_field_value = undef; - next; - } elsif (/^Section:\s(.*)$/i) { - $source_section = $1; - $bd_field_value = undef; + if (/^\s/) { + if (not %seen_fields) { + error("Continuation line seen before first stanza in debian/control (line $.)"); + } + # Continuation line + push(@{$bd_field_value}, $_) if $bd_field_value; + } elsif (not $_ and not %seen_fields) { + # Ignore empty lines before first stanza next; - } elsif (/^(Build-Depends(?:-Arch|-Indep)?):\s*(.*)$/i) { - my ($field, $value) = (lc($1), $2); - $bd_field_value = [$value]; - $bd_fields{$field} = $bd_field_value; - } elsif (/^\S/) { - $bd_field_value = undef; - } elsif (/^\s/ and $bd_field_value) { - push(@{$bd_field_value}, $_); + } elsif ($_) { + my ($field_name, $value); + + if (m/^($DEB822_FIELD_REGEX):\s*(.*)/o) { + ($field_name, $value) = (lc($1), $2); + if (exists($seen_fields{$field_name})) { + my $first_time = $seen_fields{$field_name}; + error("${field_name}-field appears twice in the same stanza of debian/control. " . + "First time on line $first_time, second time: $."); + } + $seen_fields{$field_name} = $.; + $bd_field_value = undef; + } else { + # Invalid file + error("Parse error in debian/control, line $., read: $_"); + } + if ($field_name eq 'source') { + $sourcepackage = $value; + if ($sourcepackage !~ $valid_pkg_re) { + error('Source-field must be a valid package name, ' . + "got: \"${sourcepackage}\", should match \"${valid_pkg_re}\""); + } + next; + } elsif ($field_name eq 'section') { + $source_section = $value; + next; + } elsif ($field_name =~ /^(?:build-depends(?:-arch|-indep)?)$/) { + $bd_field_value = [$value]; + $bd_fields{$field_name} = $bd_field_value; + } } - next if not $_ and not defined($sourcepackage); - last if (!$_ or eof); # end of stanza. + last if not $_ or eof; } error("could not find Source: line in control file.") if not defined($sourcepackage); if (%bd_fields) { my ($dh_compat_bd, $final_level); for my $field (sort(keys(%bd_fields))) { my $value = join(' ', @{$bd_fields{$field}}); - $value =~ s/\s*,\s*$//; + $value =~ s/^\s*//; + $value =~ s/\s*(?:,\s*)?$//; for my $dep (split(/\s*,\s*/, $value)) { if ($dep =~ m/^debhelper-compat\s*[(]\s*=\s*(${PKGVERSION_REGEX})\s*[)]$/) { my $version = $1; @@ -1478,60 +1680,114 @@ warning(" compat level into the file debian/compat. (E.g. \"echo ${clevel} > debian/compat\")"); error("Could not parse desired debhelper compat level from relation: $dep"); } + # Build-Depends on dh-sequence- OR dh-sequence- ( ) + if ($dep =~ m/^dh-sequence-(${PKGNAME_REGEX})\s*(?:[(]\s*(?:[<>]?=|<<|>>)\s*(${PKGVERSION_REGEX})\s*[)])?$/) { + my $sequence = $1; + if ($field ne 'build-depends') { + warning("Ignoring dh sequence add-on request for sequenece ${sequence} via ${field}: Please move it to the Build-Depends field"); + warning("The relation that triggered this warning was: ${dep} (from the ${field} field)"); + next; + } + $dh_bd_sequences{$sequence} = 1; + } } } - if (defined($final_level)) { - warning("The use of \"debhelper-compat (= ${final_level})\" is experimental and may change (or be retired) without notice"); - } $compat_from_bd = $final_level // -1; } else { $compat_from_bd = -1; } + %seen_fields = (); + while (<$fd>) { chomp; s/\s+$//; - if (/^Package:\s*(.*)/i) { - $package=$1; - # Detect duplicate package names in the same control file. - if (! $seen{$package}) { - $seen{$package}=1; + if (m/^\#/) { + # Skip unless EOF for the special case where the last line + # is a comment line directly after the last stanza. In + # that case we need to "commit" the last stanza as well or + # we end up omitting the last package. + next if not eof; + $_ = ''; + } + + + if (/^\s/) { + # Continuation line + if (not %seen_fields) { + error("Continuation line seen outside stanza in debian/control (line $.)"); } - else { - error("debian/control has a duplicate entry for $package"); + } elsif (not $_ and not %seen_fields) { + # Ignore empty lines before first stanza + next; + } elsif ($_) { + my ($field_name, $value); + + if (m/^($DEB822_FIELD_REGEX):\s*(.*)/o) { + ($field_name, $value) = (lc($1), $2); + if (exists($seen_fields{$field_name})) { + my $first_time = $seen_fields{$field_name}; + error("${field_name}-field appears twice in the same stanza of debian/control. " . + "First time on line $first_time, second time: $."); + } + $seen_fields{$field_name} = $.; + $bd_field_value = undef; + } else { + # Invalid file + error("Parse error in debian/control, line $., read: $_"); } - $included_in_build_profile=1; - } elsif (/^Section:\s(.*)$/i) { - $section = $1; - } elsif (/^Architecture:\s*(.*)/i) { - $arch=$1; - } elsif (/^(?:X[BC]*-)?Package-Type:\s*(.*)/i) { - $package_type=$1; - } elsif (/^Multi-Arch:\s*(.*)/i) { - $multiarch = $1; - } elsif (/^X-DH-Build-For-Type:\s*(.*)/i) { - $cross_type = $1; - if ($cross_type ne 'host' and $cross_type ne 'target') { - error("Unknown value of X-DH-Build-For-Type \"$cross_type\" at debian/control:$."); - } - } elsif (/^Build-Profiles:\s*(.*)/i) { - # rely on libdpkg-perl providing the parsing functions - # because if we work on a package with a Build-Profiles - # field, then a high enough version of dpkg-dev is needed - # anyways - my $build_profiles=$1; - eval { - require Dpkg::BuildProfiles; - my @restrictions=Dpkg::BuildProfiles::parse_build_profiles($build_profiles); - if (@restrictions) { - $included_in_build_profile=Dpkg::BuildProfiles::evaluate_restriction_formula(\@restrictions, \@profiles); - } - }; - if ($@) { - error("The control file has a Build-Profiles field. Requires libdpkg-perl >= 1.17.14"); + + if ($field_name eq 'package') { + $package = $value; + # Detect duplicate package names in the same control file. + if (! $seen{$package}) { + $seen{$package}=1; + } else { + error("debian/control has a duplicate entry for $package"); + } + if ($package !~ $valid_pkg_re) { + error('Package-field must be a valid package name, ' . + "got: \"${package}\", should match \"${valid_pkg_re}\""); + } + $included_in_build_profile=1; + } elsif ($field_name eq 'section') { + $section = $value; + } elsif ($field_name eq 'architecture') { + $arch = $value; + } elsif ($field_name =~ m/^(?:x[bc]*-)?package-type$/) { + if (defined($package_type)) { + my $help = "(issue seen prior \"Package\"-field)"; + $help = "for package ${package}" if $package; + error("Multiple definitions of (X-)Package-Type in line $. ${help}"); + } + $package_type = $value; + } elsif ($field_name eq 'multi-arch') { + $multiarch = $value; + } elsif ($field_name eq 'x-dh-build-for-type') { + $cross_type = $value; + if ($cross_type ne 'host' and $cross_type ne 'target') { + error("Unknown value of X-DH-Build-For-Type \"$cross_type\" at debian/control:$."); + } + } elsif ($field_name eq 'build-profiles') { + # rely on libdpkg-perl providing the parsing functions + # because if we work on a package with a Build-Profiles + # field, then a high enough version of dpkg-dev is needed + # anyways + my $build_profiles = $value; + eval { + require Dpkg::BuildProfiles; + my @restrictions=Dpkg::BuildProfiles::parse_build_profiles($build_profiles); + if (@restrictions) { + $included_in_build_profile = Dpkg::BuildProfiles::evaluate_restriction_formula( + \@restrictions, + \@profiles); + } + }; + if ($@) { + error("The control file has a Build-Profiles field. Requires libdpkg-perl >= 1.17.14"); + } } } - if (!$_ or eof) { # end of stanza. if ($package) { $package_types{$package}=$package_type // 'deb'; @@ -1557,8 +1813,8 @@ $included = 1 if samearch($desired_arch, $arch); } if ($included) { - push(@{$packages_by_type{'arch'}}, $package); - push(@{$packages_by_type{'both'}}, $package); + push(@{$packages_by_type{'arch'}}, $package); + push(@{$packages_by_type{'both'}}, $package); } } } @@ -1568,6 +1824,7 @@ $cross_type = undef; $arch=''; $section=''; + %seen_fields = (); } } close($fd); @@ -1719,6 +1976,14 @@ } } +# Only useful for dh(1) +sub bd_dh_sequences { + # Use $sourcepackage as check because %dh_bd_sequence can be empty + # after running getpackages(). + getpackages() if not defined($sourcepackage); + return sort(keys(%dh_bd_sequences)); +} + sub _concat_slurp_script_files { my (@files) = @_; my $res = ''; @@ -2248,6 +2513,32 @@ return 1; } +sub _has_shbang_line { + my ($file) = @_; + open(my $fd, '<', $file) or error("open $file: $!"); + my $line = <$fd>; + close($fd); + return 1 if (defined($line) and substr($line, 0, 2) eq '#!'); + return 0; +} + +# Returns true iff the given argument is an empty directory. +# Corner-cases: +# - false if not a directory +sub is_empty_dir { + my ($dir) = @_; + return 0 if not -d $dir; + my $ret = 1; + opendir(my $dir_fd, $dir) or error("opendir($dir) failed: $!"); + while (defined(my $entry = readdir($dir_fd))) { + next if $entry eq '.' or $entry eq '..'; + $ret = 0; + last; + } + closedir($dir_fd); + return $ret; +} + sub on_pkgs_in_parallel(&) { unshift(@_, $dh{DOPACKAGES}); goto \&on_items_in_parallel; diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Sequence/dwz.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Sequence/dwz.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Sequence/dwz.pm 2018-01-07 15:08:16.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Sequence/dwz.pm 2018-07-22 18:26:51.000000000 +0000 @@ -3,9 +3,11 @@ use strict; use warnings; -use Debian::Debhelper::Dh_Lib qw(warning); +use Debian::Debhelper::Dh_Lib; -warning('The "dwz"-sequence is experimental and may change (or be retired) without any notice'); +if (not compat(11)) { + error("In compat 12, dh_dwz is run by default and the dwz-sequence is no longer required."); +} insert_before('dh_strip', 'dh_dwz'); diff -Nru debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Sequence/installinitramfs.pm debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Sequence/installinitramfs.pm --- debhelper-11.1.6ubuntu1/lib/Debian/Debhelper/Sequence/installinitramfs.pm 1970-01-01 00:00:00.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/lib/Debian/Debhelper/Sequence/installinitramfs.pm 2018-09-02 07:02:06.000000000 +0000 @@ -0,0 +1,14 @@ +#!/usr/bin/perl +# Enable dh_installinitramfs + +use strict; +use warnings; +use Debian::Debhelper::Dh_Lib; + +if (not compat(11)) { + error("In compat 12, dh_installinitramfs is run by default and the installinitramfs-sequence is no longer required."); +} + +insert_after('dh_installgsettings', 'dh_installinitramfs'); + +1; diff -Nru debhelper-11.1.6ubuntu1/man/po4a/po/debhelper.pot debhelper-12.1.1ubuntu1~ubuntu18.04.1/man/po4a/po/debhelper.pot --- debhelper-11.1.6ubuntu1/man/po4a/po/debhelper.pot 2018-03-29 17:27:05.000000000 +0000 +++ debhelper-12.1.1ubuntu1~ubuntu18.04.1/man/po4a/po/debhelper.pot 2019-02-23 13:24:47.000000000 +0000 @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2018-03-29 19:27+0200\n" +"POT-Creation-Date: 2019-02-09 17:11+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,7 +17,7 @@ "Content-Transfer-Encoding: 8bit\n" #. type: =head1 -#: debhelper.pod:3 debhelper-obsolete-compat.pod:1 dh:3 dh_auto_build:3 dh_auto_clean:3 dh_auto_configure:3 dh_auto_install:3 dh_auto_test:3 dh_bugfiles:3 dh_builddeb:5 dh_clean:3 dh_compress:3 dh_fixperms:3 dh_gconf:3 dh_gencontrol:3 dh_icons:3 dh_install:3 dh_installcatalogs:3 dh_installchangelogs:3 dh_installcron:3 dh_installdeb:3 dh_installdebconf:3 dh_installdirs:3 dh_installdocs:5 dh_installemacsen:3 dh_installexamples:5 dh_installifupdown:3 dh_installinfo:3 dh_installinit:3 dh_installlogcheck:3 dh_installlogrotate:3 dh_installman:3 dh_installmanpages:3 dh_installmenu:3 dh_installmime:3 dh_installmodules:3 dh_installpam:3 dh_installppp:3 dh_installudev:3 dh_installwm:3 dh_installxfonts:3 dh_link:3 dh_lintian:3 dh_listpackages:3 dh_makeshlibs:3 dh_md5sums:3 dh_movefiles:3 dh_perl:3 dh_prep:3 dh_shlibdeps:3 dh_strip:3 dh_testdir:3 dh_testroot:5 dh_usrlocal:5 dh_systemd_enable:3 dh_systemd_start:3 +#: debhelper.pod:3 debhelper-obsolete-compat.pod:1 dh:3 dh_auto_build:3 dh_auto_clean:3 dh_auto_configure:3 dh_auto_install:3 dh_auto_test:3 dh_bugfiles:3 dh_builddeb:5 dh_clean:3 dh_compress:3 dh_dwz:3 dh_fixperms:3 dh_gconf:3 dh_gencontrol:3 dh_icons:3 dh_install:3 dh_installcatalogs:3 dh_installchangelogs:3 dh_installcron:3 dh_installdeb:3 dh_installdebconf:3 dh_installdirs:3 dh_installdocs:5 dh_installemacsen:3 dh_installexamples:5 dh_installifupdown:3 dh_installinfo:3 dh_installinit:3 dh_installinitramfs:3 dh_installlogcheck:3 dh_installlogrotate:3 dh_installman:3 dh_installmanpages:3 dh_installmenu:3 dh_installmime:3 dh_installmodules:3 dh_installpam:3 dh_installppp:3 dh_installudev:3 dh_installwm:3 dh_installxfonts:3 dh_link:3 dh_lintian:3 dh_listpackages:3 dh_makeshlibs:3 dh_md5sums:3 dh_movefiles:3 dh_perl:3 dh_prep:3 dh_shlibdeps:3 dh_strip:3 dh_testdir:3 dh_testroot:5 dh_usrlocal:5 dh_systemd_enable:3 dh_systemd_start:3 msgid "NAME" msgstr "" @@ -27,7 +27,7 @@ msgstr "" #. type: =head1 -#: debhelper.pod:7 debhelper-obsolete-compat.pod:5 dh:16 dh_auto_build:16 dh_auto_clean:16 dh_auto_configure:16 dh_auto_install:18 dh_auto_test:16 dh_bugfiles:15 dh_builddeb:17 dh_clean:15 dh_compress:17 dh_fixperms:16 dh_gconf:15 dh_gencontrol:16 dh_icons:16 dh_install:15 dh_installcatalogs:17 dh_installchangelogs:15 dh_installcron:15 dh_installdeb:15 dh_installdebconf:15 dh_installdirs:15 dh_installdocs:17 dh_installemacsen:15 dh_installexamples:17 dh_installifupdown:15 dh_installinfo:15 dh_installinit:16 dh_installlogcheck:15 dh_installlogrotate:15 dh_installman:16 dh_installmanpages:16 dh_installmenu:15 dh_installmime:15 dh_installmodules:16 dh_installpam:15 dh_installppp:15 dh_installudev:15 dh_installwm:15 dh_installxfonts:15 dh_link:16 dh_lintian:15 dh_listpackages:15 dh_makeshlibs:15 dh_md5sums:16 dh_movefiles:15 dh_perl:17 dh_prep:15 dh_shlibdeps:17 dh_strip:16 dh_testdir:15 dh_testroot:9 dh_usrlocal:19 dh_systemd_enable:16 dh_systemd_start:17 +#: debhelper.pod:7 debhelper-obsolete-compat.pod:5 dh:19 dh_auto_build:16 dh_auto_clean:16 dh_auto_configure:16 dh_auto_install:18 dh_auto_test:16 dh_bugfiles:15 dh_builddeb:17 dh_clean:15 dh_compress:17 dh_dwz:16 dh_fixperms:16 dh_gconf:15 dh_gencontrol:16 dh_icons:16 dh_install:15 dh_installcatalogs:17 dh_installchangelogs:15 dh_installcron:15 dh_installdeb:15 dh_installdebconf:15 dh_installdirs:15 dh_installdocs:17 dh_installemacsen:15 dh_installexamples:17 dh_installifupdown:15 dh_installinfo:15 dh_installinit:16 dh_installinitramfs:15 dh_installlogcheck:15 dh_installlogrotate:15 dh_installman:16 dh_installmanpages:16 dh_installmenu:15 dh_installmime:15 dh_installmodules:16 dh_installpam:15 dh_installppp:15 dh_installudev:15 dh_installwm:15 dh_installxfonts:15 dh_link:16 dh_lintian:15 dh_listpackages:15 dh_makeshlibs:15 dh_md5sums:16 dh_movefiles:15 dh_perl:17 dh_prep:15 dh_shlibdeps:17 dh_strip:16 dh_testdir:15 dh_testroot:9 dh_usrlocal:19 dh_systemd_enable:16 dh_systemd_start:17 msgid "SYNOPSIS" msgstr "" @@ -39,7 +39,7 @@ msgstr "" #. type: =head1 -#: debhelper.pod:11 dh:20 dh_auto_build:20 dh_auto_clean:20 dh_auto_configure:20 dh_auto_install:22 dh_auto_test:20 dh_bugfiles:19 dh_builddeb:21 dh_clean:19 dh_compress:21 dh_fixperms:20 dh_gconf:19 dh_gencontrol:20 dh_icons:20 dh_install:19 dh_installcatalogs:21 dh_installchangelogs:19 dh_installcron:19 dh_installdeb:19 dh_installdebconf:19 dh_installdirs:19 dh_installdocs:21 dh_installemacsen:19 dh_installexamples:21 dh_installifupdown:19 dh_installinfo:19 dh_installinit:20 dh_installlogcheck:19 dh_installlogrotate:19 dh_installman:20 dh_installmanpages:20 dh_installmenu:19 dh_installmime:19 dh_installmodules:20 dh_installpam:19 dh_installppp:19 dh_installudev:19 dh_installwm:19 dh_installxfonts:19 dh_link:20 dh_lintian:19 dh_listpackages:19 dh_makeshlibs:19 dh_md5sums:20 dh_movefiles:19 dh_perl:21 dh_prep:19 dh_shlibdeps:21 dh_strip:20 dh_testdir:19 dh_testroot:13 dh_usrlocal:23 dh_systemd_enable:20 dh_systemd_start:21 +#: debhelper.pod:11 dh:23 dh_auto_build:20 dh_auto_clean:20 dh_auto_configure:20 dh_auto_install:22 dh_auto_test:20 dh_bugfiles:19 dh_builddeb:21 dh_clean:19 dh_compress:21 dh_dwz:20 dh_fixperms:20 dh_gconf:19 dh_gencontrol:20 dh_icons:20 dh_install:19 dh_installcatalogs:21 dh_installchangelogs:19 dh_installcron:19 dh_installdeb:19 dh_installdebconf:19 dh_installdirs:19 dh_installdocs:21 dh_installemacsen:19 dh_installexamples:21 dh_installifupdown:19 dh_installinfo:19 dh_installinit:20 dh_installinitramfs:19 dh_installlogcheck:19 dh_installlogrotate:19 dh_installman:20 dh_installmanpages:20 dh_installmenu:19 dh_installmime:19 dh_installmodules:20 dh_installpam:19 dh_installppp:19 dh_installudev:19 dh_installwm:19 dh_installxfonts:19 dh_link:20 dh_lintian:19 dh_listpackages:19 dh_makeshlibs:19 dh_md5sums:20 dh_movefiles:19 dh_perl:21 dh_prep:19 dh_shlibdeps:21 dh_strip:20 dh_testdir:19 dh_testroot:13 dh_usrlocal:23 dh_systemd_enable:20 dh_systemd_start:21 msgid "DESCRIPTION" msgstr "" @@ -80,8 +80,7 @@ msgid "" "Except where tool explicitly denotes otherwise, all of the debhelper tools " "assumes that they run from root directory of an unpacked source package. " -"This is so they can locate find F and F when " -"needed." +"This is so they can locate find files like F when needed." msgstr "" #. type: =head1 @@ -160,11 +159,15 @@ #: debhelper.pod:79 msgid "" "Note for the first (or only) binary package listed in F, " -"debhelper will use F when there's no F file." +"debhelper will use F when there's no F.foo> " +"file. However, it is often a good idea to keep the F.> prefix as " +"it is more explicit. The primary exception to this are files that debhelper " +"by default installs in every binary package when it does not have a package " +"prefix (such as F or F)." msgstr "" #. type: textblock -#: debhelper.pod:83 +#: debhelper.pod:87 msgid "" "In some rare cases, you may want to have different versions of these files " "for different architectures or OSes. If files named " @@ -175,7 +178,7 @@ msgstr "" #. type: textblock -#: debhelper.pod:90 +#: debhelper.pod:94 msgid "" "Mostly, these config files are used to specify lists of various types of " "files. Documentation or example files to install, files to move, and so on. " @@ -186,115 +189,168 @@ msgstr "" #. type: textblock -#: debhelper.pod:97 +#: debhelper.pod:101 msgid "" "The syntax of these files is intentionally kept very simple to make them " -"easy to read, understand, and modify. If you prefer power and complexity, " -"you can make the file executable, and write a program that outputs whatever " -"content is appropriate for a given situation. When you do so, the output is " -"not further processed to expand wildcards or strip comments." +"easy to read, understand, and modify." +msgstr "" + +#. type: =head2 +#: debhelper.pod:104 +msgid "Executable debhelper config files" +msgstr "" + +#. type: textblock +#: debhelper.pod:106 +msgid "" +"If you need additional flexibility, many of the debhelper tools " +"(e.g. L) support executing a config file as a script." +msgstr "" + +#. type: textblock +#: debhelper.pod:109 +msgid "" +"To use this feature, simply mark the config file as executable (e.g. B<< " +"chmod +x debian/I.install >>) and the tool will attempt to execute " +"it and use the output of the script. In many cases, you can use " +"L as interpreter of the config file to retain most of the " +"original syntax while getting the additional flexibility you need." +msgstr "" + +#. type: textblock +#: debhelper.pod:117 +msgid "" +"When using executable debhelper config files, please be aware of the " +"following:" +msgstr "" + +#. type: =item +#: debhelper.pod:122 debhelper.pod:127 +msgid "*" +msgstr "" + +#. type: textblock +#: debhelper.pod:124 +msgid "" +"The executable config file B exit with success (i.e. its return code " +"should indicate success)." +msgstr "" + +#. type: textblock +#: debhelper.pod:129 +msgid "" +"The output will be used exactly as it is. Notably, debhelper will I " +"expand wildcards or strip comments in the output." +msgstr "" + +#. type: textblock +#: debhelper.pod:134 +msgid "" +"If you need the package to build on a file system where you cannot disable " +"the executable bit, then you can use L and its B " +"script." msgstr "" #. type: =head1 -#: debhelper.pod:103 +#: debhelper.pod:138 msgid "SHARED DEBHELPER OPTIONS" msgstr "" #. type: textblock -#: debhelper.pod:105 +#: debhelper.pod:140 msgid "The following command line options are supported by all debhelper programs." msgstr "" #. type: =item -#: debhelper.pod:109 +#: debhelper.pod:144 msgid "B<-v>, B<--verbose>" msgstr "" #. type: textblock -#: debhelper.pod:111 +#: debhelper.pod:146 msgid "Verbose mode: show all commands that modify the package build directory." msgstr "" #. type: =item -#: debhelper.pod:113 dh:72 +#: debhelper.pod:148 dh:85 msgid "B<--no-act>" msgstr "" #. type: textblock -#: debhelper.pod:115 +#: debhelper.pod:150 msgid "" "Do not really do anything. If used with -v, the result is that the command " "will output what it would have done." msgstr "" #. type: =item -#: debhelper.pod:118 +#: debhelper.pod:153 msgid "B<-a>, B<--arch>" msgstr "" #. type: textblock -#: debhelper.pod:120 +#: debhelper.pod:155 msgid "" "Act on architecture dependent packages that should be built for the " "B architecture." msgstr "" #. type: =item -#: debhelper.pod:123 +#: debhelper.pod:158 msgid "B<-i>, B<--indep>" msgstr "" #. type: textblock -#: debhelper.pod:125 +#: debhelper.pod:160 msgid "Act on all architecture independent packages." msgstr "" #. type: =item -#: debhelper.pod:127 +#: debhelper.pod:162 msgid "B<-p>I, B<--package=>I" msgstr "" #. type: textblock -#: debhelper.pod:129 +#: debhelper.pod:164 msgid "" "Act on the package named I. This option may be specified multiple " "times to make debhelper operate on a given set of packages." msgstr "" #. type: =item -#: debhelper.pod:132 +#: debhelper.pod:167 msgid "B<-s>, B<--same-arch>" msgstr "" #. type: textblock -#: debhelper.pod:134 +#: debhelper.pod:169 msgid "Deprecated alias of B<-a>." msgstr "" #. type: textblock -#: debhelper.pod:136 dh_install:77 dh_install:86 +#: debhelper.pod:171 dh_install:77 dh_install:86 msgid "This option is removed in compat 12." msgstr "" #. type: =item -#: debhelper.pod:138 +#: debhelper.pod:173 msgid "B<-N>I, B<--no-package=>I" msgstr "" #. type: textblock -#: debhelper.pod:140 +#: debhelper.pod:175 msgid "" "Do not act on the specified package even if an B<-a>, B<-i>, or B<-p> option " "lists the package as one that should be acted on." msgstr "" #. type: =item -#: debhelper.pod:143 +#: debhelper.pod:178 msgid "B<--remaining-packages>" msgstr "" #. type: textblock -#: debhelper.pod:145 +#: debhelper.pod:180 msgid "" "Do not act on the packages which have already been acted on by this " "debhelper command earlier (i.e. if the command is present in the package " @@ -304,12 +360,12 @@ msgstr "" #. type: =item -#: debhelper.pod:151 +#: debhelper.pod:186 msgid "B<--ignore=>I" msgstr "" #. type: textblock -#: debhelper.pod:153 +#: debhelper.pod:188 msgid "" "Ignore the specified file. This can be used if F contains a " "debhelper config file that a debhelper command should not act on. Note that " @@ -318,29 +374,29 @@ msgstr "" #. type: textblock -#: debhelper.pod:158 +#: debhelper.pod:193 msgid "" "For example, if upstream ships a F that you don't want " "B to install, use B<--ignore=debian/init>" msgstr "" #. type: =item -#: debhelper.pod:161 +#: debhelper.pod:196 msgid "B<-P>I, B<--tmpdir=>I" msgstr "" #. type: textblock -#: debhelper.pod:163 +#: debhelper.pod:198 msgid "Use I for package build directory. The default is debian/I" msgstr "" #. type: =item -#: debhelper.pod:165 +#: debhelper.pod:200 msgid "B<--mainpackage=>I" msgstr "" #. type: textblock -#: debhelper.pod:167 +#: debhelper.pod:202 msgid "" "This little-used option changes the package which debhelper considers the " "\"main package\", that is, the first one listed in F, and " @@ -349,12 +405,12 @@ msgstr "" #. type: =item -#: debhelper.pod:172 +#: debhelper.pod:207 msgid "B<-O=>I