# 11.2.UPDATING 和 MOVED

## 11.2.1. /usr/ports/UPDATING

如果升级 Port 需要特定步骤，例如更改配置文件或运行特定程序，必须在此文件中记录。文件中的条目格式如下：

```sh
YYYYMMDD:
  AFFECTS: users of portcategory/portname
  AUTHOR: 你的名字 <你的电子邮箱地址>

  Special instructions
```

> **技巧**
>
> 在包含确切的 portmaster、portupgrade、pkg 指令时，请确保正确处理 shell 转义。例如，*不要* 使用：
>
> ```sh
> # pkg delete -g -f docbook-xml* docbook-sk* docbook[2345]??-* docbook-4*
> ```
>
> 如上所示，此命令仅在 Bourne Shell 下有效。或使用如下形式，该形式在 Bourne Shell 和 C-Shell 下均可正常工作：
>
> ```sh
> # pkg delete -g -f docbook-xml\* docbook-sk\* docbook\[2345\]\?\?-\* docbook-4\*
> ```

> **注意**
>
> 推荐 `AFFECTS` 行包含一个匹配所有受此条目影响的 Port 的 glob，以便自动化工具可以尽可能轻松地解析它。如果更新涉及所有现有的 BIND 9 版本，则 `AFFECTS` 内容应为 `users of dns/bind9*`，而不应为 `users of BIND 9`。

## 11.2.2. /usr/ports/MOVED

此文件用于列出被移动或删除的 Ports。文件中的每一行由 Port 的名称、该 Port 移动到的位置、移动日期以及原因组成。如果 Port 被删除，可以将移动位置部分留空。每个部分必须用 `|`（管道）字符分隔，如下所示：

```sh
old name|new name (blank for deleted)|date of move|reason
```

日期必须以 `YYYY-MM-DD` 的形式输入。新条目会被添加到列表的末尾，以保持按时间顺序排列，最旧的条目位于顶部。

如果某个 Port 被删除但后来又恢复了，删除该文件中记录其被删除的行。

如果某个 Port 被重命名后又恢复为原名称，需将中间的名称条目添加到旧名称的条目下，并删除旧的条目以避免形成循环。

> **注意**
>
> 任何更改都必须通过 `Tools/scripts/MOVEDlint.awk` 进行验证。如果使用的是 **/usr/ports** 以外的 Ports 目录，使用以下命令：
>
> ```sh
> % cd /home/user/ports
> % env PORTSDIR=$PWD Tools/scripts/MOVEDlint.awk
> ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://porters-handbook.bsdcn.org/di-11-zhang-sheng-ji-port/11.2.updating-he-moved.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
