@@ -458,6 +458,7 @@ fn cmd_illumos_onu(ca: &CommandArg) -> Result<()> {
458458    opts. optopt ( "t" ,  "" ,  "boot environment name" ,  "NAME" ) ; 
459459    opts. optflag ( "P" ,  "" ,  "prepare packages only" ) ; 
460460    opts. optflag ( "D" ,  "" ,  "prepare packages and run a depot" ) ; 
461+     opts. optflag ( "A" ,  "" ,  "create a p5p archive from packages" ) ; 
461462    opts. optflag ( "d" ,  "" ,  "use DEBUG packages" ) ; 
462463    opts. optopt ( "g" ,  "" ,  "use an external gate directory" ,  "DIR" ) ; 
463464
@@ -487,13 +488,13 @@ fn cmd_illumos_onu(ca: &CommandArg) -> Result<()> {
487488        top_path ( & [ "projects" ,  "illumos" ] ) ?
488489    } ; 
489490
490-     let  count = [ "t" ,  "P" ,  "D" ] . iter ( ) . filter ( |o| res. opt_present ( o) ) . count ( ) ; 
491+     let  count = [ "t" ,  "P" ,  "D" ,   "A" ] . iter ( ) . filter ( |o| res. opt_present ( o) ) . count ( ) ; 
491492    if  count == 0  { 
492493        usage ( ) ; 
493-         bail ! ( "must specify one of -t, -P, or -D " ) ; 
494+         bail ! ( "must specify one of -t, -P, -D  or -A " ) ; 
494495    }  else  if  count > 1  { 
495496        usage ( ) ; 
496-         bail ! ( "-t, -P, and -D , are mutually exclusive" ) ; 
497+         bail ! ( "-t, -P, -D  and -A , are mutually exclusive" ) ; 
497498    } 
498499
499500    /* 
@@ -516,6 +517,22 @@ fn cmd_illumos_onu(ca: &CommandArg) -> Result<()> {
516517    let  which = if  res. opt_present ( "d" )  {  "nightly"  }  else  {  "nightly-nd"  } ; 
517518    let  repo_nd = rel_path ( Some ( & gate) , 
518519        & [ "packages" ,  "i386" ,  which,  "repo.redist" ] ) ?; 
520+ 
521+     if  res. opt_present ( "A" )  { 
522+         info ! ( log,  "creating p5p archive file from packages at: {:?}" ,  & repo) ; 
523+         let  archive = top_path ( & [ "tmp" ,  "onu" ,  "repo.p5p" ] ) ?; 
524+         ensure:: run ( log,  & [ PKGRECV , 
525+             "-a" , 
526+             "-s" ,  & repo_nd. to_str ( ) . unwrap ( ) , 
527+             "-d" ,  & archive. to_str ( ) . unwrap ( ) , 
528+             "--mog-file" ,  & mog_conflicts. to_str ( ) . unwrap ( ) , 
529+             "--mog-file" ,  & mog_deps. to_str ( ) . unwrap ( ) , 
530+             "-m" ,  "latest" , 
531+             "*" ] ) ?; 
532+         info ! ( log,  "p5p archive created at: {:?}" ,  & archive) ; 
533+         return  Ok ( ( ) ) ; 
534+     } 
535+ 
519536    ensure:: run ( log,  & [ PKGRECV , 
520537        "-s" ,  & repo_nd. to_str ( ) . unwrap ( ) , 
521538        "-d" ,  & repo. to_str ( ) . unwrap ( ) , 
0 commit comments