On Mon, 2012-02-06 at 15:57 +0100, Raphael Hertzog wrote:
> Hello,
> 
> On Mon, 06 Feb 2012, Sam Morris wrote:
> > And the conffile will not be removed.
> > 
> > Is the user in the wrong here? debian-faq says no, as it specifically
> > advises the user of dch -l when performing a local build. The user
> > cannot know when he's rebuilding the package that a subsequent version
> > will remove the conffile, and the package maintainer cannot know that a
> > user has rebuilt the package locally.
> > 
> > The same will happen when NMUs are prepared, if the package maintainer
> > is not careful about the version number that they invoke rm_conffile
> > with.
> 
> Good analysis, you're right. But the only fix that we can afford (since we
> want to preserve the API) is to update the documentation to recommend
> using a fake version bigger than $LASTVERSION and smaller than the version
> where the conffile is gone.
> 
> In your example it would be "2-1~".
> 
> Do you feel like suggesting a patch (or just an improved wording) for
> the manual page?

I've attached a patch. I've renamed lastversion to priorversion as I
think it's less ambiguous. I'm not sure whether we should provide a few
more examples of more exotic Debian version numbers, too.

Regards,

-- 
Sam Morris <s...@robots.org.uk>
--- /dev/fd/63	2012-02-06 15:46:35.284854684 +0000
+++ dpkg-maintscript-helper.1	2012-02-06 15:45:40.192044129 +0000
@@ -8,9 +8,9 @@
 .
 .SH COMMANDS AND PARAMETERS
 .P
-\fBrm_conffile\fP \fIconffile\fP [\fIlastversion\fP [\fIpackage\fP]]
+\fBrm_conffile\fP \fIconffile\fP [\fIpriorversion\fP [\fIpackage\fP]]
 .P
-\fBmv_conffile\fP \fIoldconffile\fP \fInewconffile\fP [\fIlastversion\fP [\fIpackage\fP]]
+\fBmv_conffile\fP \fIoldconffile\fP \fInewconffile\fP [\fIpriorversion\fP [\fIpackage\fP]]
 .
 .SH DESCRIPTION
 .P
@@ -52,17 +52,32 @@
 \fBpreinst\fP, \fBpostinst\fP and \fBpostrm\fP maintainer scripts:
 .P
     dpkg\-maintscript\-helper rm_conffile \\
-        \fIconffile\fP \fIlastversion\fP \fIpackage\fP \-\- "$@"
+        \fIconffile\fP \fIpriorversion\fP \fIpackage\fP \-\- "$@"
 .P
 \fIconffile\fP is the filename of the conffile to remove.
-\fIlastversion\fP is the last version of the package that contained the
-conffile (or the last version of the package that did not take care to
-remove the obsolete conffile if this was not immediately implemented).
-If \fIlastversion\fP is empty or omitted, then the operation is tried
-on every upgrade. \fIpackage\fP is the package name, it's optional as it will
-default to $DPKG_MAINTSCRIPT_PACKAGE (this variable is set by dpkg to the
-name of the package acted upon). All the parameters of the maintainer
-scripts have to be forwarded to the program after "\-\-".
+.P
+\fIpriorversion\fP is the latest possible legal version that preceeds the
+version of the package that removes the conffile. If empty or omitted, the
+removal operaion will be tried whenever the page is installed.
+.P
+It is important to calculate \fIpriorversion\fP correctly so that conffiles are
+correctly removed even if the user rebuilt the package with a local version.
+For example, for a conffile removed in version \fB2-1\fP of a package,
+\fIpriorversion\fP should be set to \fB2-1~\fP. This will cause the conffile to
+be removed even if the user rebuilt the previous version, \fB1-1\fP as
+\fB1-1local1\fP.
+.P
+If the conffile has not been shipped for several versions, and you are now
+modifying the maintainer scripts to clean up the obsolete file,
+\fIpriorversion\fP should be based on the version of the package that you are
+now preparing, \fInot\fP the first version of the package that lacked the
+conffile.
+.P
+\fIpackage\fP is the package name. If empty or omitted, the
+DPKG_MAINTSCRIPT_PACKAGE environment variable (as set by dpkg) will be used.
+.P
+All the parameters of the maintainer scripts have to be forwarded to the
+program after "\-\-".
 .P
 Current implementation: in the \fBpreinst\fP, it checks if the conffile
 was modified and renames it either to \fIconffile\fP\fB.dpkg\-remove\fP (if not
@@ -86,17 +101,22 @@
 scripts:
 .P
     dpkg\-maintscript\-helper mv_conffile \\
-        \fIoldconffile\fP \fInewconffile\fP \fIlastversion\fP \fIpackage\fP \-\- "$@"
+        \fIoldconffile\fP \fInewconffile\fP \fIpriorversion\fP \fIpackage\fP \-\- "$@"
 .P
 \fIoldconffile\fP and \fInewconffile\fP are the old and new name of the
-conffile to rename. \fIlastversion\fP is the last version of the package
-that contained the conffile with the old name. If \fIlastversion\fP is
+conffile to rename.
+.P
+\fIpriorversion\fP is the latest possible legal version that preceeds the
+first version of the package with the new name (see the notes for
+\fBrm_conffile\fR above concerning the correct value. If \fIpriorversion\fP is
 empty or omitted, then the operation is tried on every upgrade (note: it's
-safer to give the version and have the operation tried only once). \fIpackage\fP
-is the package name, it's optional as it will default to
-$DPKG_MAINTSCRIPT_PACKAGE (this variable is set by dpkg to the name of the
-package acted upon). All the parameters of the maintainer scripts have to
-be forwarded to the program after "\-\-".
+safer to give the version and have the operation tried only once).
+.P
+\fIpackage\fP is the package name. If empty or omitted, the
+DPKG_MAINTSCRIPT_PACKAGE environment variable (as set by dpkg) will be used.
+.P
+All the parameters of the maintainer scripts have to be forwarded to the
+program after "\-\-".
 .P
 Current implementation: the \fBpreinst\fP checks if the conffile has been
 modified, if yes it's left on place otherwise it's renamed to

Reply via email to