FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 12-14-2011, 10:04 AM
Gergely Nagy
 
Default RFC/RFR: dh-exec -- Scripts to help with executable debhelper files

Hi!

As a result of a recent discussion on this list, I started to prepare a
package[1] that will hopefully make it easier and more straightforward
to use the executable debhelper files introduces in 8.9.12.

For now, it can only substitute environment variables, and stuff
dpkg-architecture(1) knows about (yes, it will work just fine even when
$DEB_HOST_MULTIARCH and similar aren't available in the environment),
but there's possibility to add more helpers, as the need arises, and a
suitable syntax can be agreed upon.

(There's also a rename-capable .install helper in the sources, but
because the syntax used by it is bad to say the least, it's disabled for
now).

Source is available from github[2], the debian dsc was uploaded to
mentors.d.n[1], packages can be built easily.

I'd like to request reviews and comments, so we can iron out any
shortcomings in the syntax and fix any bugs I might have left in, before
it hits the archive, and people start to use it (which I hope they will,
instead of rolling their own scripts).

There are man pages, test cases, and even an example package in the
sources, which should be enough to get one started. I'm also very
interested in suggestions on how to improve the documentation, as I'm
terrible when it comes to writing useful docs.

Also, I'm not entirely happy with the name, either. So if someone has a
better suggestion, please let me know. (No, it won't be named
/usr/bin/${holy cow, what have I done?}, nor /usr/bin/wtfisthis?!)

[1]: http://mentors.debian.net/package/dh-exec
[2]: http://github.com/algernon/dh-exec

--
|8]


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87zkev2z4s.fsf@algernon.balabit">http://lists.debian.org/87zkev2z4s.fsf@algernon.balabit
 
Old 12-14-2011, 12:08 PM
Roland Mas
 
Default RFC/RFR: dh-exec -- Scripts to help with executable debhelper files

Gergely Nagy, 2011-12-14 12:04:03 +0100 :

