diff --git a/Changes.md b/Changes.md index 20b177a..1a3a37e 100644 --- a/Changes.md +++ b/Changes.md @@ -37,6 +37,22 @@ - Updated `inkscape` to 1.3.2. - Updated `scons` to 4.6.0. +2.1.1 +===== + +- Dockerfile : + - Fixed issues with `github` module on CI by installing `urllib3` 1.26.18. + +2.1.0 +===== + +- Dockerfile : + - Added `GAFFER_BUILD_ENVIRONMENT="gcc9"` environment variable. + - Added `sqlite-devel` package necessary for building Python with `sqlite3` support. + - Added `openssl-devel` and `openssl11-devel` packages necessary for building Python with support for OpenSSL 1.1.1. + - Updated SCons to 4.6.0. + - Updated CMake to 3.27.2. + 2.0.0 ===== diff --git a/build.py b/build.py index 5913931..ffe5e36 100755 --- a/build.py +++ b/build.py @@ -47,20 +47,6 @@ parser = argparse.ArgumentParser() -parser.add_argument( - "--build-env-version", - dest = "buildEnvVersion", - default = "3.0.0a4", - help = "The container image tag to use for docker builds." -) - -parser.add_argument( - "--build-env-image", - dest = "buildEnvImage", - default = "ghcr.io/gafferhq/build/build", - help = "The container image to use for docker builds." -) - parser.add_argument( "--organisation", default = "GafferHQ", @@ -122,6 +108,20 @@ "known build platform so that builds are repeatable." ) +parser.add_argument( + "--docker-image", + dest = "dockerImage", + default = "ghcr.io/gafferhq/build/build", + help = "The container image to use for docker builds." +) + +parser.add_argument( + "--docker-image-version", + dest = "dockerImageVersion", + default = "3.0.0a4", + help = "The Docker image tag to use for Docker builds." +) + parser.add_argument( "--interactive", type = distutils.util.strtobool, @@ -175,8 +175,19 @@ parser.exit( 1, "{0} not found\n".format( renderManLib ) ) # Build a little dictionary of variables we'll need over and over again -# in string formatting operations, and use it to figure out what -# package we will eventually be generating. +# in string formatting operations, and use it to figure out the name +# for the package we will eventually be generating. + +if args.docker : + # If we're going to build with Docker, make sure we're using the + # same value for `GAFFER_BUILD_ENVIRONMENT`. + subprocess.check_call( [ "docker", "pull", "{}:{}".format( args.dockerImage, args.dockerImageVersion ) ] ) + dockerInfo = subprocess.check_output( + [ "docker", "image", "inspect", "{}:{}".format( args.dockerImage, args.dockerImageVersion ) ] + ) + for env in json.loads( dockerInfo )[0]["Config"]["Env"] : + if env.startswith( "GAFFER_BUILD_ENVIRONMENT=" ) : + os.environ["GAFFER_BUILD_ENVIRONMENT"] = env.partition( "=" )[2] formatVariables = { "organisation" : args.organisation, @@ -184,6 +195,7 @@ "version" : args.version, "upload" : args.upload, "platform" : platform, + "buildEnvironment" : "-{}".format( os.environ["GAFFER_BUILD_ENVIRONMENT"] ) if "GAFFER_BUILD_ENVIRONMENT" in os.environ else "", "arnoldRoot" : args.arnoldRoot, "delight" : args.delightRoot, "renderManRoot" : args.renderManRoot, @@ -197,9 +209,9 @@ formatVariables[ "auth" ] = '-H "Authorization: token %s"' % githubToken if args.project == "gaffer" : - formatVariables["uploadFile"] = "{project}-{version}-{platform}.tar.gz".format( **formatVariables ) + formatVariables["buildName"] = "{project}-{version}-{platform}".format( **formatVariables ) else : - formatVariables["uploadFile"] = "gafferDependencies-{version}-{platform}.tar.gz".format( **formatVariables ) + formatVariables["buildName"] = "gafferDependencies-{version}-{platform}{buildEnvironment}".format( **formatVariables ) # If we're going to be doing an upload, then check that the release exists. Better # to find out now than at the end of a lengthy build. @@ -220,9 +232,9 @@ def releaseId() : # Restart ourselves inside a Docker container so that we use a repeatable # build environment. -if args.docker and not os.path.exists( "/.dockerenv" ) : +if args.docker : - image = "%s:%s" % ( args.buildEnvImage, args.buildEnvVersion ) + image = "%s:%s" % ( args.dockerImage, args.dockerImageVersion ) containerName = "gafferhq-build-{id}".format( id = uuid.uuid1() ) # We don't keep build.py in the images (otherwise we'd have to maintain @@ -267,7 +279,7 @@ def releaseId() : if args.interactive : containerCommand = "env {env} bash".format( env = containerEnv ) else : - containerCommand = "env {env} bash -c '/build.py --organisation {organisation} --project {project} --version {version} --upload {upload}'".format( env = containerEnv, **formatVariables ) + containerCommand = "env {env} bash -c '/build.py --docker 0 --organisation {organisation} --project {project} --version {version} --upload {upload}'".format( env = containerEnv, **formatVariables ) dockerCommand = "docker run --cap-add=SYS_PTRACE -it {mounts} --name {name} {image}-run {command}".format( mounts = containerMounts, @@ -280,7 +292,7 @@ def releaseId() : if not args.interactive : # Copy out the generated package. - copyCommand = "docker cp {container}:/{project}-{version}-source/{uploadFile} ./".format( + copyCommand = "docker cp {container}:/{project}-{version}-source/{buildName}.tar.gz ./".format( container = containerName, **formatVariables ) @@ -338,13 +350,13 @@ def releaseId() : # preferred python from the environment. SCons itself # unfortunately hardcodes `/usr/bin/python`, which might not # have the modules we need to build the docs. - buildCommand = "python `which scons` package PACKAGE_FILE={uploadFile} ENV_VARS_TO_IMPORT=PATH DELIGHT_ROOT={delight} ARNOLD_ROOT={arnoldRoot} RENDERMAN_ROOT={renderManRoot} OPTIONS='' -j {cpus}".format( + buildCommand = "python `which scons` package PACKAGE_FILE={buildName}.tar.gz ENV_VARS_TO_IMPORT=PATH DELIGHT_ROOT={delight} ARNOLD_ROOT={arnoldRoot} RENDERMAN_ROOT={renderManRoot} OPTIONS='' -j {cpus}".format( cpus=multiprocessing.cpu_count(), **formatVariables ) else : - buildCommand = "env RMAN_ROOT={delight} ARNOLD_ROOT={arnoldRoot} ./build.py --buildDir {cwd}/gafferDependenciesBuild".format( + buildCommand = "env RMAN_ROOT={delight} ARNOLD_ROOT={arnoldRoot} ./build.py --buildDir {cwd}/{buildName} --package {cwd}/{buildName}.tar.gz".format( cwd = os.getcwd(), **formatVariables ) @@ -359,12 +371,11 @@ def releaseId() : uploadCommand = ( 'curl {auth}' ' -H "Content-Type: application/zip"' - ' --data-binary @{uploadFile} "{uploadURL}"' + ' --data-binary @{buildName}.tar.gz "{uploadURL}"' ' -o /tmp/curlResult.txt' # Must specify output file in order to get progress output ).format( - uploadURL = "https://uploads.github.com/repos/{organisation}/{project}/releases/{id}/assets?name={uploadName}".format( + uploadURL = "https://uploads.github.com/repos/{organisation}/{project}/releases/{id}/assets?name={buildName}.tar.gz".format( id = releaseId(), - uploadName = os.path.basename( formatVariables["uploadFile"] ), **formatVariables ), **formatVariables