bug-gsrc
[Top][All Lists]
Advanced

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

Re: [bug-gsrc] /srv/bzr/gsrc/trunk r764: revert to make-3.81 due to back


From: Luke Shumaker
Subject: Re: [bug-gsrc] /srv/bzr/gsrc/trunk r764: revert to make-3.81 due to backwards incompatibility of 3.82
Date: Mon, 17 Oct 2011 19:36:56 -0400
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.3 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

At Mon, 17 Oct 2011 14:30:21 +0100,
Brian Gough wrote:
> At Sun, 16 Oct 2011 23:49:27 -0400,
> Luke Shumaker wrote:
> > The attatched patch should make GSRC work just fine with make 3.82.
> > 
> > Now, instead of using
> >  $ make http//example.com/foo.tar.gz
> > it's
> >  $ make download/http/example.com/foo.tar.gz
> > 
> > While it's a little more... verbose, I like it because it seems
> > slightly less "magic"; protocols are foreign to make, directories aren't.
> 
> Hi Luke. Can you explain how this works?  I thought the problem was
> that if a filename like 'patch-3.18.tar.gz' matched a target like
> 'patch-%' it triggered the wrong rule, which seemed impossible to work
> around.  I've tried "make -C gnu/patch" and I get an infinite loop
> using make-3.81.
> 
> address@hidden:/home/gnu/gsrc$ make -C gnu/patch
> make: Entering directory `/home/gnu/gsrc/gnu/patch'
>  ==> Grabbing download/patch-2.6.1.tar.gz
>      ==> Trying download/file/files/patch-2.6.1.tar.gz
> <snip>

Make 3.82 will select the rule with the shortest stem (the %); in
other words the rule that is most specific, or the longest. (Directory
snipping makes latter definition easier to explain).

"patch-%" matches 6 non-stem characters, but "http/%" only matches 5,
so make selects the former. To work around this, all we have to do is
make the latter longer; for example by prefixing it with "download/".
"download/http/%" will match 14 non-stem characters, so it will be
selected.

This method is great, because it makes the downloads look more like
ordinary files, which make deals with. Ideally, we'd integrate it a
little better with the garchive system used by GAR, but that patch is
a little less trivial.

Now, for the prefix to tack onto the urls, I just chose
$(DOWNLOADDIR), which creates a collision between the URLS and
"$(DOWNLOADDIR)/%", which selects from a number of URLS to fetch the
file.

This is fine in make 3.82; "$(DOWNLOADDIR)/http/%" is longer than
"$(DOWNLOADDIR)/%", so make did the right thing.
However, I forgot that make 3.81 would just select the first pattern,
"$(DOWNLOADDIR)/%", which throws it into an infinate loop (I'm
actually surprised that make doesn't detect the loop, but my approach
to learning make's safety mechanisms is that if you need them at all,
you're doing it wrong).

Anyway, here's a another patch (instead of, not on top of the old one)
that uses "cache/" instead of "download/".

~ Luke Shumaker

Attachment: make382-fix-take2.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]