> Hi!
>
> As a result of a recent discussion on this list, I started to prepare a
> package[1] that will hopefully make it easier and more straightforward
> to use the executable debhelper files introduces in 8.9.12.
>
> For now, it can only substitute environment variables, and stuff
> dpkg-architecture(1) knows about (yes, it will work just fine even when
> $DEB_HOST_MULTIARCH and similar aren't available in the environment),
> but there's possibility to add more helpers, as the need arises, and a
> suitable syntax can be agreed upon.

I'm sorry I'm not giving a true review of dh-exec, but I'm wondering
if there could be a way of extending either dh or dh-exec so as to
handle generic substitutions (or other preprocessing) in maintainer
scripts. There's already some stuff to handle Debconf (with the
#DEBHELPER# magic), but I'm looking for something more generic. Maybe
dh-exec could be involved?

Roland.
--
Roland Mas

Homme qui plus rien à dire, citer proverbe chinois.
-- Proverbe chinois.


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87vcpjs3kn.fsf@mirexpress.internal.placard.fr.eu.o rg">http://lists.debian.org/87vcpjs3kn.fsf@mirexpress.internal.placard.fr.eu.o rg
 
Old 12-14-2011, 01:01 PM
Gergely Nagy
 
Default RFC/RFR: dh-exec -- Scripts to help with executable debhelper files

Roland Mas <lolando@debian.org> writes:

> Gergely Nagy, 2011-12-14 12:04:03 +0100 :
>
>> Hi!
>>
>> As a result of a recent discussion on this list, I started to prepare a
>> package[1] that will hopefully make it easier and more straightforward
>> to use the executable debhelper files introduces in 8.9.12.
>>
>> For now, it can only substitute environment variables, and stuff
>> dpkg-architecture(1) knows about (yes, it will work just fine even when
>> $DEB_HOST_MULTIARCH and similar aren't available in the environment),
>> but there's possibility to add more helpers, as the need arises, and a
>> suitable syntax can be agreed upon.
>
> I'm sorry I'm not giving a true review of dh-exec, but I'm wondering
> if there could be a way of extending either dh or dh-exec so as to
> handle generic substitutions (or other preprocessing) in maintainer
> scripts. There's already some stuff to handle Debconf (with the
> #DEBHELPER# magic), but I'm looking for something more generic. Maybe
> dh-exec could be involved?

It can be done with dh-exec, for files that are executable. The
substitutions are actually done by two perl scripts (which are held
together with dh-exec-subst, which in turn, is called via dh-exec), one
expands environment variables, the other expands dpkg-architecture
stuff.

There is no limit on what can be expanded, and it's as easy as writing a
simple script, and dropping it into the appropriate place (ie, my
mailbox, so I can add it to dh-exec).

For example, if you'd want to expand debconf variables (you don't want
to do this, by the way), so that ${debconfostfix/destinations} would
expand to the appropriate value, you could do something like this:

,----
| #! /usr/bin/perl -w
| use strict;
| use Debconf::Client::ConfModule ':all';
|
| while (<>) {
| next unless /${debconf:[^}]+}/;
| s#(${debconf[^}]+)})/get($2) || $1/eg;
| print;
| }
`----

(The above code is completely untested, but it should give you an idea).

You can make it expand ${...} whatever way you want it to, or can even
make it expand #MYSILLYSTUFF# specially, and so on.

dh-exec does not, and will not replace or extend debhelper's autoscripts
stuff (that's how the #DEBHELPER# magic is handled), it's only for
making common tasks that would be done with executable dh config files
easier. These do not include maintainer scripts, that's out of the scope
for dh-exec.

--
|8]


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87vcpj2qws.fsf@algernon.balabit">http://lists.debian.org/87vcpj2qws.fsf@algernon.balabit
 
Old 12-15-2011, 04:33 PM
Gergely Nagy
 
Default RFC/RFR: dh-exec -- Scripts to help with executable debhelper files

Gergely Nagy <algernon@balabit.hu> writes:

> For now, it can only substitute environment variables, and stuff
> dpkg-architecture(1) knows about (yes, it will work just fine even when
> $DEB_HOST_MULTIARCH and similar aren't available in the environment),
> but there's possibility to add more helpers, as the need arises, and a
> suitable syntax can be agreed upon.
>
> (There's also a rename-capable .install helper in the sources, but
> because the syntax used by it is bad to say the least, it's disabled for
> now).

After a night of very little sleep, I came up with a hack so funny, that
it even scares me. Nevertheless, since I had nightmares ever since, I'm
going to tell you all, dear readers, so the horror can be shared by
many, and in years to come, we can frighten little children with it.

I rewrote the .install helper so that it uses a nicer syntax:

,----
| #! /usr/bin/dh-exec
| etc/sample.conf => /etc/my-package/my-package.conf
| examples/* /usr/share/doc/my-package/examples
`----

The syntax itself isn't all that bad. But the implementation! OH MY!

To make it behave nicely, and not break dh_install in various
interesting ways, the requirement was that it must be dh_install that
will put the files to their final place. The script must not fiddle with
the destination at all.

Another requirement I had was that I do not wish to litter the source
tree, so copying the file to a new name within the source tree was ruled
out aswell.

I didn't want to leave temporary files behind, as those would need extra
care to get properly cleaned up.

And then it dawned on me: why not abuse debian/tmp for this purpose? It
will be deleted by dh_prep on clean, so whatever I put there, will be
cleaned up.

If I use a suitable temporary directory under debian/tmp, then it should
not conflict with anything else, either.

So I went ahead and did that. The new helper will take the input
mentioned above, copy etc/sample.conf to something like
debian/tmp/dh-exec.DEADBEEF/etc/my-package/my-package.conf, and rewrite
its output to look like this:

,----
| dh-exec.DEADBEEF/etc/my-package/my-package.conf /etc/my-package
| examples/* /usr/share/doc/my-package/examples
`----

As far as I see, this should cause no ill side-effects, apart from
strangely named directories under debian/tmp.

The code is available on the feature/exec-install/arrow-syntax[1] branch
of my repository[2].

[1]: https://github.com/algernon/dh-exec/tree/feature/exec-install/arrow-syntax
[2]: https://github.com/algernon/dh-exec

Let me know what you think.

--
|8]


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87fwgl7nan.fsf@algernon.balabit">http://lists.debian.org/87fwgl7nan.fsf@algernon.balabit
 
Old 12-15-2011, 06:38 PM
Josselin Mouette
 
Default RFC/RFR: dh-exec -- Scripts to help with executable debhelper files

Le jeudi 15 décembre 2011 à 18:33 +0100, Gergely Nagy a écrit :
> ,----
> | #! /usr/bin/dh-exec
> | etc/sample.conf => /etc/my-package/my-package.conf
> | examples/* /usr/share/doc/my-package/examples
> `----
>
> The syntax itself isn't all that bad. But the implementation! OH MY!
[snip]

> Let me know what you think.

Well, thanks for making my point. Implementing these (useful) features
in debhelper would be less pain to write and less eyesore for looking at
the implementation.

--
.'`. Josselin Mouette
: :' :
`. `'
`-
 
Old 12-15-2011, 06:53 PM
Vincent Danjean
 
Default RFC/RFR: dh-exec -- Scripts to help with executable debhelper files

Le 15/12/2011 18:33, Gergely Nagy a écrit :

,----
| dh-exec.DEADBEEF/etc/my-package/my-package.conf /etc/my-package
| examples/* /usr/share/doc/my-package/examples
`----

As far as I see, this should cause no ill side-effects, apart from
strangely named directories under debian/tmp.

[...]

Let me know what you think.


How to you handle --list-missing from dh_install? I use it in my
package to be sure to detect when a new file is added by upstream.

Regards,
Vincent


--
Vincent Danjean GPG key ID 0x9D025E87 vdanjean@debian.org
GPG key fingerprint: FC95 08A6 854D DB48 4B9A 8A94 0BF7 7867 9D02 5E87
Unofficial pkgs: http://moais.imag.fr/membres/vincent.danjean/deb.html
APT repo: deb http://people.debian.org/~vdanjean/debian unstable main


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4EEA503A.6060400@free.fr">http://lists.debian.org/4EEA503A.6060400@free.fr
 
Old 12-15-2011, 06:55 PM
Gergely Nagy
 
Default RFC/RFR: dh-exec -- Scripts to help with executable debhelper files

Josselin Mouette <joss@debian.org> writes:

> Le jeudi 15 décembre 2011 à 18:33 +0100, Gergely Nagy a écrit :
>> ,----
>> | #! /usr/bin/dh-exec
>> | etc/sample.conf => /etc/my-package/my-package.conf
>> | examples/* /usr/share/doc/my-package/examples
>> `----
>>
>> The syntax itself isn't all that bad. But the implementation! OH MY!
> [snip]
>
>> Let me know what you think.
>
> Well, thanks for making my point. Implementing these (useful) features
> in debhelper would be less pain to write and less eyesore for looking at
> the implementation.

Perhaps. But the executable thing is what is in debhelper, not the
variable expansion, nor the renaming at dh_install time. I'm offering a
solution to make these cases simpler and standard.

It's certainly a possiblity to persuade me that this is a stupid idea,
and then we'll end up with no simple, standardish solution, and everyone
will roll their own, like we used to do with patch systems in the days
of yore.

And for the record, I'm seeking input on the dh-exec implementation
here. Keep the anti-executable-debhelper-foo thing in the other thread,
please.

--
|8]


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87pqfp4nk7.fsf@luthien.mhp">http://lists.debian.org/87pqfp4nk7.fsf@luthien.mhp
 
Old 12-16-2011, 05:54 AM
Gergely Nagy
 
Default RFC/RFR: dh-exec -- Scripts to help with executable debhelper files

Vincent Danjean <vdanjean.ml@free.fr> writes:

> Le 15/12/2011 18:33, Gergely Nagy a écrit :
>> ,----
>> | dh-exec.DEADBEEF/etc/my-package/my-package.conf /etc/my-package
>> | examples/* /usr/share/doc/my-package/examples
>> `----
>>
>> As far as I see, this should cause no ill side-effects, apart from
>> strangely named directories under debian/tmp.
> [...]
>> Let me know what you think.
>
> How to you handle --list-missing from dh_install? I use it in my
> package to be sure to detect when a new file is added by upstream.

It shouldn't affect list-missing. The => adds new files to
debian/tmp/dh-exec.BLAH/, which will be handled by dh_install anyway. So
they don't show up as false positive.

If upstream installs new files, that's entirely handled by dh_install,
and the => functionality has no effect on it at all.

(To the best of my knowledge, dh_install --list-missing will list files
under debian/tmp that weren't copied anywhere. The new stuff put there
by dh-exec-install won't show up as false positives, and it doesn't hide
mask out anything, so --list-missing should be unaffected.)

--
|8]


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87wr9xc8go.fsf@luthien.mhp">http://lists.debian.org/87wr9xc8go.fsf@luthien.mhp
 
Old 12-16-2011, 08:04 AM
Gergely Nagy
 
Default RFC/RFR: dh-exec -- Scripts to help with executable debhelper files

Gergely Nagy <algernon@madhouse-project.org> writes:

> Vincent Danjean <vdanjean.ml@free.fr> writes:
>
>> Le 15/12/2011 18:33, Gergely Nagy a écrit :
>>> ,----
>>> | dh-exec.DEADBEEF/etc/my-package/my-package.conf /etc/my-package
>>> | examples/* /usr/share/doc/my-package/examples
>>> `----
>>>
>>> As far as I see, this should cause no ill side-effects, apart from
>>> strangely named directories under debian/tmp.
>> [...]
>>> Let me know what you think.
>>
>> How to you handle --list-missing from dh_install? I use it in my
>> package to be sure to detect when a new file is added by upstream.
>
> It shouldn't affect list-missing. The => adds new files to
> debian/tmp/dh-exec.BLAH/, which will be handled by dh_install anyway. So
> they don't show up as false positive.

Actually, there is one case where the => magic will result in unexpected
behaviour with --list-missing: if the source is already under
debian/tmp, then we copy it, rewrite the location, and thus, the old
file will not be known to dh_install.

A solution for this case is to move the file instead, if it's already
under debian/tmp.

And thinking a bit more about it, => will almost always break
--sourcedir. I do not know a solution for that, so this restriction will
be documented instead.

--
|8]


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 878vmc7urh.fsf@algernon.balabit">http://lists.debian.org/878vmc7urh.fsf@algernon.balabit
 
Old 12-16-2011, 09:58 AM
Goswin von Brederlow
 
Default RFC/RFR: dh-exec -- Scripts to help with executable debhelper files

Gergely Nagy <algernon@madhouse-project.org> writes:

> Josselin Mouette <joss@debian.org> writes:
>> Well, thanks for making my point. Implementing these (useful) features
>> in debhelper would be less pain to write and less eyesore for looking at
>> the implementation.
>
> Perhaps. But the executable thing is what is in debhelper, not the
> variable expansion, nor the renaming at dh_install time. I'm offering a
> solution to make these cases simpler and standard.
>
> It's certainly a possiblity to persuade me that this is a stupid idea,
> and then we'll end up with no simple, standardish solution, and everyone
> will roll their own, like we used to do with patch systems in the days
> of yore.

It is not a stupid idea, just a stupid solution.

> And for the record, I'm seeking input on the dh-exec implementation
> here. Keep the anti-executable-debhelper-foo thing in the other thread,
> please.

But that is the actualy problem. The executable-debhelper-foo thing is
in many peoples optinion bad.

Your implementation and the difficulties to handle the various debhelper
options like --sourcedir correctly show that it might not have been a
good solution afterall. Or at least not yet quite thought out and
finished.

A general dh-exec that does tons of things could be nice. But if it can
only do variable susbtituion without breaking other debhelper options
then why not do the variable substitution in dh_install directly? All
the promised flexibility is of no use if it can't be used safely.

This doesn't mean it isn't possible to do more. Just so far no one has
succeeded to do e.g. rename on install without breaking stuff. And that
in itself is a big point against the feature.

MfG
Goswin


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87zkes4wcc.fsf@frosties.localnet">http://lists.debian.org/87zkes4wcc.fsf@frosties.localnet
 

Thread Tools




All times are GMT. The time now is 02:42 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org