Joel Andres Granados
<jgranado at redhat dot com>

Pungi version -> 0.3.7

This is what I did to add files and/or directories to the tree.

First some background information...
Among all the steps that pungi does to create the tree and the isos, it executes
a step called the doGetRelnotes.  The default behavior of this stage is to look 
for the fedora-release and the fedora-release-notes packages and extract the release
notes, GPG key and other stuff that fedora needs to put in the root directory of the
tree.

Actually this process is managed by three variables that specify three things:
1. the packages to look for in the downloaded repository [1], 2. the directories to
extract from these packages and 3. the files to extract from each package.  The 
variables names are relnotepkgs, relnotedirre and relnotefilere respectfully.  This
information is important because you will need it to specify the behavior of in 
the config file.

For each package that pungi successfully finds in the tree, it runs the rpm2cpio command
and puts all the directories and files of the package in a temporary directory.  This is 
where pungi uses the relnotepkgs variable.  Next, pungi finds all the directories and 
files by using python regular expressions that are defined internally in the program.
These regular expressions are the ones that tell pungi which directories and files to add.
The regular expressions are defined in the relnotedirre and the relnotefilere variables.

With this behavior we can make pungi add some of our own files own directories.  What we
need is 1.one or more rpm packages that have the stuff we want to put in to the installation
tree. 2.we need to put this package of ours into the repository that pungi downloads in the
gather stage [2] and finally we need to define some sort of regular expression to choose our
directories and files.

1.  For the creation of the rpm I have found that the tutorial at http://docs.fedoraproject.org/drafts/rpm-guide-en/ 
    very useful. 

2.  Once you have your rpms you have to tell pungi how to find your them.  In other words, they
    somehow have to be in a repository that pungi recognizes.
    a. Making the repository:
       You must copy all your packages to a repository directory.  After copying all the
       packages you have to run the createrepo command on the directory you selected.
       
       Ex.
       cp myrpm.rpm myrpm2.rpm myrpm3.rpm /path/to/my/rpms
       createrepo /path/to/my/rpms
       
       This command will create a repository that yum understands.  Since pungi
       uses yum for the package gathering stage, this will be enough.

    b. Now we have to show pungi where the newly created repository is.
       You must go to the pungi config directory (/etc/pungi) and edit the file that 
       defines the repositories that pungi is using [3].  A new section must be 
       appended defining where the repository is and if it is going to be active or not.
       The following is added to the end of the file.

       Ex.
       [additionalRepo]
       baseurl=file:///path/to/my/rpms
       enabled=1
       gpgcheck=0

3.  The final step is to define what directories and files you want from the packages.
    you must edit pungis configuration file and add the three variables described at the
    beginning of the document:

    relnotepkgs :   you must list the package names of the packages you want to be considered
                    in the search.[4]
    relnotedirre :  you must list the regular expressions that define what directories you want
                    to include in the root directory.[4]
    relnotefilere : you must list the regular expressions that define what files you want to 
                    include.[4]

       Ex.
       relnotepkgs = myrpm myrpm2 myrpm3
       relnotedirre = dir1 dir4 dir6
       relnotefilere = /^file file.file ending/$ [5]

Finally make tests until you get the desired result.  Don't execute all pungi stages. 
Execute until the buildinstall stage until you see the correct behavior in your tree.[6]


[1] One of the first steps of pungi is to download the packages that are listed in the
    manifest.  Pungi looks for them in repositories that are defined in the config directory
    (/etc/pungi).  The manifest is also located in the pungi config directory.
[2] Pungi is organized in 5 stages. 1. Gather, 2. Buildinstall, 3. Package Order, 4. Splittree
    and 5. Create Isos.  The gather stage is where pungi pulls all the rpm packages from the 
    repositories.
[3] In this version of pungi there are 6 files that specify repositories, just be sure you 
    modify the one you are using.  The used file is defined in the configuration file with
    the yumconf variable.
[4] It is a space separated list of names.
[5] The regular expression characters must be escaped.
[6] To execute until builinstall stage: pungi -c /path/to/config -G -B
