Various infrastructure for Perforce triggers used at Uber Entertainment
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial checkin of code. Nov 23, 2015
.p4ignore Adding a .p4ignore to ignore git things. Nov 23, 2015
LICENSE Initial commit Nov 23, 2015 Fix some formatting in the README. Nov 23, 2015 Move the sitedir & sys.path setup to Nov 23, 2015 Couple of comment updates. Nov 23, 2015
content_checker_config.yaml.dist Initial checkin of code. Nov 23, 2015 Initial checkin of code. Nov 23, 2015 Initial checkin of code. Nov 23, 2015

This is a small set of scripts that does two things:

  • Route Perforce triggers to appropriate scripts (to make it easier to add new Perforce triggers with just a p4 triggers update and a new script in Perforce.)
  • We currently use a version of Perforce that does not support the %//depot/path/to/script% syntax in p4 triggers, so that makes this more important.
  • Verifies Unity meta-file consistency for configured projects.

The Unity meta-file verification has three checks:

  • Verify that any new Asset has a new .meta file added for it.
  • Verify that any deleted Asset also has its .meta file deleted.
  • Verify that no-one attempts to modify the guid field of an existing .meta file.

This prevents a lot of common mistakes that happen with Perforce and Unity.

It does not yet support two more checks that would be helpful:

  • Verify that any new Asset does not re-use an existing guid.
  • Verify that there are no .meta files added without the corresponding Asset.

Here, Asset means any file under the Assets directory in a project configured in content_checker_config.yaml.

Setting up

First, you need to set up a workspace for use by your Perforce server to check out the scripts. This is what ours looks like:

Client: perforce-admin-tools

Root:   d:\PerforceTriggers\tools\

        //depot/admin/tools/... //perforce-admin-tools/...

For us, these scripts live in e.g. //depot/admin/tools/p4dispatch/

Copy onto your Perforce server to wherever. For us, we use D:\PerforceTriggers. You will have to update to have the correct path to in SECOND_STAGE_RELATIVE_PATH. You will also have to update it to have the correct name of the workspace in SECOND_STAGE_WORKSPACE.

Install PyYAML.

Configure p4 triggers to launch as follows:

gatekeeper-content change-content //depot/... "C:\python27\python.exe D:\PerforceTriggers\ change-content %changelist%"

You will have to update the Python path as appropriate. That should be all!


This script is just responsible for syncing the SECOND_STAGE_WORKSPACE and launching from this repository.

This script checks for a file called $ where $action is the Perforce trigger we're executing for, like change-content, change-commit, etc, and if it exists it launches it. It sets up some import paths first.

This script reads content_checker_config.yaml, and if any of the files changed in this change match the paths in a project, it launches the check, rejecting a change if it fails the check. The only support check so far is a Unity meta file check.


If you have any questions, file an issue or contact the author at