Edgewall Software
Modify

Opened 14 years ago

Last modified 12 years ago

#534 new enhancement

[Patch] Augment bitten-slave exit code for --no-loop.

Reported by: mpotter@… Owned by:
Priority: major Milestone: 0.6.1
Component: Build slave Version: 0.6b2
Keywords: Cc: mpotter@…
Operating System:

Description

The bitten-slave currently returns various exit codes for various failure cases. If would be nice if when used with the --no-loop option, bitten-slave could return info on if it built anything or not.

bitten-slave --no-loop --single will build 0 or 1 targets. bitten-slave --no-loop will build 0 or many targets. Since 0 is normally considered a success case for commands, and any other value an error:

  • If "bitten-slave --no-loop ..." builds no targets
    • return 1.
  • If "bitten-slave --no-loop ..." builds 1 or more targets,
    • return 0.
  • If "bitten-slave ..." fails,
    • return the appropriate error code as it currently does.

Use-case: I was thinking I could wrap bitten-slave in a script and use the --no-loop and --single options with various slave configurations to implement a simple priority system.

Pseudo-code:

do {
   do {

      # Build all high-priority targets
      bitten-slave --no-loop -f HighPriority.ini ...

      # Try to build one medium or high priority target
      bitten-slave --no-loop --single -f MedOrHighPriority.ini ...

   # loop back in case a new high priority has appeared
   } while ( errorlevel == 1 );

   # Build one target.  Wait if there are not any available.
   bitten-slave --single -f AnyPriority.ini ...

# If not an error, loop back
} while ( errorlevel == 0 );

Attachments (2)

exitCode.patch (1.3 KB) - added by Mark Potter <mpotter@…> 12 years ago.
Patch to implement no-loop exit code difference if built something or not.
PrioritizedSlave.bat (4.9 KB) - added by Mark Potter <mpotter@…> 12 years ago.
Sample Windows Batch file that uses this change to implement a simple build priority system.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 14 years ago by mpotter@…

  • Cc mpotter@… added

Changed 12 years ago by Mark Potter <mpotter@…>

Patch to implement no-loop exit code difference if built something or not.

comment:2 Changed 12 years ago by Mark Potter <mpotter@…>

  • Summary changed from Augment bitten-slave exit code for --no-loop. to [Patch] Augment bitten-slave exit code for --no-loop.

Added a patch that implements this feature. However, instead of using an exit-code of 1 to indicate that the slave built nothing, I used EX_NOTFOUND. However, EX_NOTFOUND does not appear to be defined on many platforms. Following the pattern for the other EX_ values, and searching for what EX_NOTFOUND is typically defined as when it is defined, I went when 79.

Changed 12 years ago by Mark Potter <mpotter@…>

Sample Windows Batch file that uses this change to implement a simple build priority system.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.