in mozregression/build_info.py [0:0]
def persist_filename_for(self, data, regex=True):
"""
Returns the persistent filename for the given data.
`data` should be a date or datetime object if the build type is
'nightly', else a changeset.
if `regex` is True, instead of returning the persistent filename
it is returned a string (regex pattern) that can match a filename.
The pattern only allows the build name to be different, by using
the fetch_config.build_regex() value. For example, it can return:
'2015-01-11--mozilla-central--firefox.*linux-x86_64\\.tar.bz2$'
"""
if self.build_type == "nightly":
if isinstance(data, datetime.datetime):
prefix = data.strftime("%Y-%m-%d-%H-%M-%S")
else:
prefix = str(data)
persist_part = ""
else:
prefix = str(data[:12])
persist_part = self._fetch_config.integration_persist_part()
if persist_part:
persist_part = "-" + persist_part
extra = self._fetch_config.extra_persist_part()
if extra:
extra = extra + "--"
full_prefix = "{}{}--{}--{}".format(prefix, persist_part, self.repo_name, extra)
if regex:
full_prefix = re.escape(full_prefix)
appname = self._fetch_config.build_regex()
else:
appname = urlparse(self.build_url).path.replace("%2F", "/").split("/")[-1]
return "{}{}".format(full_prefix, appname)