<?xml version="1.0" encoding="UTF-8"?>
<!-- **************************************************************************
.... For copyright and licensing terms, see the file named COPYING.
.... **************************************************************************
.-->
<?xml-stylesheet href="docbook-xml.css" type="text/css"?>

<refentry id="pkg-gencontrol">

<refmeta xmlns:xi="http://www.w3.org/2001/XInclude">
<refentrytitle>pkg-gencontrol</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">user commands</refmiscinfo>
<refmiscinfo class="source">redo</refmiscinfo>
<xi:include href="version.xml" />
</refmeta>

<refnamediv>
<refname>pkg-gencontrol</refname>
<refpurpose>helper utility for generating pkgng package manifests</refpurpose>
</refnamediv>

<refsynopsisdiv>
<cmdsynopsis>
<command>pkg-gencontrol</command>
<arg choice='req'>
<group choice='plain'>
<arg choice='plain'>--package-name </arg>
<arg choice='plain'>-p </arg>
</group>
<replaceable>package</replaceable>
</arg>
<arg choice='req'>
<group choice='plain'>
<arg choice='plain'>--version </arg>
<arg choice='plain'>-v </arg>
</group>
<replaceable>version</replaceable>
</arg>
<arg choice='opt'>
<group choice='plain'>
<arg choice='plain'>--staging-directory </arg>
<arg choice='plain'>-P </arg>
</group>
<replaceable>staging-directory</replaceable>
</arg>
<arg choice='opt'>
<group choice='plain'>
<arg choice='plain'>--user </arg>
<arg choice='plain'>-u </arg>
</group>
<replaceable>account</replaceable>
</arg>
<arg choice='opt'>
<group choice='plain'>
<arg choice='plain'>--group </arg>
<arg choice='plain'>-g </arg>
</group>
<replaceable>account</replaceable>
</arg>
<arg choice='opt'>--prefix <replaceable>directory</replaceable></arg>
<arg choice='opt'>--origin <replaceable>origin</replaceable></arg>
<arg choice='req'>--comment <replaceable>comment</replaceable></arg>
<arg choice='req'>--description <replaceable>description</replaceable></arg>
<arg choice='opt'>--arch <replaceable>architecture</replaceable></arg>
<arg choice='opt'>--abi <replaceable>abi</replaceable></arg>
<arg choice='opt'>--www <replaceable>URL</replaceable></arg>
<arg choice='opt'>--maintainer <replaceable>maintainer</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>

<refsection><title>Description</title>

<para>
<command>pkg-gencontrol</command> creates a pkgng manifest for the package named <replaceable>package</replaceable>, in a <filename>+MANIFEST</filename> file in <filename><replaceable>staging-directory</replaceable></filename>.
This manifest is used by the <command>create</command> subcommand of <citerefentry><refentrytitle>pkg</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
It is in FreeBSD's Universal Configuration Language format.
</para>

<note>
Older and other package creation tools use the <quote>plist</quote> format for the <filename>+MANIFEST</filename> file, and also require other files named variously <filename>+BUILD_INFO</filename>, <filename>+BUILD_VERSION</filename>, <filename>+COMMENT</filename>, and <filename>+DESC</filename>.
Modern versions of <citerefentry><refentrytitle>pkg</refentrytitle><manvolnum>8</manvolnum></citerefentry> that have switched to UCL take everything, including what was in those other files, from <filename>+MANIFEST</filename>, and that is the only file generated by <command>pkg-gencontrol</command>.
</note>

</refsection>

<refsection><title>Package information settings</title>

<para>
The <arg choice='plain'>--version</arg>, <arg choice='plain'>--comment</arg>, and <arg choice='plain'>--description</arg> arguments set the version, comment, and description information in the manifest.
Because <citerefentry><refentrytitle>pkg</refentrytitle><manvolnum>8</manvolnum></citerefentry> complains about manifests that lack them, they are in effect mandatory, albeit that this is not documented.
The comment is encoded as a UCL string, so should not contain newlines.
If reading it from file, one should use the <arg choice='plain'>-n 1</arg> option to <citerefentry><refentrytitle>head</refentrytitle><manvolnum>1</manvolnum></citerefentry> or something similar.
The description is encoded as a multiple&#x2010;line UCL string, and can contain newlines.
The version is forcibly encoded as a string, to prevent UCL from seeing it as potentially a floating point number.
</para>

<para>
The <arg choice='plain'>--prefix</arg>, <arg choice='plain'>--origin</arg>, <arg choice='plain'>--arch</arg>, <arg choice='plain'>--abi</arg>, <arg choice='plain'>--www</arg>, and <arg choice='plain'>--maintainer</arg> arguments set the prefix, origin, processor architecure, ABI, WWW home page, and maintainer information in the manifest, as displayed by the <command>info</command> subcommand of <citerefentry><refentrytitle>pkg</refentrytitle><manvolnum>8</manvolnum></citerefentry>, and are optional.
The prefix defaults to <filename>/</filename>, and the origin to <filename>local/<replaceable>package</replaceable></filename>.
The others are not written to the manifest if they are not set.
This default of the origin is suitable for locally&#x2010;created packages, but for packages originating from the ports tree the correct origin (the relative subdirectory within the ports tree of the source, which is not necessarily the same as <replaceable>package</replaceable>) should be used.
</para>

</refsection>

<refsection><title>Filesystem sources</title>

<para>
The entire subtree of <filename><replaceable>staging-directory</replaceable></filename> is scanned for files and subdirectories, all of which are included in the manifest, ignoring files at the top level whose names begin with a <quote><filename>+</filename></quote> character, and not following symbolic links.
Their owners and primary groups are ignored, and written to the manifest as owner <code>root</code> and group <code>wheel</code>.
The <arg choice='plain'>--user</arg> and <arg choice='plain'>--group</arg> options allow the owner and primary group of every file and directory entry to be set to <replaceable>account</replaceable> instead.
</para>

<para>
<command>pkg-gencontrol</command> recognizes when the same file has been referenced by multiple hard links, and skips re&#x2010;processing it for hash values.
It does this based upon the device number and inode number of the file, alone.
</para>
<caution>
If the <filename><replaceable>staging-directory</replaceable></filename> tree is being updated as <command>pkg-gencontrol</command> runs, in&#x2010;place modifications will not be recognized.
Only run <command>pkg-gencontrol</command> against a quiescent tree.
</caution>

</refsection>

<refsection><title>See also</title>
<itemizedlist>
<listitem><para>
<citerefentry><refentrytitle>dpkg-gencontrol</refentrytitle><manvolnum>8</manvolnum></citerefentry> &#x2013; which shares the <arg choice='plain'>-v</arg>, <arg choice='plain'>-p</arg>, and <arg choice='plain'>-P</arg> options with this command, but generates different control files for a different package creation tool.
</para></listitem>
</itemizedlist>
</refsection>

<refsection><title>Author</title>
<para><author><personname><firstname>Jonathan</firstname> <surname>de Boyne Pollard</surname></personname></author></para>
</refsection>

</refentry>
