summaryrefslogtreecommitdiff
path: root/buildstream/_artifactcache
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-08-21 16:53:50 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-08-21 16:53:50 -0400
commita10b9ce7dab55490afc85b130852a64633863961 (patch)
treeda1c38bb320072000c24d4b198de6290770738ab /buildstream/_artifactcache
parent6ba115065f8168fa1684be338a47f0a65ca3df79 (diff)
downloadbuildstream-a10b9ce7dab55490afc85b130852a64633863961.tar.gz
artifactcache.py: Fix escaping of element names
Fixes issue #66
Diffstat (limited to 'buildstream/_artifactcache')
-rw-r--r--buildstream/_artifactcache/artifactcache.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py
index 4ebc79848..3abecb103 100644
--- a/buildstream/_artifactcache/artifactcache.py
+++ b/buildstream/_artifactcache/artifactcache.py
@@ -21,6 +21,7 @@
import multiprocessing
import os
import sys
+import string
import tempfile
from .. import _ostree, utils
@@ -37,7 +38,11 @@ def buildref(element, key):
project = element.get_project()
# Normalize ostree ref unsupported chars
- element_name = element.normal_name.replace('+', 'X')
+ valid_chars = string.digits + string.ascii_letters + '-._'
+ element_name = ''.join([
+ x if x in valid_chars else '_'
+ for x in element.normal_name
+ ])
# assume project and element names are not allowed to contain slashes
return '{0}/{1}/{2}'.format(project.name, element_name, key)