13 Ports Specific FAQ

1. Adding a New Port
13.1.1. How do I add a new port?
13.1.2. Any other things I need to know when I add a new port?
2. Removing an Existing Port
13.2.1. How do I remove an existing port?
3. Repository Copies
13.3.1. When do we need a repository copy?
13.3.2. When do we not need a repository copy?
13.3.3. What do I need to do?
4. Ports Freeze
13.4.1. What is a “ports freeze”?
13.4.2. How long is a ports freeze?
13.4.3. What does it mean to me?
13.4.4. How do I know when the ports freeze starts?
13.4.5. How do I know when the ports freeze ends?
5. Creating a New Category
13.5.1. What is the procedure for creating a new category?
13.5.2. What do I need to do to implement a new physical category?
13.5.3. What do I need to do to implement a new virtual category?
6. Miscellaneous Questions
13.6.1. How do I know if my port is building correctly or not?
13.6.2. I added a new port. Do I need to add it to the INDEX?
13.6.3. Are there any other files I am not allowed to touch?
13.6.4. What is the proper procedure for updating the checksum for a port's distfile when the file changes without a version change?

1. Adding a New Port

13.1.1. How do I add a new port?

First, please read the section about repository copies.

The easiest way to add a new port is to use the addport script on freefall. It will add a port from the directory you specify, determining the category automatically from the port Makefile. It will also add an entry to the port's category Makefile. It was written by Michael Haro and Will Andrews , and is currently maintained by Renato Botelho , so please send questions/patches about addport to him.

13.1.2. Any other things I need to know when I add a new port?

Check the port, preferably to make sure it compiles and packages correctly. This is the recommended sequence:

# make install
# make package
# make deinstall
# pkg_add package you built above
# make deinstall
# make reinstall
# make package
       

The Porters Handbook contains more detailed instructions.

Use portlint(1) to check the syntax of the port. You do not necessarily have to eliminate all warnings but make sure you have fixed the simple ones.

If the port came from a submitter who has not contributed to the Project before, add that person's name to the Additional Contributors section of the FreeBSD Contributors List.

Close the PR if the port came in as a PR. To close a PR, just do edit-pr PR# on freefall and change the state from open to closed. You will be asked to enter a log message and then you are done.

2. Removing an Existing Port

13.2.1. How do I remove an existing port?

First, please read the section about repository copies. Before you remove the port, you have to verify there are no other ports depending on it.

  • Make sure there is no dependency on the port in the ports collection:

    • The port's PKGNAME should appear in exactly one line in a recent INDEX file.

    • No other ports should contain any reference to the port's directory or PKGNAME in their Makefiles

  • Then, remove the port:

    1. Remove the port's files via cvs remove.

    2. Remove SUBDIR listing of the port in the parent directory Makefile.

    3. Add an entry to ports/MOVED.

    4. Remove the port from ports/LEGAL if it is there.

Alternatively, you can use the rmport script, from ports/Tools/scripts. This script has been written by Vasil Dimov , who is also its current maintainer, so please send questions, patches or suggestions about rmport to him.

3. Repository Copies

13.3.1. When do we need a repository copy?

When you want to add a port that is related to any port that is already in the tree in a separate directory, you have to do a repository copy. Here related means it is a different version or a slightly modified version. Examples are print/ghostscript* (different versions) and x11-wm/windowmaker* (English-only and internationalized version).

Another example is when a port is moved from one subdirectory to another, or when you want to change the name of a directory because the author(s) renamed their software even though it is a descendant of a port already in a tree.

13.3.2. When do we not need a repository copy?

When there is no history to preserve. If a port is added into a wrong category and is moved immediately, it suffices to simply cvs remove the old one and addport the new one.

13.3.3. What do I need to do?

