Re: not rebuilding out-of-date derived^2 objects

[email protected] Mon, 19 Apr 2004 17:45:42 -0500
Newsgroups gmane.comp.gnu.cons.general
Message-ID <OF0C032B1B.056B017C-ON86256E7B.0078470A-88256E7B.007CA578@diamond.philips.com>
--=_mixed 007CA57288256E7B_=
Content-Type: multipart/alternative;
	boundary="=_alternative 007CA57288256E7B_="


--=_alternative 007CA57288256E7B_=
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Alan,

You are fighting it.  First, from a high level, you will be ahead of the=20
game if you treat each Conscript as if it were a "Project" file.  Best to=20
use one project, ie lib or executable, per Conscript.  Not the law, but=20
just easier to maintain.  Further, it does not make sense to have source=20
in a different Conscript from the "Project file", so is your lib is built=20
in the same conscript as the source that goes into it you will be way=20
ahead.

We have been using Cons very successfully.  Our current Cons build, builds =

some 8000 source files with over 500 projects.   And it does so very=20
quickly and reliably.   We use ONE Construct file, of which I use to read=20
one Construct.XML file that together manages all system wide tools and=20
their options.  All options in the individual Conscripts are treated as=20
overrides and should be justified.

In a previous email, I recommended the use of Conscript=5Fchdir, and I stil=
l=20
advocate that your life will be easier if you add it to your Construct, to =

that end, my further examples will assume you have done so.

Add prior to creating an instance of cons:
Conscript=5Fchdir 1;

Now for the hard part, you delete you lib\Conscript file and change your=20
src\Conscript to read as:

#!/usr/bin/perl -w

Import qw(env);

my @infiles =3D qw(
        foo.cpp
        );

$env->Library('#lib/libfoo', @infiles);

You should now note that changing your foo.h file rebuilds all necessary=20
components.

Now, as for what was wrong with your setup.   Technically, nothing, it is=20
a bug in Cons I reported long ago that prevents the signatures from=20
properly propagating when using the Command function.   Add the following=20
to the bottom of your Construct file and it should fix it.

package file;

sub sigtype {
    my $self =3D shift;
=20
    #
    # If there is already a sigtype, this function is going to do nothing=20
other
    # than exit with the sigtype already assigned.  This is the same as=20
the
    # original method.
    #
    unless ($self->{sigtype})
    {
        #
        # New functionality.
        # If there is already a signature, set the $sigtype to the type of
        # signature found.
        #
        foreach (qw(bsig csig))
        {
            if ($self->{$=5F})
            {
                $self->{sigtype} =3D $=5F;
                last;
            }
        }
    }
=20
    unless ($self->{sigtype})
    {
        #
        # Set the $sigtype to a build signature, if that type is found in=20
the
        # sigarray.  DON'T ask me why!!!
        #
        $self->{sigtype} =3D 'bsig' if grep {$=5F eq "build"} $self->sigarr=
ay;
    }
=20
    #
    # New functionality.
    # Default to a content signature.
    #=20
    $self->{sigtype} ||=3D 'csig';
}













"Alan Grow" <[email protected]>
Sent by:=20
[email protected]
04/17/2004 05:43 PM

=20
        To:     [email protected]
        cc:     (bcc: Rick Croote/ATL-BTL/MS/PHILIPS)
        Subject:        not rebuilding out-of-date derived^2 objects
        Classification:=20




Hi,

  Cons 2.3.0 isn't rebuilding "derived derived objects" correctly for me.=20
I've attached a tarball you can use to reproduce the behavior, but here's=20
what's going on...

  I am building libfoo.a from foo.o, which is built from foo.h and foo.cpp =


in turn. The first time I cons, everything is rebuilt. Then if I add a new =


function (say) to foo.h and cons again. This time foo.o is rebuilt but=20
libfoo.a is not, even though foo.o's contents have changed.

  I have left SourceSignature and SIGNATURE alone so they should be=20
defaulting to 'build', but it doesn't seem to matter. Also I am using two=20
Conscript files, one for the object file and one for the lib, because this =


mimics the situation I first encountered the problem in. Anyway untar and=20
have a look for yourself.

  Am I using cons in a way that wasn't intended? Any ideas?

  -Alan

=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
Get rid of annoying pop-up ads with the new MSN Toolbar ? FREE!=20
http://toolbar.msn.com/go/onm00200414ave/direct/01/
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
[email protected]
http://mail.gnu.org/mailman/listinfo/cons-discuss
Cons URL: http://www.dsmit.com/cons/


--=_alternative 007CA57288256E7B_=
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


<br><font size=3D2 face=3D"sans-serif">Alan,</font>
<br>
<br><font size=3D2 face=3D"sans-serif">You are fighting it. &nbsp;First, fr=
om a high level, you will be ahead of the game if you treat each Conscript =
as if it were a &quot;Project&quot; file. &nbsp;Best to use one project, ie=
 lib or executable, per Conscript. &nbsp;Not the law, but just easier to ma=
