karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [1/2] karaf git commit: [KARAF-4824] Add Option to bundle:update which doesn't rewrite MANIFEST file
Date Tue, 06 Dec 2016 10:35:33 GMT
Repository: karaf
Updated Branches:
  refs/heads/master 1ff5aa1aa -> 2a4e50e54


[KARAF-4824] Add Option to bundle:update which doesn't rewrite MANIFEST file

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/856e734a
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/856e734a
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/856e734a

Branch: refs/heads/master
Commit: 856e734aa3d5c37a756ed82ef713521b9b45a8c1
Parents: 1ff5aa1
Author: Guillaume Nodet <gnodet@apache.org>
Authored: Tue Dec 6 10:16:31 2016 +0100
Committer: Guillaume Nodet <gnodet@apache.org>
Committed: Tue Dec 6 10:16:31 2016 +0100

----------------------------------------------------------------------
 .../org/apache/karaf/bundle/command/Update.java     | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/856e734a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Update.java
----------------------------------------------------------------------
diff --git a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Update.java b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Update.java
index 4470f9f..88ea368 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Update.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Update.java
@@ -25,6 +25,7 @@ import java.net.URL;
 
 import org.apache.karaf.shell.api.action.Argument;
 import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
 import org.apache.karaf.shell.api.action.lifecycle.Service;
 import org.apache.karaf.util.bundles.BundleUtils;
 import org.osgi.framework.Bundle;
@@ -38,6 +39,9 @@ public class Update extends BundleCommand {
     @Argument(index = 1, name = "location", description = "The bundles update location",
required = false, multiValued = false)
     URI location;
 
+    @Option(name = "--raw", description = "Do not update the bundles's Bundle-UpdateLocation
manifest header")
+    boolean raw;
+
     protected Object doExecute(Bundle bundle) throws Exception {
         if (location != null) {
             update(bundle, location.toURL());
@@ -54,11 +58,15 @@ public class Update extends BundleCommand {
 
     private void update(Bundle bundle, URL location) throws IOException, BundleException
{
         try (InputStream is = location.openStream()) {
-            File file = BundleUtils.fixBundleWithUpdateLocation(is, location.toString());
-            try (FileInputStream fis = new FileInputStream(file)) {
-                bundle.update(fis);
+            if (raw) {
+                bundle.update(is);
+            } else {
+                File file = BundleUtils.fixBundleWithUpdateLocation(is, location.toString());
+                try (FileInputStream fis = new FileInputStream(file)) {
+                    bundle.update(fis);
+                }
+                file.delete();
             }
-            file.delete();
         }
     }
 


Mime
View raw message