private void addArguments(List<Argument> to, boolean escape, String... args) { for (String str : args) { Argument arg = new Argument(); if (escape) { arg.setValue(str); } else { arg.setLine(str); } to.add(arg); } }
private void addArguments( List<Argument> to, boolean escape, String... args ) { for ( String str : args ) { Argument arg = new Argument(); if ( escape ) { arg.setValue( str ); } else { arg.setLine( str ); } to.add( arg ); } }
cmdLine.createArgument().setLine( "-q" ); cmdLine.createArgument().setLine( rpmPackage ); cmdLine.createArgument().setLine( "--dbpath" ); cmdLine.createArgument().setLine( rpmDbPath ); cmdLine.createArgument().setLine( "--queryformat" ); cmdLine.createArgument().setLine( "%{RELEASE}" ); StringStreamConsumer stdoutConsumer = new StringStreamConsumer(); exitValue = cliManager.execute( cmdLine, stdoutConsumer, consumer );
cmdLine.createArgument().setLine( "rpm" ); cmdLine.createArgument().setLine( "-Uh" ); cmdLine.createArgument().setLine( "--force" ); cmdLine.createArgument().setLine( "--nodeps" ); cmdLine.createArgument().setLine( Commandline.quoteArgument( rpmFile.getAbsolutePath() ) ); cmdLine.createArgument().setLine( "--dbpath" ); cmdLine.createArgument().setLine( rpmDbPath );
public String eval( String expression ) throws RpmEvalException { String result = null; Commandline cmdLine = new Commandline(); cmdLine.setExecutable( "rpm" ); cmdLine.createArgument().setLine( "--eval \"%{" + expression + "}\"" ); try { CommandLineUtils.StringStreamConsumer consumer = new CommandLineUtils.StringStreamConsumer(); int exitValue = cliManager.execute( cmdLine, consumer, cliManager.newDebugStreamConsumer() ); if ( exitValue != 0 ) { throw new RpmEvalException( "RPM evaluation exited abnormally for expression: " + expression + "(returned: " + exitValue + ")." ); } result = consumer.getOutput().trim(); } catch ( CommandLineException e ) { throw new RpmEvalException( "Error evaluating RPM expression: " + expression, e ); } return result; }
public void executeGoals( File workingDirectory, String executable, String goals, boolean interactive, String arguments, ReleaseResult relResult, Map<String, String> environments ) throws Exception { Commandline cl = new Commandline(); Commandline.Argument argument = cl.createArgument(); argument.setLine( arguments ); executeGoals( workingDirectory, executable, goals, interactive, argument.getParts(), relResult, environments ); }
public ExecutionResult executeShellCommand( File workingDirectory, String executable, String arguments, File output, long idCommand, Map<String, String> environments ) throws Exception { Commandline cl = new Commandline(); Commandline.Argument argument = cl.createArgument(); argument.setLine( arguments ); return executeShellCommand( workingDirectory, executable, argument.getParts(), output, idCommand, environments ); }
public ExecutionResult executeShellCommand( File workingDirectory, String executable, String arguments, File output, long idCommand, Map<String, String> environments ) throws Exception { Commandline cl = new Commandline(); Commandline.Argument argument = cl.createArgument(); argument.setLine( arguments ); return executeShellCommand( workingDirectory, executable, argument.getParts(), output, idCommand, environments ); }