Removed element.normal_name. This fixes issue #288.
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py index 9cc2815..ae7d23e 100644 --- a/buildstream/_artifactcache/artifactcache.py +++ b/buildstream/_artifactcache/artifactcache.py
@@ -97,9 +97,12 @@ valid_chars = string.digits + string.ascii_letters + '-._' element_name = ''.join([ x if x in valid_chars else '_' - for x in element.normal_name + for x in element.name ]) + if element_name.endswith('.bst'): + element_name = element_name[:-4] + assert key is not None # assume project and element names are not allowed to contain slashes
diff --git a/buildstream/_artifactcache/ostreecache.py b/buildstream/_artifactcache/ostreecache.py index c802fc2..3424c7b 100644 --- a/buildstream/_artifactcache/ostreecache.py +++ b/buildstream/_artifactcache/ostreecache.py
@@ -100,7 +100,7 @@ # Extracting a nonexistent artifact is a bug assert rev, "Artifact missing for {}".format(ref) - dest = os.path.join(self.extractdir, element._get_project().name, element.normal_name, rev) + dest = os.path.join(self.extractdir, element._get_project().name, element.name, rev) if os.path.isdir(dest): # artifact has already been extracted return dest
diff --git a/buildstream/_artifactcache/tarcache.py b/buildstream/_artifactcache/tarcache.py index 10ae9d0..3b8f024 100644 --- a/buildstream/_artifactcache/tarcache.py +++ b/buildstream/_artifactcache/tarcache.py
@@ -46,7 +46,7 @@ return os.path.isfile(path) def commit(self, element, content, keys): - os.makedirs(os.path.join(self.tardir, element._get_project().name, element.normal_name), exist_ok=True) + os.makedirs(os.path.join(self.tardir, element._get_project().name, element.name), exist_ok=True) with utils._tempdir() as temp: for key in keys: @@ -75,7 +75,7 @@ with utils._tempdir(dir=self.extractdir) as tmpdir: _Tar.extract(os.path.join(self.tardir, path), tmpdir) - os.makedirs(os.path.join(self.extractdir, element._get_project().name, element.normal_name), + os.makedirs(os.path.join(self.extractdir, element._get_project().name, element.name), exist_ok=True) try: os.rename(os.path.join(tmpdir, key), dest) @@ -105,7 +105,7 @@ # def _tarpath(element, key): project = element._get_project() - return os.path.join(project.name, element.normal_name, key + '.tar.bz2') + return os.path.join(project.name, element.name, key + '.tar.bz2') # A helper class that contains tar archive/extract functions
diff --git a/buildstream/_loader/loader.py b/buildstream/_loader/loader.py index e0ceb4f..2583939 100644 --- a/buildstream/_loader/loader.py +++ b/buildstream/_loader/loader.py
@@ -497,7 +497,7 @@ # Stage sources os.makedirs(self._context.builddir, exist_ok=True) - basedir = tempfile.mkdtemp(prefix="{}-".format(element.normal_name), dir=self._context.builddir) + basedir = tempfile.mkdtemp(prefix="{}-".format(element.name), dir=self._context.builddir) element._stage_sources_at(basedir, mount_workspaces=False) # Load the project
diff --git a/buildstream/_stream.py b/buildstream/_stream.py index cdef690..0142c10 100644 --- a/buildstream/_stream.py +++ b/buildstream/_stream.py
@@ -617,7 +617,7 @@ self._message(MessageType.INFO, "Bundling sources for target {}".format(target.name)) # Find the correct filename for the compression algorithm - tar_location = os.path.join(directory, target.normal_name + ".tar") + tar_location = os.path.join(directory, target.name + ".tar") if compression != "none": tar_location += "." + compression @@ -641,7 +641,7 @@ # Create a temporary directory to build the source tree in builddir = self._context.builddir - prefix = "{}-".format(target.normal_name) + prefix = "{}-".format(target.name) with TemporaryDirectory(prefix=prefix, dir=builddir) as tempdir: source_directory = os.path.join(tempdir, 'source') @@ -661,7 +661,7 @@ self._write_element_sources(tempdir, elements) self._write_build_script(tempdir, elements) self._collect_sources(tempdir, tar_location, - target.normal_name, compression) + target.name, compression) ############################################################# # Scheduler API forwarding # @@ -958,7 +958,7 @@ def _write_element_sources(self, directory, elements): for element in elements: source_dir = os.path.join(directory, "source") - element_source_dir = os.path.join(source_dir, element.normal_name) + element_source_dir = os.path.join(source_dir, element.name) element._stage_sources_at(element_source_dir) @@ -967,7 +967,7 @@ module_string = "" for element in elements: - module_string += shlex.quote(element.normal_name) + " " + module_string += shlex.quote(element.name) + " " script_path = os.path.join(directory, "build.sh")
diff --git a/buildstream/element.py b/buildstream/element.py index 70bee42..9d9c940 100644 --- a/buildstream/element.py +++ b/buildstream/element.py
@@ -196,14 +196,6 @@ super().__init__(meta.name, context, project, meta.provenance, "element") - self.normal_name = os.path.splitext(self.name.replace(os.sep, '-'))[0] - """A normalized element name - - This is the original element without path separators or - the extension, it's used mainly for composing log file names - and creating directory names and such. - """ - self.__runtime_dependencies = [] # Direct runtime dependency Elements self.__build_dependencies = [] # Direct build dependency Elements self.__sources = [] # List of Sources @@ -348,7 +340,7 @@ generated script is run: - All element variables have been exported. - - The cwd is `self.get_variable('build_root')/self.normal_name`. + - The cwd is `self.get_variable('build_root')/self.name`. - $PREFIX is set to `self.get_variable('install_root')`. - The directory indicated by $PREFIX is an empty directory. @@ -1419,7 +1411,7 @@ # Explicitly clean it up, keep the build dir around if exceptions are raised os.makedirs(context.builddir, exist_ok=True) - rootdir = tempfile.mkdtemp(prefix="{}-".format(self.normal_name), dir=context.builddir) + rootdir = tempfile.mkdtemp(prefix="{}-".format(self.name), dir=context.builddir) # Cleanup the build directory on explicit SIGTERM def cleanup_rootdir(): @@ -1750,7 +1742,7 @@ # os.makedirs(context.builddir, exist_ok=True) with utils._tempdir(dir=context.builddir, prefix='workspace-{}' - .format(self.normal_name)) as temp: + .format(self.name)) as temp: for source in self.sources(): source._init_workspace(temp) @@ -1778,7 +1770,7 @@ variable_string += "{0}={1} ".format(var, val) script = script_template.format( - name=self.normal_name, + name=self.name, build_root=self.get_variable('build-root'), install_root=self.get_variable('install-root'), variables=variable_string, @@ -1786,7 +1778,7 @@ ) os.makedirs(directory, exist_ok=True) - script_path = os.path.join(directory, "build-" + self.normal_name) + script_path = os.path.join(directory, "build-" + self.name) with self.timed_activity("Writing build script", silent_nested=True): with utils.save_file_atomic(script_path, "w") as script_file: @@ -2002,7 +1994,9 @@ logfile = "{key}-{action}.{pid}.log".format( key=key, action=action, pid=pid) - directory = os.path.join(context.logdir, project.name, self.normal_name) + element_name = (self.name[:-4] if self.name.endswith('.bst') else self.name) + '.log' + + directory = os.path.join(context.logdir, project.name, element_name) os.makedirs(directory, exist_ok=True) return os.path.join(directory, logfile) @@ -2073,7 +2067,7 @@ else: os.makedirs(context.builddir, exist_ok=True) - rootdir = tempfile.mkdtemp(prefix="{}-".format(self.normal_name), dir=context.builddir) + rootdir = tempfile.mkdtemp(prefix="{}-".format(self.name), dir=context.builddir) # Recursive contextmanager... with self.__sandbox(rootdir, stdout=stdout, stderr=stderr, config=config) as sandbox:
diff --git a/buildstream/plugins/elements/import.py b/buildstream/plugins/elements/import.py index 747455d..72a7390 100644 --- a/buildstream/plugins/elements/import.py +++ b/buildstream/plugins/elements/import.py
@@ -103,7 +103,7 @@ commands = [] # The directory to grab - inputdir = os.path.join(build_root, self.normal_name, self.source.lstrip(os.sep)) + inputdir = os.path.join(build_root, self.name, self.source.lstrip(os.sep)) inputdir = inputdir.rstrip(os.sep) # The output target directory