def add_package_build(type, factory, compile_command):
    build = '%(slavename)s'

    # Build
    cmd = compile_command + [type]
    factory.addStep(Compile(description = [type], descriptionDone = [type],
                            command = cmd, warningPattern = warnPat))

    # Get file name
    factory.addStep(FileUpload(slavesrc = type + '.txt',
                               property = 'package_name'))

    # Get file
    src = '%(package_name)s'
    file = '/tmp/%(slavename)s/' + src
    step = FileUpload(slavesrc = WithProperties(src),
                      masterdest = WithProperties(file))
    step.haltOnFailure = True
    step.flunkOnFailure = True
    factory.addStep(step)

    # Publish
    cmd = WithProperties('/host/bin/publish build ' + file + \
                             ' %(slavename)s %(got_revision)s %(buildnumber)s')
    MasterShellCommand.haltOnFailure = True
    MasterShellCommand.flunkOnFailure = True
    step = MasterShellCommand(command = cmd, property = 'publish_path',
                              url = (src, c['distURL'] + '%(publish_path)s'),
                              name = 'publish ' + type)
    factory.addStep(step)