File a PR in GNATS, listing the reasons for the repository copy request. Assign it to portmgr and set state to repocopy. In a few days, portmgr will do a repository copy from the old to the new location, and reassign the PR back to you. Once everything is done, perform the following:

  • When a port has been repo copied:

    1. Do a force commit on the files of the copied port, stating repository copy was performed.

    2. Upgrade the copied port to the new version. Remember to change the LATEST_LINK so there are no duplicate ports with the same name. In some rare cases it may be necessary to change the PORTNAME instead of LATEST_LINK, but this should only be done when it is really needed -- e.g. using an existing port as the base for a very similar program with a different name, or upgrading a port to a new upstream version which actually changes the distribution name, like the transition from textproc/libxml to textproc/libxml2. In most cases, changing LATEST_LINK should suffice.

    3. Add the new subdirectory to the SUBDIR listing in the parent directory Makefile. You can run make checksubdirs in the parent directory to check this.

    4. If the port changed categories, modify the CATEGORIES line of the port's Makefile accordingly

    5. Add an entry to ports/MOVED, if you remove the original port.

  • When removing a port:

    1. Perform a thorough check of the ports collection for any dependencies on the old port location/name, and update them. Running grep on INDEX is not enough because some ports have dependencies enabled by compile-time options. A full grep -r of the ports collection is recommended.

    2. Remove the old port, the old SUBDIR entry and the old module entry.

    3. Add an entry to ports/MOVED.

  • After repo moves (“rename” operations where a port is copied and the old location is removed):

    1. Follow the same steps that are outlined in the previous two entries, to activate the new location of the port and remove the old one.

4. Ports Freeze

13.4.1. What is a “ports freeze”?

Before a release, it is necessary to restrict commits to the ports tree for a short period of time while the packages and the release itself are being built. This is to ensure consistency among the various parts of the release, and is called the “ports freeze”.

For more information on the background and policies surrounding a ports freeze, see the Portmgr Quality Assurance page.

13.4.2. How long is a ports freeze?

Usually a week or two.

13.4.3. What does it mean to me?

During the ports freeze, you are not allowed to commit anything to the tree without explicit approval from the Ports Management Team. “Explicit approval” here means that you send a patch to the Ports Management Team for review and get a reply saying, “Go ahead and commit it.”

Not everything is allowed to be committed during a freeze. Please see the Portmgr Quality Assurance page for more information.

Note that you do not have implicit permission to fix a port during the freeze just because it is broken.

13.4.4. How do I know when the ports freeze starts?

The ports management team will send out warning messages to the FreeBSD ports mailing list and FreeBSD committer's mailing list announcing the start of the impending release, usually two or three weeks in advance. The exact starting time will not be determined until a few days before the actual release. This is because the ports freeze has to be synchronized with the release, and it is usually not known until then when exactly the release will be rolled.

When the freeze starts, there will be another announcement to the FreeBSD ports mailing list and FreeBSD committer's mailing list, of course.

13.4.5. How do I know when the ports freeze ends?

A few hours after the release, the ports management team will send out a mail to the FreeBSD ports mailing list and FreeBSD committer's mailing list announcing the end of the ports freeze. Note that the release being cut does not automatically end the freeze. We have to make sure there will not be any last minute snafus that result in an immediate re-rolling of the release.

5. Creating a New Category

13.5.1. What is the procedure for creating a new category?

Please see Proposing a New Category in the Porter's Handbook. Once that procedure has been followed and the PR has been assigned to Ports Management Team , it is their decision whether or not to approve it. If they do, it is their responsibility to do the following:

  1. Perform any needed repocopies. (This only applies to physical categories.)

  2. Update the VALID_CATEGORIES definition in ports/Mk/bsd.port.mk.

  3. Assign the PR back to you.

13.5.2. What do I need to do to implement a new physical category?

The procedure is a strict superset of the one to repocopy individual ports (see above).

  1. Upgrade each copied port's Makefile. Do not connect the new category to the build yet.

    To do this, you will need to:

    1. Change the port's CATEGORIES (this was the point of the exercise, remember?) The new category should be listed first. This will help to ensure that the the PKGORIGIN is correct.

    2. Run a make describe. Since the top-level make index that you will be running in a few steps is an iteration of make describe over the entire ports hierarchy, catching any errors here will save you having to re-run that step later on.

    3. If you want to be really thorough, now might be a good time to run portlint(1).

  2. Check that the PKGORIGINs are correct. The ports system uses each port's CATEGORIES entry to create its PKGORIGIN, which is used to connect installed packages to the port directory they were built from. If this entry is wrong, common port tools like pkg_version(1) and portupgrade(1) fail.

    To do this, use the chkorigin.sh tool, as follows: env PORTSDIR=/path/to/ports sh -e /path/to/ports/Tools/scripts/chkorigin.sh . This will check every port in the ports tree, even those not connected to the build, so you can run it directly after the repocopy. Hint: do not forget to look at the PKGORIGINs of any slave ports of the ports you just repocopied!

  3. On your own local system, test the proposed changes: first, comment out the SUBDIR entries in the old ports' categories' Makefiles; then enable building the new category in ports/Makefile. Run make checksubdirs in the affected category directories to check the SUBDIR entries. Next, in the ports/ directory, run make index. This can take over 40 minutes on even modern systems; however, it is a necessary step to prevent problems for other people.

  4. Once this is done, you can commit the updated ports/Makefile to connect the new category to the build and also commit the Makefile changes for the old category or categories.

  5. Add appropriate entries to ports/MOVED.

  6. Update the instructions for cvsup(1):

    • add the category to distrib/cvsup/sup/README

    • adding the following files into distrib/cvsup/sup/ports-categoryname: list.cvs and releases.

    • add the category to src/share/examples/cvsup/ports-supfile

    (Note: these are in the src, not the ports, repository). If you are not a src committer, you will need to submit a PR for this.

  7. Update the list of categories used by sysinstall(8) in src/usr.sbin/sysinstall.

  8. Update the documentation by modifying the following:

    • the section of the Handbook that lists the cvsup collections.

    • the list of categories in the Porter's Handbook

    • www/en/ports/categories. Note that these are now displayed by sub-groups, as specified in www/en/ports/categories.descriptions.

    (Note: these are in the docs, not the ports, repository). If you are not a docs committer, you will need to submit a PR for this.

  9. Only once all the above have been done, and no one is any longer reporting problems with the new ports, should the old ports be deleted from their previous locations in the repository.

It is not necessary to manually update the ports web pages to reflect the new category. This is now done automatically via your change to www/en/ports/categories and the daily automated rebuild of INDEX.

13.5.3. What do I need to do to implement a new virtual category?

This is much simpler than a physical category. You only need to modify the following:

  • src/usr.sbin/sysinstall

  • the list of categories in the Porter's Handbook

  • www/en/ports/categories

6. Miscellaneous Questions

13.6.1. How do I know if my port is building correctly or not?

First, go check http://pointyhat.FreeBSD.org/errorlogs/. There you will find error logs from the latest package building runs on all supported platforms for the most recent branches.

However, just because the port does not show up there does not mean it is building correctly. (One of the dependencies may have failed, for instance.) The relevant directories are available on pointyhat under /a/portbuild/<arch>/<major_version> so feel free to dig around. Each architecture and version has the following subdirectories:

errors        error logs from latest <major_version> run on <arch>
logs          all logs from latest <major_version> run on <arch>
packages      packages from latest <major_version> run on <arch>
bak/errors    error logs from last complete <major_version> run on <arch>
bak/logs      all logs from last complete <major_version> run on <arch>
bak/packages  packages from last complete <major_version> run on <arch>

Basically, if the port shows up in packages, or it is in logs but not in errors, it built fine. (The errors directories are what you get from the web page.)

13.6.2. I added a new port. Do I need to add it to the INDEX?

No, INDEX is no longer stored in the CVS repository. The file can either be generated by running make index, or a pre-generated version can be downloaded with make fetchindex.

13.6.3. Are there any other files I am not allowed to touch?

Any file directly under ports/, or any file under a subdirectory that starts with an uppercase letter (Mk/, Tools/, etc.). In particular, the ports management team is very protective of ports/Mk/bsd.port*.mk so do not commit changes to those files unless you want to face his wra(i)th.

13.6.4. What is the proper procedure for updating the checksum for a port's distfile when the file changes without a version change?

When the checksum for a port's distfile is updated due to the author updating the file without changing the port's revision, the commit message should include a summary of the relevant diffs between the original and new distfile to ensure that the distfile has not been corrupted or maliciously altered. If the current version of the port has been in the ports tree for a while, a copy of the old distfile will usually be available on the ftp servers; otherwise the author or maintainer should be contacted to find out why the distfile has changed.

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.