intain. &nbsp;Further, it does not make sense to have source in a different=
 Conscript from the &quot;Project file&quot;, so is your lib is built in th=
e same conscript as the source that goes into it you will be way ahead.</fo=
nt>
<br>
<br><font size=3D2 face=3D"sans-serif">We have been using Cons very success=
fully. &nbsp;Our current Cons build, builds some 8000 source files with ove=
r 500 projects. &nbsp; And it does so very quickly and reliably. &nbsp; We =
use ONE Construct file, of which I use to read one Construct.XML file that =
together manages all system wide tools and their options. &nbsp;All options=
 in the individual Conscripts are treated as overrides and should be justif=
ied.</font>
<br>
<br><font size=3D2 face=3D"sans-serif">In a previous email, I recommended t=
he use of Conscript=5Fchdir, and I still advocate that your life will be ea=
sier if you add it to your Construct, to that end, my further examples will=
 assume you have done so.</font>
<br>
<br><font size=3D2 face=3D"sans-serif">Add prior to creating an instance of=
 cons:</font>
<br><font size=3D2 face=3D"sans-serif">Conscript=5Fchdir 1;</font>
<br>
<br><font size=3D2 face=3D"sans-serif">Now for the hard part, you delete yo=
u lib\Conscript file and change your src\Conscript to read as:</font>
<br>
<br><font size=3D2 face=3D"sans-serif">#!/usr/bin/perl -w</font>
<br>
<br><font size=3D2 face=3D"sans-serif">Import qw(env);</font>
<br>
<br><font size=3D2 face=3D"sans-serif">my @infiles =3D qw(</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; foo.cpp<=
/font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; );</font>
<br>
<br><font size=3D2 face=3D"sans-serif">$env-&gt;Library('#lib/libfoo', @inf=
iles);</font>
<br>
<br><font size=3D2 face=3D"sans-serif">You should now note that changing yo=
ur foo.h file rebuilds all necessary components.</font>
<br>
<br><font size=3D2 face=3D"sans-serif">Now, as for what was wrong with your=
 setup. &nbsp; Technically, nothing, it is a bug in Cons I reported long ag=
o that prevents the signatures from properly propagating when using the Com=
mand function. &nbsp; Add the following to the bottom of your Construct fil=
e and it should fix it.</font>
<br>
<br><font size=3D2 face=3D"sans-serif">package file;</font>
<br>
<br><font size=3D2 face=3D"sans-serif">sub sigtype {</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; my $self =3D shift;</f=
ont>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; </font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; #</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; # If there is already =
a sigtype, this function is going to do nothing other</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; # than exit with the s=
igtype already assigned. &nbsp;This is the same as the</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; # original method.</fo=
nt>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; #</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; unless ($self-&gt;{sig=
type})</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; {</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; #</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; # New fu=
nctionality.</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; # If the=
re is already a signature, set the $sigtype to the type of</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; # signat=
ure found.</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; #</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; foreach =
(qw(bsig csig))</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; {</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; if ($self-&gt;{$=5F})</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; {</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; $self-&gt;{sigtype} =3D $=5F;</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; last;</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; }</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; }</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; </font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; unless ($self-&gt;{sig=
type})</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; {</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; #</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; # Set th=
e $sigtype to a build signature, if that type is found in the</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; # sigarr=
ay. &nbsp;DON'T ask me why!!!</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; #</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; $self-&g=
t;{sigtype} =3D 'bsig' if grep {$=5F eq &quot;build&quot;} $self-&gt;sigarr=
ay;</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; }</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; </font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; #</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; # New functionality.</=
font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; # Default to a content=
 signature.</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; # &nbsp; &nbsp;</font>
<br><font size=3D2 face=3D"sans-serif">&nbsp; &nbsp; $self-&gt;{sigtype} ||=
=3D 'csig';</font>
<br><font size=3D2 face=3D"sans-serif">}</font>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<table width=3D100%>
<tr valign=3Dtop>
<td>
<td>
<br>
<br>
<br>
<br>
<br><font size=3D1 face=3D"sans-serif"><b>&quot;Alan Grow&quot; &lt;alan=5F=
[email protected]&gt;</b></font>
<p><font size=3D1 face=3D"sans-serif">Sent by: </font>
<br><font size=3D1 face=3D"sans-serif">cons-discuss-bounces+rick.croote=3Dp=
[email protected]</font>
<p><font size=3D1 face=3D"sans-serif">04/17/2004 05:43 PM</font>
<br>
<td><font size=3D1 face=3D"Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=3D1 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; To: &nbs=
p; &nbsp; &nbsp; &nbsp;[email protected]</font>
<br><font size=3D1 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; cc: &nbs=
p; &nbsp; &nbsp; &nbsp;(bcc: Rick Croote/ATL-BTL/MS/PHILIPS)</font>
<br><font size=3D1 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Subject:=
 &nbsp; &nbsp; &nbsp; &nbsp;not rebuilding out-of-date derived^2 objects</f=
