You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by ke...@apache.org on 2007/06/03 08:24:25 UTC

svn commit: r543850 - /ant/sandbox/antlibs/debian/trunk/src/main/org/apache/ant/debian/StatusDpkg.java

Author: kevj
Date: Sat Jun  2 23:24:25 2007
New Revision: 543850

URL: http://svn.apache.org/viewvc?view=rev&rev=543850
Log:
-Status skeleton, need to capture output and produce XML as CVS/SVN tasks do

Added:
    ant/sandbox/antlibs/debian/trunk/src/main/org/apache/ant/debian/StatusDpkg.java

Added: ant/sandbox/antlibs/debian/trunk/src/main/org/apache/ant/debian/StatusDpkg.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/debian/trunk/src/main/org/apache/ant/debian/StatusDpkg.java?view=auto&rev=543850
==============================================================================
--- ant/sandbox/antlibs/debian/trunk/src/main/org/apache/ant/debian/StatusDpkg.java (added)
+++ ant/sandbox/antlibs/debian/trunk/src/main/org/apache/ant/debian/StatusDpkg.java Sat Jun  2 23:24:25 2007
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ant.debian;
+
+/**
+ * Query status of a package 
+ */
+public class StatusDpkg extends AbstractDpkgTask {
+
+    private String packageName;
+    
+    public void execute() throws BuildException {
+        validate();
+        Commandline c = new Commandline();
+        c.setExecutable("dpkg");
+        String[] args = new String[] { "--status", packageName };
+        c.addArguments(args);
+        super.addConfiguredCommandline(c);
+        super.execute();
+    }
+    
+    private void validate() throws BuildException {
+        if((packageName == null || packageName.length() == 0)) {
+            throw new BuildException("You must specify a packagename.");
+        }
+    }
+
+    /* setters */
+    public void setPackageName(final String p) {
+        packageName = p;
+    }
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org