[Novalug] remotely diff from make

Jon LaBadie novalugml@jgcomp.com
Wed Jan 8 22:40:11 EST 2014


On Wed, Jan 08, 2014 at 04:50:17PM -0500, shawn wilson wrote:
> On Wed, Jan 8, 2014 at 4:13 PM, Jon LaBadie <jon@jgcomp.com> wrote:
> > On Wed, Jan 08, 2014 at 10:38:35AM -0500, shawn wilson wrote:
> >> I've got quite a few moving parts here and I can't get it working
> >> right. dist: rsyncs files into a remote home directory. What I want to
> >> do is diff those files and the current (running) files. They're text,
> >> so I don't need to worry about looking up magic on them or anything -
> >> just a for loop and a diff. Here's what I have:
> >>
> > If I understand correctly, you have a working and a mirror'ed
> > directory on two different hosts.  If that is the case, I don't
> > see where in your diff command is referencing two different hosts.
> >
> 
> So dist rsyncs built files into my home directory on a remote host
> (that probably has a running copy - I should technically 'test -e' but
> if stuff isn't already there, I really want to see a bunch of noise
> anyway). So what I'm doing is diffing the new copy wit the running
> copy (I probably don't have the running copy locally).
> 
> > Plus, I suspect you have left off defining the "dir" variable and
> > the "$" to reference its value.
> >
> 
> Nah, dir is an actual path and not a variable.
> 
> >> distdiff:    dist
> >>     ssh ${TARGET_HOST} -t -t <<'EOF'
> >>         PS1=''
> >>         for i in $(ls foo.*); do
> >>             echo -e "\n$i"
> >>             diff -u dir/$i $i
> >>         done
> >>         exit
> >>     EOF
> >>

OK, I better understand the situation.  I setup a trivial similar
setup.  On a remote host I made two dirs, p1 and p2.  In each I
put two identical files and deleted one line for one file.

I then entered a shell script nearly mimicing your makefile code.

  ssh jon@mums -t -t <<'EOF'
    PS1=''
    for i in $(cd p1 > /dev/null 2>&1 ; ls *) ; do
      echo -e "\n$i"
      diff -u p1/$i p2/$i
    done
    exit
  EOF

This worked fine as far as I can tell.

You did not describe what problems you were encountering.
However you are running your code from a makefile.  A lot
of what can be put into makefiles resembles shell code.
But make is not shell.  I suggest you move the shell code
out of make and into a script.  Then call the script from
the makefile.

Jon
-- 
Jon H. LaBadie                  novalugml@jgcomp.com
 11226 South Shore Rd		(703) 787-0688 (H)
 Reston, VA  20190		(609) 477-8330 (C)



More information about the Novalug mailing list