ont>
<p><font size=3D1 face=3D"sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Classific=
ation: &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br>
<br></table>
<br>
<br>
<br><font size=3D2 face=3D"Courier New">Hi,<br>
<br>
 &nbsp;Cons 2.3.0 isn't rebuilding &quot;derived derived objects&quot; corr=
ectly for me. <br>
I've attached a tarball you can use to reproduce the behavior, but here's <=
br>
what's going on...<br>
<br>
 &nbsp;I am building libfoo.a from foo.o, which is built from foo.h and foo=
.cpp <br>
in turn. The first time I cons, everything is rebuilt. Then if I add a new =
<br>
function (say) to foo.h and cons again. This time foo.o is rebuilt but <br>
libfoo.a is not, even though foo.o's contents have changed.<br>
<br>
 &nbsp;I have left SourceSignature and SIGNATURE alone so they should be <b=
r>
defaulting to 'build', but it doesn't seem to matter. Also I am using two <=
br>
Conscript files, one for the object file and one for the lib, because this =
<br>
mimics the situation I first encountered the problem in. Anyway untar and <=
br>
have a look for yourself.<br>
<br>
 &nbsp;Am I using cons in a way that wasn't intended? Any ideas?<br>
<br>
 &nbsp;-Alan<br>
<br>
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F<br>
Get rid of annoying pop-up ads with the new MSN Toolbar &#8211; FREE! <br>
http://toolbar.msn.com/go/onm00200414ave/direct/01/<br>
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F<br>
[email protected]<br>
http://mail.gnu.org/mailman/listinfo/cons-discuss<br>
Cons URL: http://www.dsmit.com/cons/</font>
<br>
<br>
--=_alternative 007CA57288256E7B_=--
--=_mixed 007CA57288256E7B_=
Content-Type: application/octet-stream; name="derivedtest.tar.gz"
Content-Disposition: attachment; filename="derivedtest.tar.gz"
Content-Transfer-Encoding: base64

H4sIADbagUAAA+1XbW/aQAzma+9X3Eql0JWXBBKQglqVstIhoVZqt09VVYXLUTKFJOSlbEL89/lC
QkJK122CMK33fCCX2D47sf2Y06lrPFPdp55fK+wIoiiLLUWBqyi1FIldGeJruJaYUkNuKmK9IEr1
RrNVwMquAkoj8HzNxbigPbn27Bd6szGlZh4B5Qs9lf+ubXm+GxB/yz5ESG5Tll/NvyzVo/wriig3
QV+utxoFLG45jo145/kvfqgFnlsbGlbNoa6JKzOEjqj1jE+xRWeYQEmU7vpX150vX28v8ekZvsfC
R6GMBZD41PIF/HDcXppUzubd7gIMhdWWTycnQnsl7A06V3ehQqXvuSSRdG7XzTQ3kd12rgf9i3W5
q1mmMQQd9ImOtMD0sVBld5ffHdv18XRWAlsW1kVgmDq7B3dheRPXcHx0AMCwQ/IIlPedif0g3f/s
i+zCx5/wf0ti/d+QgC44/+eAbP5XHbFFH2/xf1OSM/wP/wIUzv95YBP/Bx7FPcOkqnrnUKKqvcAi
vgGFwZhU7QwGjFr7kwzXTn7gI6igERgysmbFxG5tu6oBNzOpPfwWSxkfM5EtRJaQg1OcjIOlwZLn
E0E0C5Ym54bFdvNAXEr2Pg4tz+3ATwnjsMIwNQfP8dEji6Io4Cos23ix2q39qkK8ZRQwmeigMZ3O
WehkmjiJQ1msxmLXnkw0Sy/dp+J6KK9clsPN9jSB0v3PkrILH3/D/02F838eyOZ/L/zfkF7wv8z5
Pxds4v+N1A7FkSVv4jgRs4+zovFvUD4hCbPDwWFpQEam9uSlBMtDw0vKjwMqR943EH/snb1CynRJ
8DG3r3F/2vyl2qsTAN4kDrxiJy9dIavP9s8Og2z/R3ndqo+3+h+GQ/b8L8st3v95oGhYxAx0ig/D
tj1ECMFCVeGnZFg+ftbMgB6jAxXrj+G6FD2Zo8U7PTL/V9jU/+Mt+3ir/yWlke1/SZJ4/+eBojGy
dDrCvZubx8+oCEvDotEdQsTUPA9DTUC7YycYmgZRETpYJwcYbdiBKtJ8yoRMEHFFG7G5h4rU0o0R
ZwsODg4ODg4ODg4ODg4Ojn3hJxzECdAAKAAA
--=_mixed 007CA57288256E7B_=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
[email protected]
http://mail.gnu.org/mailman/listinfo/cons-discuss
Cons URL: http://www.dsmit.com/cons/
--=_mixed 007CA57288256E7B_=--