Howdy all,

Yesterday I found a tool which is exactly the kind 
of thing I've been looking for (have desperately needed)
for coordinating software development in/with our group. 

Yes, I found codestriker.

My motivations are pretty much the same as David's
original ones... sick of pointless meetings, sick 
of redundant and contradictory feedback on proposed
patches, and having a tree full of changes that are
going to get lost because the damn code review process
is such as hassle (most here have resorted to only
doing face to face meeting which drives me absolutely
bonkers in this day and age and therefore none of
my code gets approved).

I'm really looking forward to watching this develop
and will be glad to pitch in (provided my sales
pitch to my group on "why we should use this" works
out).

Anyway... thought I'd share a) something I've learned,
and, b) something I'd suggest given my brief time
with 1.9.2-alpha-3

What I learned is that line 62 of lib/Codestriker/Repository/Cvs.pm
doesn't seem to export CVS_RSH properly so that it is
used by the open/cvs in line 63.

If you want to see what I mean:

a) change line 63 to use '-t' instead of '-q' to make cvs verbose

and try to retieve a diff's full text ("Parallel" view).

Look in apache's error_log and you'll see that instead of 
trying to using ssh, it is instead hung on:

Starting server: rsh -l myaccount myhost.mydomain cvs server

To understand why, it is using rsh...

b) change line 47 of the top codeswitch.conf from '/usr/bin/cvs'
   to '/tmp/cvs'
c) create /tmp/cvs with 755 with the following 2 lines

   #!/bin/bash
    echo CVS_RSH is $CVS_RSH

d) restart apache (just for grins)

Now when you go to retrieve the full text of a diff from CVS via
ext: and SSH, instead of hanging, it should show something like
the following for line 1:

  CVS_RSH is

So, using ENV there in Cvs.pm isn't getting to 
the child's environment.

My first solution was to just set CVS_RSH before starting apache
(e.g. adding the "export" to /etc/sysconfig/httpd on Redhat systems),
but that seemed to be overkill.

What looked to be a more proper solution was to add 
the following to httpd.conf:

SetEnv CVS_RSH /usr/bin/ssh

But, that doesn't seem to be working. (???)

That way apache's startup environment isn't polluted, 
just its children's are (if it worked).

So, for now, my workaround is to put:

  export CVS_RSH /usr/bin/ssh

in /etc/sysconfig/httpd unless someone can
suggest a better solution as to why either
the original code didn't work.

I've attached the current nastiness that is
my present Cvs.pm's retrieve() function if anyone
wants to explore it more.  Basically I've come to
the conclusion that the environment perl uses for
"open()" does not get the complete environment of
the perl script it is in UNLESS (for some reason)
it was from the environment of the server when
it started.  So, using "SetEnv CVS_RSH /usr/bin/ssh"
in httpd.conf and using "$ENV{'CVS_RSH'}='/usr/bin/ssh';'
in the scripts will affect the running environment
but not the one the open runs in.

Sorry if that's too long and confusing... I'm just 
trying to clarify my confusion/problems/solutions.  
I don't know perl for squat... (though it looks
kinda like sh and C).

If I shouldn't HAVE to set this before starting apache
someone please help me out.  


As for my suggestion... I think the "state of states" 
needs to be redone. ;)

When I see notes like:

<quote>
# List of valid topic states.  Note these values are mapped to the
database
# depending on their position in the list.  ie, Open -> 0, Closed -> 1,
etc.
# There is no problem added new states dynamically, or changing the
textual
# names.  
</quote>

I get scared.

I'd suggest another database table called "states" (or something)
with the following attributes/fields:

  state_id - short int
  state_name - short string (char 10 or so)
  state_desc - long string
  state_readonly - bool

and then loading them up.  I think that will be
much more robust in the long term since it means 
we don't have to keep the code aligned with the DB
schema and it also kinda nails down the definition
of the states.  

Of course, we'll need a little "state edit" screen
like what is available for projects.

Anyway... just a thought.  

I'm also worried about user authentication but for now
I think I'm going to try to get away with just using SSL and
.htaccess.

Finally... my last word of advice for any one new who finds
this note in the future... 

If you are on Linux and your kernel supports/has 'selinux'...
turn it off while trying to get it working!!!  You can turn 
it back on later after you've got your repo access working 
and mail going to all the right places... before then, 
it will cause you no end of grief.

Anyway, great tool... looking forward to seeing it develop.

jack
[EMAIL PROTECTED]
http://parasol.tamu.edu/people/jkp2866/

p.s. more debug would good... e.g the option to use '-t' instead 
     of '-q' for cvs (without changing code), etc.

# Retrieve the data corresponding to $filename and $revision.  Store
each line
# into $content_array_ref.
sub retrieve {
    my ($self, $filename, $revision, $content_array_ref) = @_;
                                                                                
                                                                             
    # Open a pipe to the CVS repository.
    print STDERR "from httpd.conf ".$ENV{'CVS_RSH'}."\n";
    $ENV{'CVS_RSH'} = $Codestriker::ssh if defined $Codestriker::ssh;
    print STDERR "from codestriker.conf ".$ENV{'CVS_RSH'}."\n";
    open(FOO, '/bin/echo PATH is $PATH - CVS_RSH is $CVS_RSH |')
      || die "Can't open FOO: $!";
    while( <FOO> ) { print STDERR $_."\n"; }
    close FOO;
    open(FOO, '/bin/env |')
      || die "Can't open FOO: $!";
    while( <FOO> ) { print STDERR $_; }
    close FOO;
    #open(CVS, "\"$Codestriker::cvs\" -q -d \"" . $self->{url} .
    open(CVS, "\"$Codestriker::cvs\" -t -d \"" . $self->{url} .
         "\" co -p -r $revision \"$filename\" |")
        || die "Can't open connection to pserver CVS repository: $!";
                                                                                
                                                                             
    # Read the data.
    for (my $i = 1; <CVS>; $i++) {
        chop;
        $$content_array_ref[$i] = $_;
    }
    close CVS;
}





-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Codestriker-user mailing list
Codestriker-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/codestriker-user

Reply via email to