Harvest

  • 1.  Too many items on Checkin

    Posted 05-13-2013 05:18 AM
    Hello.

    When executing a Checkin process, with a pre-linked UDP, if the Checkin process encounters an error (like wrong repository), it returns the error "Could not find UDP program", but only when I choose a lot of items.
    It happens both on Eclipse and Workbench and the number of items needed to get the error depends on the machine (it can go from 100 in a virtual machine running on my laptop to 2000 on a more powerful machine).
    I have a complex Pre-linked UDP set up but, for testing purposes, I reduced it to something like
    @echo off
    rem echo %*
    echo %1 executed
    exit 1
    and it still happens.

    Did anyone has ever encountered something like this?

    Some years ago, I had a problem with the Linux buffer also when dealing with a lot of items in my shell scripts and I solved it reading fewer items at each time, but that was completely out of the CA SCM scope.

    EDIT:
    The support team suggested to export the versions list to a file, using a Perl script, but the same thing happens when executing the script, if there is error accessing the file.

    Best regards,
    Ricardo Bernardino


  • 2.  RE: Too many items on Checkin
    Best Answer

    Posted 05-13-2013 10:55 AM
    Try using standard in. You can setup a quick test.

    in the program field of the UDP put:
    perl
    in the input field put:
    $v='["version"]';
    chomp($v);
    @vers=split(/" "/,$v);
    $vers[0]=~ s/\"//;
    $vers[$#vers]=~ s/\"//;
    print "---  $_ ---\n" foreach @vers;


  • 3.  RE: Too many items on Checkin

    Posted 05-13-2013 12:13 PM
    Thank you very much.

    This is almost what I was doing on the Perl script, but it wouldn't work outside CA SCM.
    So, I added your code block to my script and put both on the Input field and it became something like this
    chdir("C:/Noesis/NSCM");
    $pkg = ["package"];
    $user = "[user]";
    $filename = "Versions_" . $user . "_" . $pkg . ".log";

    if (open(FILEHANDLE, ">$filename")) {
    print "File '$filename' opened\n";
    }
    else {
    print "Could not open file '$filename'";
    exit(1);
    }

    $v='["version"]';
    chomp($v);
    @vers=split(/" "/,$v);
    $vers[0]=~ s/\"//;
    $vers[$#vers]=~ s/\"//;
    print FILEHANDLE "$_\n" foreach @vers;

    close (FILEHANDLE);

    EDIT: I think I now understand the problem.
    In this particular case, it is not possible to have parameter on the Program field.
    So, I moved user and package parameters to the Input field and will update my original UDP to support it.
    I will report my findings.

    Best regards,
    Ricardo Bernardino


  • 4.  RE: Too many items on Checkin

    Posted 05-13-2013 01:15 PM
    I should add that I find using a XML structure super helpful with perl scripts.

    In the input field you'd put...
    <main>
    <broker>[broker]</broker>
    <project>[project]</project>
    <state>[state]</state>
    <nextstate>[nextstate]</nextstate>
    <user>[user]</user>
    <package>["package"]</package>
    <version>["version"]</version>
    </main>
    and then point the program field to this perl....
    use strict;
    use XML::Simple;
    use Data::Dumper;
    
    my $stdinxml;
    
    &readxmlin;
    
    print "broker  $stdinxml->{broker}\n";
    print "version $stdinxml->{version}\n";
    print "whole xml hash\n" . Dumper( $stdinxml ) . "\n";
    
    exit 0;
    
    sub readxmlin
    {
      my $xmlin='';
      open (XML, "-");
      my @xmlin = <XML>;
      close(XML);
    
      splice(@xmlin,0,2) if ($xmlin[0] =~ /^Subject/);      # added by notify process
      splice(@xmlin,0,2) if ($xmlin[0] =~ /^Message from/); # added by notify process
    
      foreach my $line (@xmlin)
      {
        chomp($line);
        $xmlin .= "$line\n"; # create xml string from the array
      }
    
      my $p1 = new XML::Simple();
      my $config = eval { $stdinxml=$p1->XMLin($xmlin ,SuppressEmpty => 1 ) };
      if ($@) {
        print STDERR "$@\n";
        my $i=0;
        foreach my $line (@xmlin){
         chomp($line);
         print ++$i . " $line\n";   # print XML with line numbers.
        }
        die ("Error: Cannot continue due to errors within the XML.");
      }
    }


  • 5.  RE: Too many items on Checkin

    Posted 05-13-2013 01:36 PM
    Again, a very helpful tip. Simple, but efficient.

    I will incorporate it on my UDP and then I will confirm if all this resolve my problem (and all indicate it does).

    Best regards,
    Ricardo Bernardino