Repository: buildbot/buildbot

Issue:
Docker image for 2.4.0 contains packages from 2.3.1
The Docker image `buildbot/buildbot-master:v2.4.0` contains Python packages for buildbot `2.3.1`:

```sh
buildbot-console-view==2.3.1
buildbot-grid-view==2.3.1
buildbot-waterfall-view==2.3.1
buildbot-worker==2.3.1
buildbot-www==2.3.1
```

The `buildbot` package itself has version `2019.8.18`, which is not available from PyPI.

Even if `2019.8.18` turns out to be identical to `2.4.0`, this is somewhat problematic: Installing packages into the image with a dependency on buildbot will always uninstall the buildbot version that comes with the official image.

It would be nice if the Dockerfile could install buildbot from PyPI to ensure deterministic builds for those who need to derive their own image.

<details>
  <summary>Output of pip freeze</summary>

```
$ docker run --rm buildbot/buildbot-master:v2.4.0 pip freeze
asn1crypto==0.24.0
attrs==19.1.0
autobahn==19.8.1
Automat==0.7.0
buildbot==2019.8.18
buildbot-console-view==2.3.1
buildbot-grid-view==2.3.1
buildbot-waterfall-view==2.3.1
buildbot-worker==2.3.1
buildbot-www==2.3.1
certifi==2019.6.16
cffi==1.12.3
chardet==3.0.4
constantly==15.1.0
cryptography==2.7
decorator==4.4.0
future==0.17.1
hyperlink==19.0.0
idna==2.8
incremental==17.5.0
Jinja2==2.10.1
MarkupSafe==1.1.1
pbr==5.4.2
psycopg2==2.8.3
pyasn1==0.4.6
pyasn1-modules==0.2.6
pycparser==2.19
PyHamcrest==1.9.0
PyJWT==1.7.1
pyOpenSSL==19.0.0
python-dateutil==2.8.0
PyYAML==5.1.2
requests==2.22.0
service-identity==18.1.0
six==1.12.0
SQLAlchemy==1.3.7
sqlalchemy-migrate==0.12.0
sqlparse==0.3.0
Tempita==0.5.2
Twisted==19.7.0
txaio==18.8.1
txrequests==0.9.6
urllib3==1.25.3
zope.interface==4.6.0
```
</details>


Discussion:

Resolving patch:
diff --git a/pkg/buildbot_pkg.py b/pkg/buildbot_pkg.py
--- a/pkg/buildbot_pkg.py
+++ b/pkg/buildbot_pkg.py
@@ -199,19 +199,22 @@ def run(self):
         if self.already_run:
             return
         package = self.distribution.packages[0]
-        if os.path.exists("gulpfile.js") or os.path.exists("webpack.config.js"):
-            yarn_version = check_output("yarn --version")
-            assert yarn_version != "", "need nodejs and yarn installed in current PATH"
-            yarn_bin = check_output("yarn bin").strip()
+        if os.path.exists("webpack.config.js"):
 
-            commands = []
+            yarn_program = None
+            for program in ["yarnpkg", "yarn"]:
+                yarn_version = check_output([program, "--version"])
+                if yarn_version != "":
+                    yarn_program = program
 
-            commands.append(['yarn', 'install', '--pure-lockfile'])
+            assert yarn_version is not None, "need nodejs and yarn installed in current PATH"
 
-            if os.path.exists("gulpfile.js"):
-                commands.append([os.path.join(yarn_bin, "gulp"), 'prod', '--notests'])
-            elif os.path.exists("webpack.config.js"):
-                commands.append(['yarn', 'run', 'build'])
+            yarn_bin = check_output([yarn_program, "bin"]).strip()
+
+            commands = [
+                [yarn_program, 'install', '--pure-lockfile'],
+                [yarn_program, 'run', 'build'],
+            ]
 
             shell = bool(os.name == 'nt')
 


Test patch: