[Buildbot-devel] Environment variables upper case (Windows slave)

Maria Marcano mariangemarcano at gmail.com
Thu Sep 26 13:59:03 UTC 2013


I meant: After investigating the problem, the issue is really jamplus which
*should not* be case sensitive on windows,


On Thu, Sep 26, 2013 at 3:57 PM, Maria Marcano <mariangemarcano at gmail.com>wrote:

> After investigating the problem, the issue is really jamplus which should
> be case sensitive on windows,
>
> In the mean time we have decided to implement a workaround for win slaves
> while we look into a long term solution of fixing jam.
>
> I'm thinking applying this workaround, could you check if this looks
> correct to handle this condition? this is patch
>
>
> diff --git a/slave/buildslave/runprocess.py
> b/slave/buildslave/runprocess.py
> index 5af2533..ca92e37 100644
> --- a/slave/buildslave/runprocess.py
> +++ b/slave/buildslave/runprocess.py
> @@ -27,7 +27,8 @@ import traceback
>  import stat
>  from collections import deque
>  from tempfile import NamedTemporaryFile
> +if os.name == "nt":
> +    import nt
>
>
> @@ -285,6 +286,10 @@ class RunProcess:
>          self.process = None
>          if not os.path.exists(workdir):
>              os.makedirs(workdir)
> +        # workaround for jamplus, case sensitive on windows
> +        os_environ = os.environ
> +        if os.name == "nt":
> +            os_environ = nt.environ
>          if environ:
>              for key, v in environ.iteritems():
>                  if isinstance(v, list):
> @@ -301,12 +306,12 @@ class RunProcess:
>              # do substitution on variable values matching pattern: ${name}
>              p = re.compile('\${([0-9a-zA-Z_]*)}')
>              def subst(match):
> -                return os.environ.get(match.group(1), "")
> +                return os_environ.get(match.group(1), "")
>              newenv = {}
> -            for key in os.environ.keys():
> +            for key in os_environ.keys():
>                  # setting a key to None will delete it from the slave
> environment
>                  if key not in environ or environ[key] is not None:
> -                    newenv[key] = os.environ[key]
> +                    newenv[key] = os_environ[key]
>              for key, v in environ.iteritems():
>                  if v is not None:
>                      if not isinstance(v, basestring):
> @@ -316,7 +321,7 @@ class RunProcess:
>
>              self.environ = newenv
>          else: # not environ
> -            self.environ = os.environ.copy()
> +            self.environ = os_environ.copy()
>          self.initialStdin = initialStdin
>          self.logEnviron = logEnviron
>          self.timeout = timeout
>
> Thanks
>
>
>
> On Wed, Sep 25, 2013 at 1:22 PM, Maria Marcano <mariangemarcano at gmail.com>wrote:
>
>> Hi,
>>
>> I'm noticing all environment variables are loaded upper case on windows
>> when running commands in buildbot.
>>
>> This causes issues in our build system because we use jamplus which
>> treats environment variable case sensitive, for example isn't finding the
>> environment variable windir (windows has this variable by default lower
>> case).
>>
>> Is it possible to have the environment variables on buildbot using the
>> same case as it is defined in the OS?
>>
>> Thanks,
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20130926/ae043cd4/attachment.html>


More information about the devel mailing list