tags 456241 patch user [EMAIL PROTECTED] usertags 456241 ubuntu-patch thanks
Hi Manoj, Taking into consideration the concerns you expressed on IRC about the tight coupling between the debconf templates and the code, here is a preliminary patch which tries to add support for a new --debconf-template option which will use the named template, but which will pull the names of the debconf choices from the original ucf templates at runtime and substitute them into the provided template. This still leaves open the possibility that a future version of ucf will change or reorder the available choices, resulting in the debconf UI being out of sync with the backend. If you want to be free to make changes to the list of ucf debconf choices in the future, another option would be to query the Choices-C content for both the original and alternate templates, and only use the alternate template if the Choices-C lists match exactly. I'm happy to rework the patch with that goal if you think that's a better idea. Cheers, -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. Ubuntu Developer http://www.debian.org/ [EMAIL PROTECTED] [EMAIL PROTECTED]
diff -Nru ucf-3.004/debian/changelog ucf-3.004/debian/changelog --- ucf-3.004/debian/changelog 2007-11-30 01:34:53.000000000 -0800 +++ ucf-3.004/debian/changelog 2008-01-17 22:05:32.000000000 -0800 @@ -1,3 +1,12 @@ +ucf (3.004-0.1) unstable; urgency=low + + * Non-maintainer upload. + * Based on the preceding enhancement from Frans, add a new + --debconf-template option to specify an alternate caller-provided + debconf template for the user prompt. Closes: #456241. + + -- Steve Langasek <[EMAIL PROTECTED]> Thu, 17 Jan 2008 18:34:56 -0800 + ucf (3.004) unstable; urgency=high * For "keep current" and "threeway merge", ucf expects answers from diff -Nru /tmp/bgOPVr3Iyb/ucf-3.004/ucf /tmp/Zwz5DBheBh/ucf-3.004/ucf --- ucf-3.004/ucf 2007-11-30 01:34:52.000000000 -0800 +++ ucf-3.004/ucf 2008-01-17 18:34:51.000000000 -0800 @@ -358,6 +358,8 @@ opt_old_mdsum_file="$2"; shift 2 ;; --state-dir) opt_state_dir="$2"; shift 2 ;; + --debconf-template) + override_template="$2"; shift 2 ;; -D|-d|--debug|--DEBUG) # d has an optional argument. As we are in quoted mode, # an empty parameter will be generated if its optional @@ -822,6 +824,11 @@ else templ=ucf/changeprompt fi + if [ "X$override_template" != "X" ]; then + choices="$(db_metaget $templ Choices-C)" + templ=$override_template + db_subst $templ CHOICES "$choices" + fi db_fset $templ seen false db_reset $templ db_subst $templ FILE "$dest_file" diff -Nru /tmp/bgOPVr3Iyb/ucf-3.004/ucf.1 /tmp/Zwz5DBheBh/ucf-3.004/ucf.1 --- ucf-3.004/ucf.1 2007-11-30 01:34:52.000000000 -0800 +++ ucf-3.004/ucf.1 2008-01-17 22:04:12.000000000 -0800 @@ -203,6 +203,17 @@ with this option should take care to depend on version 0.28 or higher of ucf (the first to support use this option). .TP +.B "\-\-debconf\-template foo" +Instruct ucf to use the named multiselect debconf template instead of +the normal ucf-provided debconf template. The caller is responsible for +ensuring that the named template exists and has a list of choices +matching those for the default ucf template, and should set +Choices\-C: ${CHOICES} to ensure the returned values match those from +the default template. Note that the choices must be different according +to whether the +.B \-\-three\-way +option is also set. +.TP .B "\-\-state\-dir /path/to/dir" Set the state directory to /path/to/dir instead of the default .I /var/lib/ucf.