[gnome-continuous/wip/platform: 7/9] Add keep-only component property



commit 8b0139a121f815c658d5e956a5c52b828c86e2ce
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Sep 12 13:27:09 2014 +0200

    Add keep-only component property
    
    If this is set then only the listed files will be part of the component.
    Everything else will be deleted.
    
    This is needed to create a simple libudev package from the systemd
    sources, as it can't (easily) install libudev only.

 src/js/tasks/task-build.js |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/js/tasks/task-build.js b/src/js/tasks/task-build.js
index 35be635..56e1b59 100644
--- a/src/js/tasks/task-build.js
+++ b/src/js/tasks/task-build.js
@@ -430,6 +430,31 @@ const TaskBuild = new Lang.Class({
                             }), cancellable);
        }
 
+       let keepFiles = component['keep-files'];
+       if (keepFiles && keepFiles.length > 0) {
+           let keep = [];
+           for (let i = 0; i < keepFiles.length; i++) {
+               let path = keepFiles[i];
+               if (path[0] == '/') {
+                   path = path.slice(1);
+               }
+               keep[i] = buildResultDir.resolve_relative_path(path);
+               print("BAARkeep: " + keep[i].get_path());
+           }
+
+           FileUtil.walkDir(buildResultDir, { matchDirs: true},
+                            Lang.bind(this, function(filePath, cancellable) {
+                                for (let i = 0; i < keep.length; i++) {
+                                    if (filePath.has_prefix(keep[i]) ||
+                                        filePath.equal(keep[i]) ||
+                                        keep[i].has_prefix(filePath)) {
+                                        return;
+                                    }
+                                }
+                                GSystem.file_unlink(filePath, cancellable);
+                            }), cancellable);
+       }
+
        if (libdir.query_exists(null)) {
            // Move symbolic links for shared libraries to devel
            FileUtil.walkDir(libdir, { nameRegex: /\.so$/,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]