-
Notifications
You must be signed in to change notification settings - Fork 39
Improve dir subtraction #804
Conversation
Variable doesn't need to be redefined each iteration, declare it outside the loop. Signed-off-by: William Douglas <[email protected]>
| fullPath := filepath.Join(chrootDir, f) | ||
| if fi, err := os.Lstat(fullPath); err == nil { | ||
| if !fi.IsDir() { | ||
| usedDirs[filepath.Dir(f)] = struct{}{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need any special handling for a file f in the root dir, e.g. /foo? I assume Dir would return ./ in that case, but the only non-dirs in root should be the symlinks lib, lib64, bin, and sbin, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filepath.Dir("/file") will return "/" which is correct in my mind though won't come up as mixer doesn't put / in the manifests so it wouldn't be checked for removal.
| } | ||
| for _, f := range bundleDirs { | ||
| isIncluded := false | ||
| for _, inc := range includes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to fudge includes so os-core is always the first element?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Manifest files I believe os-core is already the first element but mixer shouldn't be impacted by include order. The subtraction should happen regardless if something is in os-core no matter if os-core is looked at first or last from that logic.
bb3b934 to
0f60955
Compare
Instead of giving up on directory subtraction entirely, try to subtract directories that are in an included manifest *and* do not have a non-directory file somewhere in their path. For example: bundle1: /dir/file bundle2: includes bundle1 /dir In this case /dir would be subtracted from bundle2. Also add a special case for subtracting directories if they are in os-core as this reduces a lot of unused content from a bundle's manifest. Signed-off-by: William Douglas <[email protected]>
No description provided.