ページ ツリー

このページの古いバージョンを表示しています。現在のバージョンを表示します。

現在のバージョンとの相違点 ページ履歴を表示

« 前のバージョン バージョン 12 次のバージョン »

 コンテンツ

説明

※あとで文言を考える

Perforce Helix Core 2019.1ではHelix Core Extension(p4 extensionコマンド)が追加されました。

Helix Core Extensionを使用することにより、自社で作成したスクリプトを簡単に管理することができます。

また、使用可能なスクリプト言語はlua言語のみのため、プラットフォームへの移植性が高くなりました

Perforeサーバへ展開することにより、サーバの動作を拡張することができます。
これにより、作成したスクリプトが実行環境に依存することがなくなります。

また、

注意

Helix Core ExtensionWindows Serverでは使用できません。

参照ページ(英文)


利用手順

■ 前提

例として、【クライアントワークスペースのビュー定義でディポパスの階層数が3より少ない場合をチェックする】というサーバエクステンションを作成、サーバへのインストール、動作確認をするまでの手順を説明しています。

Perforce Workshopで公開されている”narrow_workspace_mappings”というサンプルを使用します。
スクリプトの記述については含めていません。

その他の設定は以下の通りです。
  ・ルートディレクトリ:/master
  ・サーバエクステンション用ディレクトリ:/master/narrow_workspace_mappings
  ・自動ログインユーザ:super

.サーバエクステンションのスケルトン作成

  "/master/narrow_workspace_mappings" ディレクトリに移動し、スケルトンを作成します。

実行コマンド

  p4 extension --sample server-extension-name
例:p4 extension --sample narrow_workspace_mappings

実行結果

Extension template created in the 'narrow_workspace_mappings' directory.
※"main.lua"、"manifest.json"の2ファイルが作成されます。

2."narrow_workspace_mappings"のダウンロード
  ※例題として"narrow_workspace_mappings"を使用するための手順です。実運用の際は不要です

  ダウンロードサイトより"narrow_workspace_mappings"の"main.lua"を入手し
  "/master/narrow_workspace_mappings"ディレクトリ内のファイルを置き換えます

Perforce Workshop(ダウンロードサイト)


3.main.luaの編集
  main.luaファイルを編集してロジックを追加します。


  編集?


4.".p4-extension"ファイルの作成
  
クライアントで"narrow_workspace_mappings.p4-extension"ファイルを作成します。
  ".p4-extension"ファイルは、サーバエクステンションをサーバにインストールする際に必要です。

実行コマンド

  p4 extension --package server-extension-name
例:p4 extension --package narrow_workspace_mappings

実行結果

Extension packaged successfully.
※"narrow_workspace_mappings.p4-extension"ファイルが作成されます


5.サーバエクステンションのインストール(確認)
  作成したサーバエクステンションを、Helixサーバに実際にインストールする前に、レポートモードで確認します。

実行コマンド

  p4 extension --install server-extension-name.p4-extension
例:p4 extension --install narrow_workspace_mappings.p4-extension

実行結果

Would install Extension 'ExampleInc::narrow_workspace_mappings'
   ⋮
Version: '2019.1'
UUID: 22BB3349-4AD5-8617-203B-575747XXXXXX
Developer: Perforce Software Inc.
Description: [Example Extension, sample code] Restrict client views to have a configurable minimum
directory depth. This is to prevent user from
having a wide open workspace leading to getting unecessary files.
E.g. reject a mapping of //depot/... and allow //depot/some/more/narrow/path/...
License: BSD
Homepage URL: https://swarm.workshop.perforce.com/files/guest/perforce_software/extensions/2019-1
Compatible products: p4d
   ⋮
This was report mode. Use -y to perform the operation.

6.サーバエクステンションのインストール(実行)
  
実行結果が確認できたら"-y"オプションを追加し、インストールを実行します。

実行コマンド

  p4 extension --install server-extension-name.p4-extension -y
例:p4 extension --install narrow_workspace_mappings.p4-extension -y

実行結果

Extension 'ExampleInc::narrow_workspace_mappings' version '2019.1' installed successfully.


7.インストールされているサーバエクステンションの確認
  
サーバエクステンションがインストールされていることを確認します

実行コマンド

p4 extension --list –type=extensions

実行結果

... extension ExampleInc::narrow_workspace_mappings
... rev 1
... developer Perforce Software Inc.
... description-snippet [Example Extension,
... UUID 22BB3349-4AD5-8617-203B-575747XXXXXX
... version 2019.1
... enabled false
... arch-dir server.extensions.dir/22BB3349-4AD5-8617-203B-575747XXXXXX/1-arch
... data-dir server.extensions.dir/22BB3349-4AD5-8617-203B-575747XXXXXX/1-data

8.サーバエクステンション構成のグローバル設定
  インストールしたサーバエクステンションが、自動ログインに使用するユーザをsuperにするため、グローバル設定を変更します。
  ※コマンドで使用する
ネームスペース名は"manifest.json"ファイル内で定義されています。ここでは"ExampleInc"がネームスペース名となっています。

実行コマンド

  p4 extension --configure name-space-name::server-extension-name
例:p4 extension --configure ExampleInc::narrow_workspace_mappings

赤文字部分を修正

   ⋮
ExtP4USER:   super    ●"sampleExtensionsUser"から変更
   ⋮

9.サーバエクステンション構成のインスタンス設定
  
インストールしたサーバエクステンションのインスタンス設定を変更します。
  本手順では、「ワークスペースのビュー定義でディポパスの階層数を3より少ない」をチェックするサーバエクステションとするため、下記の変更を行います

実行コマンド

  p4 extension --configure name-space-name::server-extension-name --name extCfg
例:p4 extension --configure ExampleInc::narrow_workspace_mappings --name extCfg

赤文字部分を修正

   ⋮
ExtConfig:
        exempt_users:
                super  ●"Space-separated list of which users do NOT have this restriction"を修正
        num_level:
                3               ●"insert minimum number of level across all"を修正
   ⋮

10.インストールしたサーバエクステンションの動作確認
  P4Vを起動し、クライアントワークスペースのビューの定義を表示します
  ① [ 接続(C) ] → [ 現在のワークスペースを編集(W) ]を選択します。

  

  ② ディポパスの階層を[ 3 ] よりも少ない数で指定します。
    指定後[ OK ]をクリックします。

  

  ③ ディポパスの階層が確認され、下記メッセージが表示されます。

  

  確認は以上です

  • ラベルがありません