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

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



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".

> 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

> CORRECT_CHECKSUM = 2436c73de4ac5f3ba1575f7ee93a0430

    Policy states "This target fetches the most recent version of the
original source package from a canonical archive site", which means
that you likely don't want to check the checksum (as it would be
inappropriate to have an error just because upstream updated).

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.

-- 
Emmet HIKORY


Reply to: