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

Re: Writing get-orig-source targets to conform with policy



On Sun, Feb 17, 2008 at 02:39:03PM +0900, Emmet Hikory wrote:
> Andres Mejia wrote:
> > Is it at all possible to write a get-orig-source target that calls
> > an external script to handle generating the orig tarball?
> 
>     Aside from the issue you've outlined, there are no means by which
> the executability of such an external script is enforced, which can be
> frustrating when attempting to use such a rule, and receiving a
> warning "debian/external-script: Permission denied".

This shouldn't be a problem.  You can expect people to have the complete
package source installed.  So if this script is in the package (and you
made it executable), it should just work.

To find the path, $(dir $_)/script can be used, to make sure it works
from any directory.  (Attribution: I learned that from reading your
uscan invocation below. ;-) )

> > Second question is regarding a get-orig-source target I have for the
> > package mediatomb. It goes like:
> >
> > # Common variables used to ease maintenance of the get-orig-source target.
> > MEDIATOMB_TARBALL = mediatomb-0.10.0.tar.gz
> > MEDIATOMB_VERSION = 0.10.0
> 
> Consider something like:
> MEDIATOMB_VERSION = $(shell shell head -1 debian/changelog | \
>         sed 's/.*(\(.*\)\.ds.*/\1/')
> MEDIATOMB_TARBALL = mediatomb-$(MEDIATOMB_VERSION).tar.gz

Except for the $(shell shell ..., which has a double shell and doesn't
close its parentheses, this looks good. ;-)

> More generally, consider the following get-orig-source:
> 
> MEDIATOMB_VERSION = $(shell uscan --dehs --force-download --destdir . \
>                 --package mediatomb --upstream-version 0 \
>                 --watchfile $(dir $(_))/watch --no-symlink | \
>                 grep upstream-version | sed 's/<.*>\(.*\)<.*>/\1/g')
> CURRENT_VERSION ?= $(MEDIATOMB_VERSION)
> get-orig-source:
>         tar -xzf mediatomb-$(CURRENT_VERSION).tar.gz
>         rm mediatomb-$(CURRENT_VERSION)/tombupnp/upnp/src/inc/upnp_md5.h
>         rm mediatomb-$(CURRENT_VERSION)/tombupnp/upnp/src/uuid/upnp_md5.c
>         tar czf mediatomb-$(CURRENT_VERSION)-dfsg.orig.tar.gz \
>                 mediatomb-$(CURRENT_VERSION)
>         rm -r mediatomb-$(CURRENT_VERSION) mediatomb-$(CURRENT_VERSION).tar.gz
> 
>     The above requires trimming the watch file to only report one
> upstream source, and may be run without root (or fakeroot).  The use
> of CURRENT_VERSION vs. MEDIATOMB_VERSION is to cause MEDIATOMB_VERSION
> definition to only be executed once, at runtime.  $(CURRENT VERSION)
> is defined when the get-orig-source rule is called, and it calls
> uscan.  After this, as it is already set, the previous value is used
> (the reason for ?=), and the call to uscan is not repeated.  It works
> for me from any directory, although it would benefit from others
> review.

The code you wrote here works for executing get-orig-source.  However,
it also runs uscan when trying to build any other target.  To avoid such
problems, I think it makes sense to use an external script.  It can do
exactly what you wrote though. :-)

Thanks,
Bas

-- 
I encourage people to send encrypted e-mail (see http://www.gnupg.org).
If you have problems reading my e-mail, use a better reader.
Please send the central message of e-mails as plain text
   in the message body, not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
For more information, see http://pcbcn10.phys.rug.nl/e-mail.html

Attachment: signature.asc
Description: Digital signature


Reply to: