Bug#710970: Please include extended dh_ucf script
Hello, On Sun, Aug 14, 2022 at 01:16:15PM +0200, Niels Thykier wrote: > Yes, I would still be interested in the improvements if you still feel it > would be worth your time and effort to do them. :) Originally I created the bug/patch to ease the maintenance of the numerous rule files in the aide package. Meanwhile Marc (one of the aide maintainers) has developed some ucf helper functions for the same purpose. These functions are now provided by the ucf package [ucf_helper_functions] and are used directly in the aide-common postinst file (see [aide-common.postinst]). Principally I'm still willing to update the dh_ucf patch, but I think it does not make sense to provide the same functionality in two different packages (debhelper and ucf). How do we want to proceed now? @Marc @Manoj What is your opinion as the maintainers of the other involved packages? Best regards Hannes [ucf_helper_functions] https://salsa.debian.org/srivasta/ucf/-/blob/master/ucf_helper_functions.sh [aide-common.postinst[ https://salsa.debian.org/debian/aide/-/blob/master/debian/aide-common.postinst
Bug#710970: [debhelper-devel] Bug#710970: Please include extended dh_ucf script
Hannes von Haugwitz: Hi Niels, On Wed, Apr 12, 2017 at 10:49:00AM +, Niels Thykier wrote: Let me know when you have an updated patch. :) Sorry for the long delay. Looks like I still owe you an updated patch. Are you still interested the enhancements? Best regards Hannes Hi Hannes, Yes, I would still be interested in the improvements if you still feel it would be worth your time and effort to do them. :) Thanks, ~Niels
Bug#710970: [debhelper-devel] Bug#710970: Please include extended dh_ucf script
Hi Niels, On Wed, Apr 12, 2017 at 10:49:00AM +, Niels Thykier wrote: > Let me know when you have an updated patch. :) Sorry for the long delay. Looks like I still owe you an updated patch. Are you still interested the enhancements? Best regards Hannes
Bug#710970: [debhelper-devel] Bug#710970: Please include extended dh_ucf script
Hannes von Haugwitz: > Dear Debhelper Maintainers, > > On Sun, Jul 14, 2013 at 10:43:48AM +0200, Hannes von Haugwitz wrote: >> Both points make sense. I'll update the script to enable '--three-way' >> by default and change the synopsis to 'dh_ucf [debhelper options] [-n] >> [-- params]'. > > Apart from the above two points what else do I have to do to get the > patch accepted? > > Best regards > > Hannes > > [...] Hi Hannes, Sorry that this bug has fallen between the chairs in between debhelper changing maintainer. :) Those two points would be great to have implemented. I think the concern with the shell function comes in several variants: * The shell function is afterwards available to the maintainer, effectively making it a part of the API/ABI. * It can clash with another maintainer defined function. (Less likely and trivially solved by using a proper namespace for debhelper provided functions) * The autoscripts should have trivial logic as updates it takes a long time to roll out patches to autoscripts. This is easier to do if the complex logic is outsourced to a different tool called from the scripts[1]. Defining a function has probably been the rule of thumb for something that is getting too complex. I am willing to try this if we name space the function. Let me know when you have an updated patch. :) Thanks, ~Niels [1] This has its own issues like very few packages can actually provide such programs. Nonetheless, that was one of the design goals.
Bug#710970: Please include extended dh_ucf script
Dear Debhelper Maintainers, On Sun, Jul 14, 2013 at 10:43:48AM +0200, Hannes von Haugwitz wrote: > Both points make sense. I'll update the script to enable '--three-way' > by default and change the synopsis to 'dh_ucf [debhelperĀ options] [-n] > [-- params]'. Apart from the above two points what else do I have to do to get the patch accepted? Best regards Hannes
Bug#710970: Please include extended dh_ucf script
Hello, On Sun, Jun 23, 2013 at 01:05:43PM -0400, Joey Hess wrote: Hannes von Haugwitz wrote: +postinst_ucf() { +if [ $1 = configure ]; then +ucf #UCFOPTIONS# $2 $3 +ucfr #PACKAGE# $3 +fi +} I don't think any debhelper autoscripts define shell functions, and so I am wary of adding that here. A for loop would have the same effect. What is wrong with shell functions? A for loop wouldn't help here, but one could hack a while loop analogous to the dh_usrlocal script. However I think shell functions are the cleaner approach. I am also somewhat doubtful of the utility of optimising the space used by the maintainer script snippets. How many files are being registered with ucf to make this matter? The aide package currently registers 157 configuration files with ucf. The current dh_ucf script would generate 936 postinst lines and 2198 postrm lines. My approach only generates 479 postinst lines and 486 postrm lines. Please let me know which approach do you prefer (shell functions, while loops or the current one). Does ucf scale to that many files? What if they all got changed, does the admin have to wade through hundreds of ucf prompts? Yes, but the same would apply if the files would have been managed by dpkg itself. -Bdh_ucf [SIdebhelper options] [B-n] +Bdh_ucf [SIdebhelper options] [B-n] [B--debconf-ok] [B--three-way] It does not seem appropriate to add individual ucf options to dh_ucf. One way that would work better would be to take all options after -- as options for ucf. I also wonder if there's any reason not to make --three-way the default, either in ucf itself, or in dh_ucf. Both points make sense. I'll update the script to enable '--three-way' by default and change the synopsis to 'dh_ucf [debhelperĀ options] [-n] [-- params]'. Best regards Hannes -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#710970: Please include extended dh_ucf script
Hannes von Haugwitz wrote: diff --git a/autoscripts/postinst-ucf-function b/autoscripts/postinst-ucf-function new file mode 100644 index 000..8f59fc0 --- /dev/null +++ b/autoscripts/postinst-ucf-function @@ -0,0 +1,6 @@ +postinst_ucf() { +if [ $1 = configure ]; then +ucf #UCFOPTIONS# $2 $3 +ucfr #PACKAGE# $3 +fi +} I don't think any debhelper autoscripts define shell functions, and so I am wary of adding that here. A for loop would have the same effect. I am also somewhat doubtful of the utility of optimising the space used by the maintainer script snippets. How many files are being registered with ucf to make this matter? Does ucf scale to that many files? What if they all got changed, does the admin have to wade through hundreds of ucf prompts? -Bdh_ucf [SIdebhelper options] [B-n] +Bdh_ucf [SIdebhelper options] [B-n] [B--debconf-ok] [B--three-way] It does not seem appropriate to add individual ucf options to dh_ucf. One way that would work better would be to take all options after -- as options for ucf. I also wonder if there's any reason not to make --three-way the default, either in ucf itself, or in dh_ucf. -- see shy jo signature.asc Description: Digital signature
Bug#710970: Please include extended dh_ucf script
Package: debhelper Severity: wishlist File: /usr/bin/dh_ucf Tags: patch Hi, I want to use the dh_ucf script with the 'aide' package. That requires the changes contained in the attached patch against the master branch. The changes include * support directories * support '--debconf-ok' ucf option * support '--three-way' ucf option * check for errors at code generation time * reduced size of generated code for multiple config files Please consider to include the changes in the debhelper package. Thanks Hannes From 053065013479e656e16f2e7d348bae7b78714d71 Mon Sep 17 00:00:00 2001 From: Hannes von Haugwitz han...@vonhaugwitz.com Date: Mon, 3 Jun 2013 21:18:06 +0200 Subject: [PATCH] dh_ucf: extended script * support directories * support '--debconf-ok' ucf option * support '--three-way' ucf option * check for errors at code generation time * reduced size of generated code for multiple config files Signed-off-by: Hannes von Haugwitz han...@vonhaugwitz.com --- autoscripts/postinst-ucf |5 +-- autoscripts/postinst-ucf-function |6 +++ autoscripts/postrm-ucf| 13 +- autoscripts/postrm-ucf-function | 13 ++ dh_ucf| 88 - 5 files changed, 97 insertions(+), 28 deletions(-) create mode 100644 autoscripts/postinst-ucf-function create mode 100644 autoscripts/postrm-ucf-function diff --git a/autoscripts/postinst-ucf b/autoscripts/postinst-ucf index 0546831..20db9ca 100644 --- a/autoscripts/postinst-ucf +++ b/autoscripts/postinst-ucf @@ -1,4 +1 @@ -if [ $1 = configure ]; then - ucf #UCFSRC# #UCFDEST# - ucfr #PACKAGE# #UCFDEST# -fi +postinst_ucf $1 #UCFSRC# #UCFDEST# diff --git a/autoscripts/postinst-ucf-function b/autoscripts/postinst-ucf-function new file mode 100644 index 000..8f59fc0 --- /dev/null +++ b/autoscripts/postinst-ucf-function @@ -0,0 +1,6 @@ +postinst_ucf() { +if [ $1 = configure ]; then +ucf #UCFOPTIONS# $2 $3 +ucfr #PACKAGE# $3 +fi +} diff --git a/autoscripts/postrm-ucf b/autoscripts/postrm-ucf index da37572..0c80d0a 100644 --- a/autoscripts/postrm-ucf +++ b/autoscripts/postrm-ucf @@ -1,12 +1 @@ -if [ $1 = purge ]; then - for ext in .ucf-new .ucf-old .ucf-dist ; do - rm -f #UCFDEST#$ext - done - - if [ -x `which ucf 2/dev/null` ]; then - ucf --purge #UCFDEST# - fi - if [ -x `which ucfr 2/dev/null` ]; then - ucfr --purge #PACKAGE# #UCFDEST# - fi -fi +postrm_ucf $1 #UCFDEST# diff --git a/autoscripts/postrm-ucf-function b/autoscripts/postrm-ucf-function new file mode 100644 index 000..4417cda --- /dev/null +++ b/autoscripts/postrm-ucf-function @@ -0,0 +1,13 @@ +postrm_ucf() { +if [ $1 = purge ]; then +for ext in .ucf-new .ucf-old .ucf-dist ; do +rm -f $2$ext +done +if [ -x `which ucf 2/dev/null` ]; then +ucf --purge $2 +fi +if [ -x `which ucfr 2/dev/null` ]; then +ucfr --purge #PACKAGE# $2 +fi +fi +} diff --git a/dh_ucf b/dh_ucf index 98fc4ae..af16c60 100755 --- a/dh_ucf +++ b/dh_ucf @@ -7,30 +7,38 @@ dh_ucf - register configuration files with ucf =cut use strict; +use File::Find; use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS -Bdh_ucf [SIdebhelper options] [B-n] +Bdh_ucf [SIdebhelper options] [B-n] [B--debconf-ok] [B--three-way] =head1 DESCRIPTION Bdh_ucf is a debhelper program that is responsible for generating the Fpostinst and Fpostrm commands that register files with ucf(1) and ucfr(1). +A dependency on ucf will be generated in B${misc:Depends}. + =head1 FILES =over 4 =item debian/Ipackage.ucf -List pairs of source and destination files to register with ucf. Each pair -should be put on its own line, with the source and destination separated by -whitespace. Both source and destination must be absolute paths. The source -should be a file that is provided by your package, typically in /usr/share/, -while the destination is typically a file in /etc/. +List pairs of source and destination files (or directories) to register with +ucf. Each pair should be put on its own line, with the source and destination +separated by whitespace. Both source and destination must be absolute paths. +The source should be a file/directory that is provided by your package, +typically in /usr/share/, while the destination is typically a file/directory +in /etc/. If a source directory contains sub-directories, your package must +ensure that these sub-directories exist in the destination directories. They +are neither created by Bdh_ucf nor by Bucf(1). -A dependency on ucf will be generated in B${misc:Depends}. +The script checks if each source file and the destination directory are +available in the package and the corresponding destination file does not +already exist in the package. =back @@ -42,6 +50,14 @@ A dependency on ucf will be generated in B${misc:Depends}. Do not modify Fpostinst/Fpostrm scripts. Turns this command into a no-op. +=item