| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Report UtilError instead of OSError and similar python errors.
Also ensure we catch system errors and raise UtilError with
descriptive text instead; for the user experience; this is the
difference between:
o A FAILURE message with a description as to
what went wrong (exception handled with UtilError)
o A BUG message with the unhandled system error printed
with a stack trace (exception left unhandled)
Also, UtilsError and ProgramNotFoundError are now public exceptions
declared in utils.py, where they will appear in the documentation.
|
| |
|
| |
|
|
|
|
|
| |
These are not used anywhere internally and are not really desirable
to use, as usually you need only care about moving a toplevel directory.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
The 'result' field is optional, and currently used only by the internals
of {copy,move,link}_files. I think it makes sense to mandate that it's
called as a keyword arg in future.
|
|
|
|
| |
Hide all of buildstream's internal exceptions from the API surface.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Profiling suggested that the cumulative time spent in os.path.relpath()
was the dominant cost of utils.list_relative_paths().
Try to call this only once per directory walked.
In Python 3.5, we can optimise further by using os.scandir() and
maintaining relative paths as we go.
|
|
|
|
|
| |
utils._force_rmtree() was overwriting it's path directory, and
then only recursively removing the last entry which was walked.
|
| |
|
| |
|
|
|
|
|
| |
This little bit of code was being repeated a bunch of times
already throughout buildstream, looks sane enough to offer a utility.
|
| |
|
|
|
|
| |
Fetches the numeric major/minor version of the BuildStream package.
|
| |
|
|
|
|
|
|
|
| |
Support for prefix=None and suffix=None was added in python 3.5.
The default for suffix happens to be "", and the prefix happens to be
"tmp" (though that's an implementation detail), but it's sufficient,
and simpler than writing conditionals that omit certain args.
|
|
|
|
|
| |
A temporary directory context manager which cleans itself out
on sigterm.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
symlinks.
We want to change ownership of the symlinks, not their targets.
When doing this on an ostree checkout with symlinks to absolute paths, it
will make an attempt to modify ownership of files outside the sandbox,
and usually fail when building as the regular user (otherwise it will harm
the system when running as root).
|
| |
|
|
|
|
|
|
|
|
| |
By default we brutally murder subprocess trees, but sometimes we
know the nature of the tool we are using and know that it handles
sigterm gracefully.
This patch allows those cases to have a chance at graceful termination.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of using PurePath from pathlib, we use a modified version
of fnmatch.translate() to generate a regular expression.
This has multiple advantages:
* The private usage of regular expressions allows the Element
internal splitting rules to more easily adapt to the new globbing
syntax for split rules
* With the glob function under our control, we can document it more
clearly
* We have support for bash 'globstar' mode, which allows recursive
globs with double asterisk.
|
|
|
|
| |
Fixes: 10a0b98d ("utils.py: Add _call()")
|
|
|
|
|
|
|
|
|
| |
The glob module from the standard library only allows glob
pattern matching where there is a backing filesystem.
This utility allows glob matching on a simple list of paths,
and as such can be used to match things from an unextracted artifact
or an unextracted tarball.
|
|
|
|
|
|
|
|
| |
Instead of returning a tuple of two lists, return the
new FileListResult object.
This is better because it will allow us to enhance the result
over time without breaking API.
|
|
|
|
| |
This reverts commit 9ae1e1a290f67628d4e68632618b0aa9aa92b4e3.
|
|
|
|
|
|
|
|
|
|
| |
Since we merged MR 29 with a fix for resolving symlinks to realpaths,
we should also use the real path of the staging directory to produce
a relative path properly.
If we are considering that staged symlinks link to symlinked paths
inside the staging target, we must also consider that the staging
area itself can be in a symliked directory.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The goal of turning absolute symlink paths into relative ones is a noble one --
we want to avoid any chance of corrupting stuff on the host system. Symlinks
pointing to /lib/ld.so or whatever can be dangerous (although by not running
BuildStream as 'root' you are mostly protected anyway).
Some Baserock builds were broken by this as it didn't take into account that
the path to a symlink may itself contain symlinks. Adding an extra
os.realpath() call is enough to fix this case.
This was breaking the Baserock armv8l64 stage2 sysroot, where
/lib/ld-linux-aarch64.so is a symlink (to /tools/lib/ld-linux-aarch64.so.1) and
/lib is also a symlink (to /usr/lib).
|
|
|
|
|
| |
subprocess.call() wrapper supporting suspend and resume based on
plugin.__call().
|
|
|
|
| |
A brutally murderous function to kill a process and all of it's children.
|
| |
|
|
|
|
|
| |
These had a circular import, which is only supported > python 3.5
but undesirable anyway.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
o list_relative_files no longer has include_directories which
was always True, and now is better defined.
o Added move_files() function to compliment copy_files()
and link_files()
o Added safe_remove() utility to remove a path, only if it exists,
regardless of whether it is a directory or not, but not remove
non-empty directories.
|
| |
|
|
|
|
|
| |
This avoids any confusion as to if the master process can receive
SIGTSTP events it wants to handle, from child processes.
|
|
|
|
|
|
|
|
|
| |
This takes care of handling SIGTSTP and SIGCONT, allowing the
caller to pass one suspend() and one resume() function. This
should be used in the core where we launch sub processes which
will not go to sleep with the scheduler job, so that the handlers
in place can manually put these child processes to sleep and
wake them up later.
|
|
|
|
|
| |
Parts of the core use this to perform some minimal cleanup and ensure
proper process termination whenever a task is forcefully quit.
|
|
|
|
|
|
|
|
|
|
| |
When creating an overlay in which we can perform composites, it's important
to create it with:
copy = ChainMap({}, original)
Modifications will occur in the first mapping in the chain, we must provide
that first mapping with the prefixed {}.
|
|
|
|
|
| |
These use collections.ChainMap and should be used in place of
copy.deepcopy() as much as possible.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
o When removing a file that is in the way, dont recursively
nuke non-empty directories, warn instead
o When staging a symlink, stage a relative path; so that when
we stage files across the symlink boundary they never refer
to the host
o Fix list_relative_paths() to also report symlinks to directories
|
| |
|