aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Yan Hao <bses30074@gmail.com>2023-02-10 13:44:38 +0000
committerRuey-Cherng Yu <rcyu@FreeBSD.org>2023-02-10 13:44:38 +0000
commit63f47ea4d4fd2fed62b25acadbc8a6b5172d7d97 (patch)
tree65ba1e44da54a69ad19232ace4d3e0d4085c90ff
parent2604e85a69789fdb389bfd9046d62c8d964d4776 (diff)
downloaddoc-63f47ea4d4.tar.gz
doc-63f47ea4d4.zip
Traditional Chinese traslation of Quick Porting in Porters' Handbook
PR:268886 Author: Wang Yan Hao <bses30074@gmail.com>
-rw-r--r--documentation/content/zh-tw/books/porters-handbook/quick-porting/_index.adoc123
1 files changed, 85 insertions, 38 deletions
diff --git a/documentation/content/zh-tw/books/porters-handbook/quick-porting/_index.adoc b/documentation/content/zh-tw/books/porters-handbook/quick-porting/_index.adoc
index bdab09bdc5..75a896289d 100644
--- a/documentation/content/zh-tw/books/porters-handbook/quick-porting/_index.adoc
+++ b/documentation/content/zh-tw/books/porters-handbook/quick-porting/_index.adoc
@@ -56,7 +56,7 @@ endif::[]
[NOTE]
====
-It is recommended to set the `DEVELOPER` man:make[1] variable in [.filename]#/etc/make.conf# before getting into porting.
+在 porting 之前,建議在 [.filename]#/etc/make.conf# 設定 `DEVELOPER` man:make[1] 變數。
[source,shell]
....
@@ -64,7 +64,7 @@ It is recommended to set the `DEVELOPER` man:make[1] variable in [.filename]#/et
# echo DEVELOPER=yes >> /etc/make.conf
....
-This setting enables the "developer mode" that displays deprecation warnings and activates some further quality checks on calling `make`.
+這個設定開啟了 "developer mode" ,顯示已棄用警告並在使用 `make` 時檢查品質。
====
[[porting-makefile]]
@@ -87,12 +87,7 @@ COMMENT= Cat chasing a mouse all over the screen
.include <bsd.port.mk>
....
-[NOTE]
-====
-In some cases, the [.filename]#Makefile# of an existing port may contain additional lines in the header, such as the name of the port and the date it was created. This additional information has been declared obsolete, and is being phased out.
-====
-
-嗯,大致就是這樣,看看你已經領略多少了呢? 看到 `$FreeBSD: head/zh_TW.UTF-8/books/porters-handbook/book.xml 48496 2016-03-29 01:37:53Z kevlo $` 這一行的話,別想太多 ,當該 port 正式進入 port tree 時, Subversion 就會自動轉換為相關字串囉。 有關這點的細節部份,可以參閱 <<porting-samplem,sample Makefile>> 章節。
+嘗試了解此檔案,有關這點的細節部份,可以參閱 crossref:porting-samplem[porting-samplem,sample Makefile] 章節。
[[porting-desc]]
== 撰寫說明檔
@@ -107,29 +102,17 @@ In some cases, the [.filename]#Makefile# of an existing port may contain additio
[NOTE]
====
請注意,這檔_絕非_「該軟體的說明手冊」或是「如何編譯、使用該 port 的說明」! _若是從該軟體的 [.filename]#README# 或 manpage 直接複製過來的話,請注意_。他們常常不是正確的 port 描述或是格式並不適合。例如,manpage會對齊空白,這用monospace字型來看會特別糟糕。
-====
-A well-written [.filename]#pkg-descr# describes the port completely enough that users would not have to consult the documentation or visit the website to understand what the software does, how it can be useful, or what particularly nice features it has. Mentioning certain requirements like a graphical toolkit, heavy dependencies, runtime environment, or implementation languages help users decide whether this port will work for them.
+另一方面, [.filename]#pkg-descr# 的內容必須比 crossref:makefiles[makefile-comment,COMMENT line from the Makefile] 還要詳細,要能詳細解釋此 port 相關的內容。
+====
-Include a URL to the official WWW homepage. Prepend _one_ of the websites (pick the most common one) with `WWW:` (followed by single space) so that automated tools will work correctly. If the URI is the root of the website or directory, it must be terminated with a slash.
+一個良好的 [.filename]#pkg-descr# 可以讓使用者清楚的了解軟體的功能而無須查詢文件或者訪問網站,提及特定的需求像是圖形工具、依賴、執行的環境跟實作的語言,能大大的幫助使用者了解這個 port 是怎麼運作的。
[NOTE]
====
-If the listed webpage for a port is not available, try to search the Internet first to see if the official site moved, was renamed, or is hosted elsewhere.
+過去在 #pkg-descr# 文件最後一行引入的 URL 已經移到 [.filename]#Makefile# 裡面了。
====
-這是 [.filename]#pkg-descr# 內容的例子 :
-
-[.programlisting]
-....
-This is a port of oneko, in which a cat chases a poor mouse all over
-the screen.
- :
-(etc.)
-
-WWW: http://www.oneko.org/
-....
-
[[porting-pkg-plist]]
=== [.filename]#pkg-plist#
@@ -174,15 +157,23 @@ PLIST_FILES= bin/oneko \
[NOTE]
====
-Usage of `PLIST_FILES` should not be abused. When looking for the origin of a file, people usually try to grep through the [.filename]#pkg-plist# files in the ports tree. Listing files in `PLIST_FILES` in the [.filename]#Makefile# makes that search more difficult.
+`PLIST_FILES` 的使用不應該被濫用,人們通常透過在 ports tree 的 [.filename]#pkg-plist# 文件來了解 port ,在 [.filename]#Makefile# 中使用 `PLIST_FILES` 敘述會增加搜尋的難度。
====
[TIP]
====
-If a port needs to create an empty directory, or creates directories outside of [.filename]#${PREFIX}# during installation, refer to crossref:plist[plist-dir-cleaning, Cleaning Up Empty Directories] for more information.
+如果 port 需要創建空的目錄,或者安裝時在 [.filename]#${PREFIX}# 之外創建目錄,請參考 crossref:plist[plist-dir-cleaning, Cleaning Up Empty Directories] 來獲得更多資訊。
+====
+
+[TIP]
====
+因為 `PLIST_FILES` 是 man:make[1] 的變數,任何在此條目的 sapce 都必須被引入。舉例來說,如果使用 man:pkg-create[8] 和 crossref:plist[plist-keywords, Expanding Package List with Keywords] 描述的關鍵字,以下的條目必須被引入。
-然而,使用這個方法列出 port 的檔案和目錄是必須付出代價: 不能使用 man:pkg-create[8] 和 crossref:plist[plist-keywords, Expanding Package List with Keywords] 描述的關鍵字。 因此,這招僅適用於較簡單的 port ,以及簡化該 port 的作法。 此外,這招還有一個好處:可以減少 ports collection 的整體檔案總數。 所以,在考慮是否要用 [.filename]#pkg-plist# 之前, 可以先斟酌這個替代方案看看。
+[.programlisting]
+....
+PLIST_FILES= "@sample ${ETCDIR}/oneko.conf.sample"
+....
+====
後面會介紹到如何運用 [.filename]#pkg-plist#、 `PLIST_FILES` 這些技巧以因應crossref:plist[plist,更複雜的狀況]。
@@ -198,10 +189,10 @@ If a port needs to create an empty directory, or creates directories outside of
* 若該 port 沒裝的東西,不要列在 [.filename]#pkg-plist# 內。
* 若該 port 有裝的東西,請務必列在 [.filename]#pkg-plist# 內。
-* The port can be installed using the `install` target. This verifies that the install script works correctly.
-* The port can be deinstalled properly using the `deinstall` target. This verifies that the deinstall script works correctly.
-* The port does not access network resources after the `fetch` target. This is important for package builders, such as package:ports-mgmt/poudriere[].
-* Make sure that `make package` can be run as a normal user (that is, not as `root`). If that fails, `NEED_ROOT=yes` must be added to the port [.filename]#Makefile#.
+* port 可以透過 `install` 來安裝,這可以確保安裝的 script 是正常運作的。
+* port 可以透過 `uninstall` 來移除,這可以確保安裝的 script 是正常運作的。
+* port 只有在 `featch` 目標時才能使用網路,這對 package builders 很重要,像是 package:ports-mgmt/poudriere[].
+* 確保 `make package` 可以被一般使用者執行 (也就是說,非 `root` 使用者),如果上述執行失敗,軟體很可能需要修改,請參考 crossref:uses[uses-fakeroot,`fakeroot`] 和 crossref:uses[uses-uidfix,`uidfix`]。
[.procedure]
====
@@ -218,32 +209,88 @@ If a port needs to create an empty directory, or creates directories outside of
確認在任何階段都沒有任何警告出現。
-Thorough automated testing can be done with package:ports-mgmt/tinderbox[] or package:ports-mgmt/poudriere[] from the Ports Collection. These applications maintain `jails` where all of the steps shown above can be tested without affecting the state of the host system.
+可以透過 package:ports-mgmt/tinderbox[] 或者 Ports Collection 的 package:ports-mgmt/poudriere[] 工具來完成自動化測試,參考 crossref:testing[testing-poudriere,Poudriere] 獲得更多的資訊。她維護 `jails` ,可以在不影響系統的情況下執行上述所有的測試。
[[porting-portlint]]
== 以 `portlint` 來作檢查 Port
請用 `portlint` 來檢查該 port 是否有遵循我們的規則。 package:ports-mgmt/portlint[] 是 ports collection 的其中一個套件。 它主要可以用來檢驗 <<porting-samplem,Makefile>> 內容是否正確以及 <<porting-pkgname,package>> 是否有正確命名。
+[IMPORTANT]
+====
+不要盲目的相信 `portlint` 的輸出,他是一個 static lint 工具,並且有可能會出錯。
+====
+
[[porting-submitting]]
== 提交新的 Port
提交新的 Port 前,請閱讀 <<porting-dads,DOs and DON'Ts>> 章節。
-現在你很高興終於打造出 port 來囉,唯一剩下要做的就是把它正式放到 FreeBSD ports tree 內,才能讓每個人都能分享使用這個 port。 我們不需要 [.filename]#work# 目錄或是檔名像 [.filename]#pkgname.tgz# 的 package ,請現在刪除他們。
+現在你很高興終於打造出 port 來囉,唯一剩下要做的就是把它正式放到 FreeBSD ports tree 內,才能讓每個人都能分享使用這個 port。
-Next, build the man:shar[1] file. Assuming the port is called `oneko`, `cd` to the directory above where the `oneko` directory is located, and then type: `shar find oneko > oneko.shar`
+[IMPORTANT]
+====
+我們不需要 [.filename]#work# 目錄或是檔名像 [.filename]#pkgname.tgz# 的 package ,請現在刪除他們。
+====
-To submit [.filename]#oneko.shar#, use the https://bugs.freebsd.org/submit/[bug submit form] (category `Ports Tree`). Add a short description of the program to the Description field of the PR (perhaps a short version of `COMMENT`), and do not forget to add [.filename]#oneko.shar# as an attachment.
+下一步,創建一個 man:patch[1] ,一個文件,假設此 port 叫做 `oneko` 並且屬於 `games` 類別。
-[NOTE]
+[[porting-submitting-diff]]
+.為新的 Port 創建 [.filename]#.diff#
+[example]
====
-Giving a good description in the summary of the problem report makes the work of port committers a lot easier. We prefer something like "New port: _category_/_portname__short description of the port_" for new ports. Using this scheme makes it easier and faster to begin the work of committing the new port.
+透過 `git add .` 加入所有的檔案,然後透過 `git diff` 來檢查不同處,如下。
+
+[source,shell]
+....
+% git add .
+% git diff --staged
+....
+
+確保所有需要的檔案都被引入了,將更改提交到你本地分支並使用 `git format-patch` 產生 patch。
+
+[source,shell]
+....
+% git commit
+% git format-patch origin/main
+....
+
+使用 `git format-patch` 產生的 patch 會包含作者以及電子郵件,讓其他開發者更容易使用 (with `git am`) 以及給予回饋。
+
+
+[IMPORTANT]
+****
+為了讓開發者更容易在他們的 ports tree 使用此 patch ,請基於你的 ports tree 來產生 [.filename]#.diff# 。
+****
+
====
-再次強調一點:_不必附上原始 source 的 distfile ,也就是 [.filename]#work# 目錄。 同時,也不必附上 `make package` 時產生的 package_。新的 port 請使用 man:shar[1] ,不要用 man:diff[1] 。
+透過 https://bugs.freebsd.org/submit/[bug submission form] 繳交 [.filename]#oneko.diff# 。使用 "Ports & Packages" 產品和 "Individual Port(s)" 組件,然後跟著這裡的教學走,在 PR 的描述欄位 (也許是較短的 `COMMENT` ) 加入簡短的敘述,並且記得在附件中加入 [.filename]#oneko.diff# 。
+
+[NOTE]
+====
+在問題回報系統中給一個好的總結可以讓 port 開發者更輕鬆的處理此 port ,我們預期的描述形式為 "[NEW PORT] _category/portname short description of the port_" ,使用此形式能讓我們更快的部屬新的 port 。
+====
送出 port 之後,請耐心等候佳音。 有時候可能需要等個幾天或幾個月時間,才會在 FreeBSD ports tree 上正式出現。 等待中的 port PR 清單可以在 http://www.FreeBSD.org/cgi/query-pr-summary.cgi?category=ports[] 查閱。
+在搜尋表單中選擇 _Open_ and _Ports & Packages_ 來獲得 _open_ port PRs 的清單。
+
在看過新的 port 之後,如果需要的話,我們會回覆您,然後會將它提交到 port tree 。 您的大名會被列在 extref:{contributors}[Additional FreeBSD Contributors, contrib-additional] 列表上,以及其他檔案中。
+也可以透過 man:shar[1] 檔案來提交 port ,請使用之前 `oneko` port 的例子。
+
+.為新的 Port 創建 [.filename]#.shar#
+[[porting-submitting-shar]]
+[example]
+====
+前往 port 所在的目錄,使用 `tar`創建 shar archive:
+
+[source,shell]
+....
+% cd ..
+% tar cf oneko.shar --format shar oneko
+....
+====
+
+可以使用跟提交 [.filename]#oneko.diff# 一樣的方式來提交 [.filename]#oneko.shar# 。 \ No newline at end of file