[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

debhelper third-party command option parsing transition

Attention, all maintainers of third-party debhelper commands. Sometime
in the next week or two, I plan to put dehelper 7.1.x in unstable. This
version, currently in experimental, has a significant change to its
command option parser, and a few[1] third-party commands need changes to
keep all the options they use working.

From the changelog:

  * Move many command-specific options to only be accepted by the command
    that uses them. Affected options are:
     -x, -r, -R, -l, -L, -m,
    --include-conffiles, --no-restart-on-upgrade, --no-start,
    --restart-after-upgrade, --init-script, --filename, --flavor, --autodest,
    --libpackage, --add-udeb, --dpkg-shlibdeps-params,
    --dpkg-gencontrol-params, --update-rcd-params, --major, --remove-d,
    --dirs-only, --keep-debug, --version-info, --list-missing, --fail-missing,
    --language, --until, --after, --before, --remaining, --with
  * If any third-party debhelper commands use any of the above options,
    they will be broken, and need to be changed to pass options to init().


         dh_makeclilibs [debhelper options] [-r] [-V[dependancies]] [-mminversion] [-lnextincompatible] [-Xitem]

From the synopsis, we can see this command uses 
removed options -r, -m, and -l. It also turns out to
use --version-info.

To re-add support for these flags, look for the call 
to `init()`, and change it to include an options parameter:

init(options => {
	"r" => \$dh{R_FLAG},
	"m=s" => \$dh{M_PARAMS},
	"l=s" => \$dh{L_PARAMS},
        "version-info:s" => \$dh{V_FLAG},

The values inside the hash are the same as would be passed
to Getopt::Long. -m and -l require a string parameter, thus
the "=s". --version-info can optionally take a string parameter,
thus the ":s".

The $dh{R_FLAG}, $dh{M_PARAMS} etc variables are the ones
historically set by debhelper when these options are set.

With that simple change made, dh_makeclilibs will be compatable with
both the old and new versions of debhelper. So no versioned
dependency is needed.


Here is an excerpt of the getopt options from stable's debhelper,
showing how it handled each of the removed options.

		"x" => \$dh{INCLUDE_CONFFILES}, # is -x for some unknown historical reason..
		"include-conffiles" => \$dh{INCLUDE_CONFFILES},
		"remove-d" => \$dh{D_FLAG},
		"dirs-only" => \$dh{D_FLAG},
		"r" => \$dh{R_FLAG},
		"no-restart-on-upgrade" => \$dh{R_FLAG},
		"no-start" => \$dh{NO_START},
		"R|restart-after-upgrade" => \$dh{RESTART_AFTER_UPGRADE},
		"keep-debug" => \$dh{K_FLAG},

		"update-rcd-params=s", => \$dh{U_PARAMS},
	        "dpkg-shlibdeps-params=s", => \$dh{U_PARAMS},
		"dpkg-gencontrol-params=s", => \$dh{U_PARAMS},

		"l=s", => \$dh{L_PARAMS},

		"m=s", => \$dh{M_PARAMS},
		"major=s" => \$dh{M_PARAMS},

		"version-info:s" => \$dh{V_FLAG},

		"init-script=s" => \$dh{INIT_SCRIPT},
		"filename=s" => \$dh{FILENAME},
		"flavor=s" => \$dh{FLAVOR},

		"autodest" => \$dh{AUTODEST},

		"list-missing" => \$dh{LIST_MISSING},

		"fail-missing" => \$dh{FAIL_MISSING},
		"L|libpackage=s" => \$dh{LIBPACKAGE},
		"error-handler=s" => \$dh{ERROR_HANDLER},
		"add-udeb=s" => \$dh{SHLIBS_UDEB},
		"language=s" => \$dh{LANGUAGE},

		"until=s" => \$dh{UNTIL},
		"after=s" => \$dh{AFTER},
		"before=s" => \$dh{BEFORE},
		"remaining" => \$dh{REMAINING},
		"with=s" => \&AddWith,

see shy jo

[1] I had to read through about 1/3 of all the existing third-party
    commands I could find in order to find the one example above
    of a command that uses these options.

Attachment: signature.asc
Description: Digital signature

Reply to: