Home
Packages
Forums
Wiki
GitLab
Security
AUR
Download
コンテンツにスキップ
メインメニュー
メインメニュー
サイドバーに移動
非表示
案内
メインページ
目次
コミュニティに貢献
最近の出来事
おまかせ表示
特別ページ
交流
ヘルプ
貢献
最近の更新
最近の議論
新しいページ
統計
リクエスト
ArchWiki
検索
検索
表示
アカウント作成
ログイン
個人用ツール
アカウント作成
ログイン
Namcapのソースを表示
ページ
議論
日本語
閲覧
ソースを閲覧
履歴を表示
ツール
ツール
サイドバーに移動
非表示
操作
閲覧
ソースを閲覧
履歴を表示
全般
リンク元
関連ページの更新状況
ページ情報
表示
サイドバーに移動
非表示
←
Namcap
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
[[Category:パッケージ管理]] [[Category:パッケージ開発]] [[en:Namcap]] [[it:Namcap]] [[pt:Namcap]] Namcap は、パッケージを作るときによくある間違いがバイナリパッケージやソース PKGBUILD に存在しないかチェックするツールです。自動的に有効にすることもできます。Namcap は [https://www.archlinux.org/people/developer-fellows/#jason Jason Chu] によって開発されました。 '''変更点''': git リポジトリの [https://git.archlinux.org/namcap.git/tree/NEWS NEWS] ファイルに前のバージョンからの変更点が簡単に説明されています。 '''開発ブランチ''': https://git.archlinux.org/namcap.git/ namcap について'''バグを報告'''したり'''機能リクエスト'''をする場合は、Arch Linux の[https://bugs.archlinux.org バグトラッカー]の ''Packages:Extra'' セクションにバグを作成して適当に重要度を設定してください。バグを報告するときは、問題が発生するパッケージの具体例とバージョン番号を忘れずに付け加えることをお願いします。 (バグを修正したり、新しい namcap モジュールの) パッチを作った場合、[mailto:arch-projects@archlinux.org arch-projects] メーリングリストに送ることができます。Namcap の開発は git によって行われているため、git フォーマットにそったパッチが好ましいとされます。 == インストール == {{Pkg|namcap}} パッケージを[[pacman|インストール]]してください。 == 使用方法 == PKGBUILD やバイナリの pkg.tar.xz で namcap を実行する: $ namcap FILENAME 追加情報のメッセージを見たい場合は、{{ic|-i}} フラグを付けて namcap を実行します: $ namcap -i FILENAME 詳しい使い方は man ページの {{man|1|namcap}} を見てください。 == 出力の解釈 == Namcap は出力を分類するために'''タグ'''システムを使っています。現在、タグには ''エラー'' (error, E), ''ワーニング'' (warning, W), ''インフォメーション'' (informational, I) の3種類があります。エラーは問題が重大で、すぐに修正したほうがよいでしょう。ほとんどの場合、セキュリティの欠陥や、ライセンスが設定されてない、またはパーミッション関連の問題がエラーになります。 通常 namcap は人間が読める形で説明を出力します (場合によっては問題を修正するための方法の提案も付きます)。プログラムが簡単にパース出来るように出力させたい場合は、namcap に -m (''machine-readable'') フラグを渡して下さい (この機能は現在開発ブランチにあります)。 == タグ == === シンボリックリンク === * '''symlink-found''' (''informational'') パッケージ内に'''シンボリックリンク'''が存在しています。 * '''hardlink-found''' (''informational'') パッケージ内に'''ハードリンク'''が存在しています。 * '''dangling-symlink''' (''<span style="color:#e00000">error</span>'') パッケージ内に存在しないファイルのシンボリックリンクが存在しています。 * '''dangling-hardlink''' (''<span style="color:#e00000">error</span>'') パッケージ内に存在しないファイルのハードリンクが存在しています。 === 依存関係 === * '''link-level-dependence''' (''informational'') パッケージが動的リンクしているライブラリについての情報。 * '''dependency-is-testing-release''' (''warning'') 依存パッケージが [testing] リポジトリにあります。パッケージを公式の Arch Linux リポジトリ (core, extra, community) のためにビルドする場合、[testing] のパッケージを利用する'''ビルドをしてはいけません'''。[core] や [extra] のパッケージの場合、[testing] を使ってビルドするパッケージは [testing] リポジトリに置くべきです。 * '''dependency-covered-by-link-dependence''' (''informational'') 依存パッケージのリンクしている依存パッケージによって依存関係が満たされています。つまりこれは依存パッケージが余分だということです。 * '''dependency-detected-not-included''' (''<span style="color:#e00000">error</span>'') ファイルが参照している先に depends 行に記載されていない依存パッケージが含まれています。optdepends 行に依存パッケージが載っている場合はこのエラーは無視して下さい。 * '''dependency-already-satisfied''' (''warning'') 依存関係が既に満たされています (例えばあるパッケージの依存パッケージがすでに依存として記載されている)。つまり余分な依存パッケージです。{{Pkg|pacman}} に含まれている {{ic|pactree}} ツールを使うことでパッケージの依存関係ツリーを見ることができます。 * '''dependency-not-needed''' (''warning'') 依存パッケージがプログラム内に存在するどのファイルからも (namcap が推論できる限りでは) 必要とされていません。ただしスクリプトのパッケージ (python や perl パッケージなど) の場合はこの警告は正しくない場合があり、各自で依存関係を調べて下さい。 * '''depends-by-namcap-sight''' (''informational'') namcap による依存パッケージのリスト。 === ライセンス === * '''missing-license''' (''<span style="color:#e00000">error</span>'') パッケージにライセンスが明記されていません。PKGBUILD の {{ic|1=license=()}} 行にライセンスを記述してください。詳しくは [[Arch パッケージングスタンダード]]を見て下さい。ライセンスが含まれていないと著作権侵害になる場合が多いため、出来る限り早くこのエラーを解決するのが'''非常に重要'''です。 * '''missing-custom-license-dir''' (''<span style="color:#e00000">error</span>'') ライセンスが ''custom'' となっているのにパッケージングガイドラインで指定されている ''/usr/share/licenses/'' にライセンスディレクトリが存在しません。 * '''missing-custom-license-file''' (''<span style="color:#e00000">error</span>'') ライセンスが ''custom'' となっているのにライセンスファイルが ''/usr/share/licenses/$pkgname'' に存在しません。 * '''not-a-common-license''' (''<span style="color:#e00000">error</span>'') ライセンスが ''custom'' では'''ない'''のにかかわらず Arch Linux ディストリビューションにある [https://www.archlinux.org/packages/core/any/licenses/ licenses] パッケージに標準的なライセンスとして含まれていません。 === ファイル === このセクションでは、ファイルの不適切なパーミッションや、FHS ガイドラインに従ってインストールされてないファイルなどに関するタグを説明しています。 * '''script-link-detected''' (''informational'') 示されているファイルはスクリプトです。 * '''file-in-non-standard-dir''' (''warning'') ファイルが [https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html FHS ガイドライン] によって定義されている標準ディレクトリ以外に存在します。認定されているディレクトリは: ''bin/'', ''etc/'', ''usr/bin/'', ''usr/sbin/'', ''usr/lib'', ''usr/include/'', ''usr/share/'', ''opt/'', ''lib/'', ''sbin/'', ''srv/'', ''var/lib/'', ''var/opt/'', ''var/spool/'', ''var/lock/'', ''var/state/'', ''var/run/'', ''var/log/''。 * '''elffile-not-in-allowed-dirs''' (''<span style="color:#e00000">error</span>'') ELF ファイルは以下のディレクトリに配置しなくてはなりません: ''/lib'', ''/bin'', ''/sbin'', ''/usr/bin'', ''/usr/sbin'', ''/lib'', ''/usr/lib'', ''/opt/$pkgname/''。 * '''empty-directory''' (''warning'') パッケージ内のディレクトリが空です。 * '''non-fhs-man-page''' (''<span style="color:#e00000">error</span>'') [https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#usrsharemanManualPages FHS ガイドライン] によってマニュアルページのためのディレクトリとされている ''/usr/share/man'' 以外の場所にパッケージがマニュアルページをインストールしています。 * '''potential-non-fhs-man-page''' (''warning'') マニュアルページが ''/usr/share/man'' にインストールされていません。ただし namcap は man ページを確実に認識できるわけではありません。 * [https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#usrshareArchitectureindependentData FHS ガイドライン] によってアーキテクチャと無関係なデータをインストールする場所とされている ''/usr/share/info'' 以外の場所にパッケージが info ページをインストールしています。 * '''potential-non-fhs-info-page''' (''warning'') インフォページが ''/usr/share/info'' にインストールされていません。ただし namcap は info ページを確実に認識できるわけではありません。 * '''incorrect-permissions''' (''<span style="color:#e00000">error</span>'') ファイルの所有者が不適切です。バイナリパッケージ内のファイルの所有者は {{ic|root/root}} にしてください。 * '''file-not-world-readable''' (''warning'') ファイルが誰にも読まれないようになっています。通常はこうなっていません。 * '''file-world-writable''' (''warning'') 誰でもファイルに書き込みができるようになっています。同じく、典型から外れます。 * '''directory-not-world-executable''' (''warning'') ディレクトリに誰からも実行可能なビットが設定されていません。ユーザー権限で実行されているプログラムからディレクトリにアクセスできなくなります。 * '''incorrect-library-permissions''' (''warning'') 静的ライブラリファイル (.a) のパーミッションが 644 になっていません (root で読み書き可能、誰でも読み取り可能)。 * '''libtool-file-present''' (''warning'') 通常は存在しないはずの libtool (.la) ファイルが存在します。PKGBUILD の ''options'' 行に {{ic|!libtool}} オプションを追加することで自動的に削除できます。 * '''perllocal-pod-present''' (''<span style="color:#e00000">error</span>'') perl パッケージに perllocal.pod ファイルが存在してはいけません。詳しくは [[Perl パッケージガイドライン]]を見て下さい。 * '''scrollkeeper-dir-exists''' (''<span style="color:#e00000">error</span>'') scrollkeeper ディレクトリがパッケージに存在します。scrollkeeper は post_{install,upgrade,remove} まで実行してはいけません。 * '''info-dir-file-present''' (''<span style="color:#e00000">error</span>'') info ディレクトリファイル ''/usr/share/info/dir'' がパッケージに存在します。このファイルが存在してはいけません。 * '''gnome-mime-file''' (''<span style="color:#e00000">error</span>'') 自動生成された GNOME mime ファイルがパッケージ内に存在してはいけません。 === その他 === * '''insecure-rpath''' (''<span style="color:#e00000">error</span>'') (実行ファイルの) RPATH が ''/usr/lib'' の外にあります。安全でない場所に RPATH があるとセキュリティに問題が発生する可能性があります。詳しくは {{Bug|14049}} を参照。 === PKGBUILD === PKGBUILD に関連するタグです。いくつかはバイナリパッケージにも適用されます。 * '''variable-not-array''' (''warning'') 文字列ではなく bash 配列であるべき変数です。配列として変数を定義してください: ''arch'', ''license'', ''depends'', ''makedepends'', ''optdepends'', ''provides'', ''conflicts'', ''replaces'', ''backup'', ''source'', ''noextract'', ''md5sums''。 * '''backups-preceding-slashes''' (''<span style="color:#e00000">error</span>'') backup 行に載っているファイルがスラッシュ ('/') で始まっています。 * '''package-name-in-uppercase''' (''<span style="color:#e00000">error</span>'') パッケージの名前に大文字を含めてはいけません。 * '''specific-host-type-used''' (''warning'') 特定のホストタイプ (i686 あるいは x86_64 など) を使う代わりに汎用の $CARCH 変数を使ってください。 * '''extra-var-begins-without-underscore''' (''warning'') PKGBUILD マニュアルに定義されている標準変数でないのに、アンダースコアから始まっていません。 * '''file-referred-in-startdir''' (''<span style="color:#e00000">error</span>'') ''$startdir'' で ''$startdir/pkg'' や ''$startdir/src'' の外側にファイルが参照されています。 * '''missing-md5sums''' (''<span style="color:#e00000">error</span>'') ソースファイルに対応する MD5sum が存在しません。{{Pkg|pacman-contrib}} パッケージに含まれる {{ic|updpkgsums}} を使って PKGBUILD にチェックサムを追加することができます。 * '''not-enough-md5sums''' (''<span style="color:#e00000">error</span>'') MD5sum よりも多くのソースファイルが PKGBUILD に指定されています。 * '''too-many-md5sums''' (''<span style="color:#e00000">error</span>'') ソースファイルよりも多くの MD5sum が PKGBUILD に記述されています。 * '''improper-md5sum''' (''<span style="color:#e00000">error</span>'') 不正な MD5sum です。MD5sum は32字の文字列になります。 * '''specific-sourceforge-mirror''' (''warning'') PKGBUILD が特定の sourceforge ミラーを使っています。代わりに http://downloads.sourceforge.net を使って下さい。 * '''using-dl-sourceforge''' (''warning'') source 行で今はもう使われなくなった http://dl.sourceforge.net ドメインが使用されています。代わりに http://downloads.sourceforge.net を使って下さい。 * '''missing-contributor''' (''warning'') contributor タグが見つかりません。 * '''missing-maintainer''' (''warning'') maintainer タグが見つかりません。 * '''missing-url''' (''<span style="color:#e00000">error</span>'') パッケージに上流のホームページが設定されていません。{{ic|url}} 変数を使って下さい。 * '''pkgname-in-description''' (''warning'') 説明にパッケージ名が含まれていません。 * '''recommend-use-pkgdir''' (''informational'') ''$startdir/pkg'' は廃止されました、代わりに ''$pkgdir'' を使って下さい。 * '''recommend-use-srcdir''' (''informational'') ''$startdir/src'' は廃止されました、代わりに ''$srcdir'' を使って下さい。 === 未リリース === 現在、開発版に新規タグは存在しません。 == namcap モジュールの作成 == このセクションは namcap 内部の話であり新しい namcap モジュールの作り方を説明しています。 namcap のメインプログラム namcap.py はパラメータとしてパッケージのファイル名あるいは PKGBUILD を認識して pkginfo オブジェクトを作成します。そして {{ic|__tarball__}} と {{ic|__pkgbuild__}} に定義されているルールのリストにオブジェクトが渡されます。 * ''__tarball__'' にはバイナリパッケージを処理するルールが定義されます。 * ''__pkgbuild__'' には PKGBUILD を処理するルールが定義されます。 モジュールを作成したら、''Namcap/__init__.py'' に定義されている適切な配列 (''__tarball__'' または ''__pkgbuild__'') にモジュールを追加してください。 namcap のサンプルモジュール: {{hc|namcap/url.py|<nowiki> import pacman class package: def short_name(self): return "url" def long_name(self): return "Verifies url is included in a PKGBUILD" def prereq(self): return "" def analyze(self, pkginfo, tar): ret = [[],[],[]] if not hasattr(pkginfo, 'url'): ret[0].append(("missing-url", ())) return ret def type(self): return "pkgbuild" </nowiki>}} Mostly, the code is self-explanatory. The following are the list of the methods that each namcap module must have: * '''short_name'''(self) Returns a string containing a short name of the module. Usually, this is the same as the basename of the module file. * '''long_name'''(self) Returns a string containing a concise description of the module. This description is used when listing all the rules using {{ic|namcap -r list}}. * '''prereq'''(self) Return a string containing the prerequisites needed for the module to operate properly. Usually "" for modules processing PKGBUILDs and "tar" for modules processing package files. "extract" should be specified if the package contents should be extracted to a temporary directory before further processing. * '''analyze'''(self, pkginfo, tar) Should return a list comprising in turn of three lists: of error tags, warning tags and information tags respectively. Each member of these tag lists should be a tuple consisting of two components: '''the short, hyphenated form''' of the tag with the appropriate format specifiers (%s, etc.) The first word of this string must be the tag name. The human readable form of the tag should be put in the tags file. The format of the tags file is described below; and '''the parameters''' which should replace the format specifier tokens in the final output. * '''type'''(self) "pkgbuild" for a module processing PKGBUILDs, "tarball" for a module processing a binary package file. The tags file consists of lines specifying the human readable form of the hyphenated tags used in the namcap code. A line beginning with a '#' is treated as a comment. Otherwise the format of the file is: machine-parseable-tag %s :: This is machine parseable tag %s Note that a double colon (::) is used to separate the hyphenated tag from the human readable description. == Namcap レポート == '''namcap-reports''' は core, extra, community ツリーに対して namcap を実行して自動的に生成されるレポートです。 仕組み: * namcap is run against the entire [[ABS]] tree to make {{ic|namcap.log}}. * The packages in core, extra and community are put in files named core, extra and community respectively (using {{ic|pacman -Slq}}). * {{ic|namcap-report.py}} takes the code and prepares the report and RSS feeds, which is then copied to the webserver.
このページで使用されているテンプレート:
テンプレート:Bug
(
ソースを閲覧
)
テンプレート:Hc
(
ソースを閲覧
)
テンプレート:Ic
(
ソースを閲覧
)
テンプレート:Man
(
ソースを閲覧
)
テンプレート:Pkg
(
ソースを閲覧
)
Namcap
に戻る。
検索
検索
Namcapのソースを表示
話題を追加