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

Re: Getting dh_install to do what we need

Goswin von Brederlow <goswin-v-b@web.de> writes:

>>> At a glance what does this do?
>> [...]
>> It triggers my "slap the maintainer silly" button. Other than that, it's
>> dead simple: copy a file from one place to the other (with possibly
>> renaming the file), with the file list following the while loop.
> Not quite. It implements support for renaming files during dh_install,
> implementing the following syntax:
> file path/
> file path/new_name
> The hack it does is to copy the file in the source directory to the new
> name and then letting dh_install install it to the destination
> directory.

Yeah... I realized my mistake a minute after sending the message, but at
that point, I was already trying to come up with a she-bang tool that
helps with this case.

This, though, is a valid point against executable scripts, unless
they become somewhat standardized.

> And yes, like this it is a totaly ugly hack. Does it become better as
> #!/usr/bin/debhelper-exec-rename or something?

At the moment, I have something that works like this:

| #! /usr/bin/dh-exec-install
| # The next one will simply echo it back to dh_install
| source-file /dest-dir/
| # This one will copy the file itself, following similar heuristics as
| # dh_install: it will first try the source file directly, and if it's
| # not found, try the same path under debian/tmp/. The destination is
| # relative to debian/${PACKAGE} (as per dh compat level 7+)
| #
| # Since dh-exec-install does the copying itself, this line is NOT
| # echoed back to dh_install.
| source-file /dest-dir/new-name

My implementation copies the file to the desired destination, which may
or may not be a good idea - I'll do some more tests to see which one's
less painful and more safe.

I'm leaning towards copying to the destination with dh-exec-install
directly, as that avoids the possibility of naming conflicts within the
source (however unlikely that may be).

>> This also gave me an idea, and since this use-case seems to be common,
>> I'll probably rename my dh_subst thing to debhelper-exec-extras or
>> something similar, and include a little tool that will cover this
>> use-case aswell.
> What if I want to do more than one thing? For example rename and do the
> variable substitution. Should we have something like
> #! /usr/bin/debhelper-exec-pipe debhelper-exec-subst debhelper-exec-rename
> which would pipe the input file through debhelper-exec-subst and
> debhelper-exec-rename both?
> Does any Debian port have the limit of only one argument for shebangs?

Good question!

I thought about this too, and the current idea is a dh-exec tool, that
wraps the rest, and puts them in the appropriate order that makes sense
in 99% of the cases (with the current two tools: this will be
dh-exec-subst | dh-exec-install, so that we get variable expansion
before copy-stuff). This, however, is not completely implemented
yet. I'll fix that in a couple of hours when I near a computer.

And if so need be, this can be later extended with --with-$tool and
--without-$tool options, so that one can say:

#! /usr/bin/dh-exec --without-subst


#! /usr/bin/dh-exec --with-install

By the way, the current state of my work (renamed from dh-subst to
dh-exec) is available at https://github.com/algernon/dh-exec/ (the URL
may change, if the project gets renamed again), if you or anyone else
feels like giving it a test ride.

There's even a debian/ dir in there, and a test suite (just don't look
at the test scripts... I need to rewrite those)!


Reply to: