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

Bug#873001: [debian-policy] get-orig-source documentation should include a pointer to devref and a minimal example



On Wed, Aug 23, 2017 at 6:29 PM, Russ Allbery <rra@debian.org> wrote:
> Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com> writes:
>
>> get-orig-source should include an example.
>
>> If you use uscan this is safe and policy compliant (maybe opening a bug
>> against dpkg-dev to get this rule by default)
>
>> cd "$(subst ",\",$(dir $(lastword $(MAKEFILE_LIST))))/.." && uscan --destdir $(subst ",\",$(CURDIR)) #"
>
>> We have a bug report for lintian asking for checking unsafe uscan, so I
>> was creating a compliant version
>
>> A footnote is suffisant
>
> I'm reasonably fluent in shell and make, and I still have absolutely no
> idea what that does.

you call the rules with something (using shebang or directly) make -f
somepath/package/debian/rules, uscan need to be excuted on
somepath/package/.

So you need to get the f parameter. Make get it in last entry of
$MAKEFILE_LIST, so, $(lastword $(MAKEFILE_LIST)) that return
somepath/package/debian/rules,

now we get the dir using $(dir ) and get one level up by ..
$(dir $(lastword $(MAKEFILE_LIST)))/..

Unfortunatly we need to escape, some char so use ' to quote and escape
it using $(subst  ',\', $(dir $(lastword $(MAKEFILE_LIST)))/..)

now i can cd:
$(subst  ',\', $(dir $(lastword $(MAKEFILE_LIST)))/..)

and do a uscan with DESTDIR (here the local dir) escaped:

Finnally:
cd $(subst  ',\', $(dir $(lastword $(MAKEFILE_LIST)))/..) && uscan
--destdir $(subst ",\",$(CURDIR)) #'

the #' at end if for emacs syntax highlight

Bastien


>
> Is there any way that we could help people out and have the correct thing
> to do be much, much simpler?  Just a single command invocation?
>
> --
> Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>

* do not expect something with name that include space


Reply to: