19. Ports Specific FAQ

19.1. Adding a New Port
19.1.1. How do I add a new port?
19.1.2. Any other things I need to know when I add a new port?
19.2. Removing an Existing Port
19.2.1. How do I remove an existing port?
19.3. Re-adding a Deleted Port
19.3.1. How do I re-add a deleted port?
19.4. Repository Copies
19.4.1. When do we need a repository copy?
19.4.2. What do I need to do?
19.5. Ports Freeze
19.5.1. What is a “ports freeze”?
19.6. Creating a New Category
19.6.1. What is the procedure for creating a new category?
19.6.2. What do I need to do to implement a new physical category?
19.6.3. What do I need to do to implement a new virtual category?
19.7. Miscellaneous Questions
19.7.1. How do I know if my port is building correctly or not?
19.7.2. I added a new port. Do I need to add it to the INDEX?
19.7.3. Are there any other files I am not allowed to touch?
19.7.4. What is the proper procedure for updating the checksum for a port's distfile when the file changes without a version change?
19.7.5. What is the procedure to request authorization for merging a commit to the quarterly branch?

19.1. Adding a New Port

19.1.1. How do I add a new port?
19.1.2. Any other things I need to know when I add a new port?

19.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 the addport script located in the ports/Tools/scripts directory. It adds a port from the directory specified, determining the category automatically from the port Makefile. It also adds an entry to the port's category Makefile. It was written by Michael Haro , Will Andrews , and Renato Botelho . When sending questions about this script to the FreeBSD ports mailing list, please also CC Chris Rees , the current maintainer.

19.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, change the state to Issue Resolved and the resolution as Fixed.

19.2. Removing an Existing Port

19.2.1. How do I remove an existing port?

19.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 and directory with svn remove.

    2. Remove the 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 was written by Vasil Dimov . When sending questions about this script to the FreeBSD ports mailing list, please also CC Chris Rees , the current maintainer.

19.3. Re-adding a Deleted Port

19.3.1. How do I re-add a deleted port?

19.3.1.

How do I re-add a deleted port?

This is essentially the reverse of deleting a port.

Important:

Do not use svn add to add the port. Follow these steps. If they are unclear, or are not working, ask for help, do not just svn add the port.

  1. Figure out when the port was removed. Use this list, or look for the port on freshports, and then copy the last living revision of the port:

    % cd /usr/ports/category
    % svn cp 'svn+ssh://svn.freebsd.org/ports/head/category/portname/@XXXXXX' portname

    Pick the revision that is just before the removal. For example, if the revision where it was removed is 269874, use 269873.

    It is also possible to specify a date. In that case, pick a date that is before the removal but after the last commit to the port.

    % cd /usr/ports/category
    % svn cp 'svn+ssh://svn.freebsd.org/ports/head/category/portname/@{YYYY-MM-DD}' portname
  2. Make the changes necessary to get the port working again. If it was deleted because the distfiles are no longer available, either volunteer to host the distfiles, or find someone else to do so.

  3. If some files have been added, or were removed during the resurrection process, use svn add or svn remove to make sure all the files in the port will be committed.

  4. Restore the SUBDIR listing of the port in the parent directory Makefile, keeping the entries sorted.

  5. Delete the port entry from ports/MOVED.

  6. If the port had an entry in ports/LEGAL, restore it.

  7. svn commit these changes, preferably in one step.

Tip:

The addport script mentioned in Q & A 19.1, “Adding a New Port” now detects when the port to add has previously existed, and attempts to handle all except the ports/LEGAL step automatically.

19.4. Repository Copies

19.4.1. When do we need a repository copy?
19.4.2. What do I need to do?

19.4.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.

19.4.2.

What do I need to do?

With Subversion, a repo copy can be done by any committer:

  • Doing a repo copy:

    1. Verify that the target directory does not exist.

    2. Use svn up to make certain the original files, directories, and checkout information is current.

    3. Use svn move or svn copy to do the repo copy.

    4. Upgrade the copied port to the new version. Remember to add or change the PKGNAMEPREFIX or PKGNAMESUFFIX so there are no duplicate ports with the same name. In some rare cases it may be necessary to change the PORTNAME instead of adding PKGNAMEPREFIX or PKGNAMESUFFIX, 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, adding or changing PKGNAMEPREFIX or PKGNAMESUFFIX should suffice.

    5. 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.

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

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

    8. Commit all changes on one commit.

  • 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 and the old SUBDIR entry.

    3. Add an entry to ports/MOVED.

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

    • 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.

19.5. Ports Freeze

19.5.1. What is a “ports freeze”?

19.5.1.

What is a ports freeze?

A ports freeze was a restricted state the ports tree was put in before a release. It was used to ensure a higher quality for the packages shipped with a release. It usually lasted a couple of weeks. During that time, build problems were fixed, and the release packages were built. This practice is no longer used, as the packages for the releases are built from the current stable, quarterly branch. For more information on how to merge commits to the quarterly branch, see Q: 19.7.5.

19.6. Creating a New Category

19.6.1. What is the procedure for creating a new category?
19.6.2. What do I need to do to implement a new physical category?
19.6.3. What do I need to do to implement a new virtual category?

19.6.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 moves. (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.

19.6.2.

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

  1. Upgrade each moved 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 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 move operation. Hint: do not forget to look at the PKGORIGINs of any slave ports of the ports you just moved!

  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 documentation by modifying the following:

    • the list of categories in the Porter's Handbook

    • doc/en_US.ISO8859-1/htdocs/ports. Note that these are now displayed by sub-groups, as specified in doc/en_US.ISO8859-1/htdocs/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.

  7. 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 done automatically via the change to en_US.ISO8859-1/htdocs/ports/categories and the automated rebuild of INDEX.

19.6.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:

19.7. Miscellaneous Questions

19.7.1. How do I know if my port is building correctly or not?
19.7.2. I added a new port. Do I need to add it to the INDEX?
19.7.3. Are there any other files I am not allowed to touch?
19.7.4. What is the proper procedure for updating the checksum for a port's distfile when the file changes without a version change?
19.7.5. What is the procedure to request authorization for merging a commit to the quarterly branch?

19.7.1.

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

The packages are built multiple times each week. If a port fails, the maintainer will receive an email from [email protected].

Reports for all the package builds (official, experimental, and non-regression) are aggregated at pkg-status.FreeBSD.org.

19.7.2.

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

No. The file can either be generated by running make index, or a pre-generated version can be downloaded with make fetchindex.

19.7.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 their wra(i)th.

19.7.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.

19.7.5.

What is the procedure to request authorization for merging a commit to the quarterly branch?

When doing the commit, add the branch name to the MFH: line, for example:

MFH:	2014Q1

It will automatically notify Ports Security Team and Ports Management Team . They will then decide if the commit can be merged and answer with the procedure.

If the commit has already been made, send an email to Ports Security Team and Ports Management Team with the revision number and a small description of why the commit needs to be merged.

A script is provided to automate merging a specific commit: ports/Tools/scripts/mfh. It is used as follows:

% /usr/ports/Tools/scripts/mfh 2015Q1 380362
 U   2015Q1
Checked out revision 380443.
A    2015Q1/security
Updating '2015Q1/security/rubygem-sshkit':
A    2015Q1/security/rubygem-sshkit
A    2015Q1/security/rubygem-sshkit/Makefile
A    2015Q1/security/rubygem-sshkit/distinfo
A    2015Q1/security/rubygem-sshkit/pkg-descr
Updated to revision 380443.
--- Merging r380362 into '2015Q1':
U    2015Q1/security/rubygem-sshkit/Makefile
U    2015Q1/security/rubygem-sshkit/distinfo
--- Recording mergeinfo for merge of r380362 into '2015Q1':
 U   2015Q1
--- Recording mergeinfo for merge of r380362 into '2015Q1/security':
 G   2015Q1/security
--- Eliding mergeinfo from '2015Q1/security':
 U   2015Q1/security
--- Recording mergeinfo for merge of r380362 into '2015Q1/security/rubygem-sshkit':
 G   2015Q1/security/rubygem-sshkit
--- Eliding mergeinfo from '2015Q1/security/rubygem-sshkit':
 U   2015Q1/security/rubygem-sshkit
 M      2015Q1
M       2015Q1/security/rubygem-sshkit/Makefile
M       2015Q1/security/rubygem-sshkit/distinfo
Index: 2015Q1/security/rubygem-sshkit/Makefile
===================================================================
--- 2015Q1/security/rubygem-sshkit/Makefile     (revision 380443)
+++ 2015Q1/security/rubygem-sshkit/Makefile     (working copy)
@@ -2,7 +2,7 @@
 # $FreeBSD: release/10.2.0/en_US.ISO8859-1/articles/committers-guide/article.xml 46853 2015-06-22 03:26:55Z gjb $

 PORTNAME=      sshkit
-PORTVERSION=   1.6.1
+PORTVERSION=   1.7.0
 CATEGORIES=    security rubygems
 MASTER_SITES=  RG

Index: 2015Q1/security/rubygem-sshkit/distinfo
===================================================================
--- 2015Q1/security/rubygem-sshkit/distinfo     (revision 380443)
+++ 2015Q1/security/rubygem-sshkit/distinfo     (working copy)
@@ -1,2 +1,2 @@
-SHA256 (rubygem/sshkit-1.6.1.gem) = 8ca67e46bb4ea50fdb0553cda77552f3e41b17a5aa919877d93875dfa22c03a7
-SIZE (rubygem/sshkit-1.6.1.gem) = 135680
+SHA256 (rubygem/sshkit-1.7.0.gem) = 90effd1813363bae7355f4a45ebc8335a8ca74acc8d0933ba6ee6d40f281a2cf
+SIZE (rubygem/sshkit-1.7.0.gem) = 136192
Index: 2015Q1
===================================================================
--- 2015Q1      (revision 380443)
+++ 2015Q1      (working copy)

Property changes on: 2015Q1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /head:r380362
Do you want to commit? (no = start a shell) [y/n]

At that point, the script will either open a shell for you to fix things, or open your text editor with the commit message all prepared and then commit the merge.

The script assumes that you can connect to svn.FreeBSD.org with SSH directly, so if your local login name is different than your FreeBSD cluster account, you need a few lines in your ~/.ssh/config:

Host svn.freebsd.org # Can be *.freebsd.org
    User freebsd-login

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <[email protected]>.
Send questions about this document to <[email protected]>.