Tue, 19 Dec 2006

Writing man pages

On a Debian system, install the following using apt-get:

    asciidoc
    xmlto

Write your man page using asciidoc.  The asciidoc homepage can be found at:

    http://www.methods.co.nz/asciidoc/

where you can also find a user manual which will show examples
on usage.

When writing your man page, start by usng the ascii.1.txt page in 
/usr/share/doc/asciidoc as an example.  Copy this file to your
working area and edit it appropriately.  Once your page is written, 
run the following command:

    asciidoc -v --doctype=manpage --backend=docbook  photon.1.txt

This produces a photon.1.xml file.  Next run this command:

    xmlto man photon.1.xml

This produces a photon.1 man page.

Check photon.1 for small corrections.  It seems to add in extra .sp tags.

Preview your new man page by running this command:

    man ./photon.1

Posted at: 09:10 | category: /dev | Comments ()

Sat, 25 Nov 2006

patch and diff

To create a patch against the most current development version when using SVN:

    svn diff > /path/to/patchfile.diff

For an individual file within SVN:

    svn diff changedfilename > /path/to/patchfile.diff

To create a patch when you are not using SVN:

    diff -Naur oldfile newfile > /path/to/patchfile.diff

    Note also the option -x to exclude files ... for example

        -x '*.po'     can be added to exclude all .po files

To apply a patch:

    patch --verbose [-p0] < /path/to/patchfile.diff

    where -p0 represents how much of the leading path will be dropped off
        -p0 = nothing is removed from the path
        -p1 = the leading '/' will be removed => path/to/patchfile.diff
        -p2 => to/patchfile.diff
        -p3 => patchfile.diff

More info can be found in the patch and diff man pages.  Note that there is a
section at the botton of the patch man that specifically discusses patch
creation.

Posted at: 07:53 | category: /dev | Comments ()

Thu, 10 Aug 2006

Subversion: new project/repository configuration and some basic commands

As root:
    svn mkdir /var/svn/repo/newproject
    chown -R myUser:svnusers /var/svn/repo/newproject
    (presumes you have a svnusers group)

As a user/owner (myUser) of the newproject:
    svnadmin create /var/svn/repo/newproject

As root:
    chown -R myUser:svnusers /var/svn/repo/newproject
    chmod 664 /var/svn/repo/newproject/db/*

As a user/owner (myUser) of the newproject:
    cd /tmp
    mkdir -p newproject/trunk
    mkdir -p newproject/branches
    mkdir -p newproject/tags

    cd /tmp/newproject/trunk
    cp -pvr /home/newproject/www .

    svn import /tmp/newproject file:///var/svn/repo/newproject -m "initial import"

    cd /tmp
    rm -rf newproject/

To verify results of the import:

    svn list --verbose file:///var/svn/repo/newproject

To export the project without .svn files

    cd [to target export directory]
    svn export file:///var/svn/repo/newproject/trunk/www [option name]

To checkout the project with .svn files

    cd [to target working copy directory]
    svn checkout file:///var/svn/repo/newproject/trunk/www [option name]

svn status [file:///var/svn/repo/newproject]
    prints the status of working copy files and directories

svn diff
    shows changes to the working copy

svn update [file:///var/svn/repo/newproject]
    brings changes from the repository to your working copy
        A == added
        D == deleted
        U == updated
        C == conflict
        G == merged

svn add PATH
    adds files/directories to your working copy and schedules them for
    addition to the repository.  will be uploaded and added to the repository
    during the next commit.  when adding a directory, the default behavior is
    to recurse

svn delete PATH
    schedules PATH for deletion on the next commit.  if PATH is a URL, it will
    immediately delete and a log message must be supplied.  

svn copy SRC DST
    copy a file/directory in your working copy or repository.

svn move SRC DST
    move a file/directory in your working copy or repository.  equivalent to
    svn copy/svn delete.  

    example:  svn move foo.c bar.c

svn commit [--message] [PATH]
    sends changes from working copy to the repository.  alias == ci.

    example:  svn commit -F message foo.c
        this only commits the foo.c file and a message

    svn commit without any args will commit everything

svn log [PATH]
    display all of the commit messages

Posted at: 21:27 | category: /dev | Comments ()

qmake - compiling

To compile a C++ application you need to create a makefile. The easiest way to
create a makefile is to use the qmake build tool supplied with Qt. If you've
saved main.cpp in its own directory, all you have to do is: 

qmake -project -o main.pro      // this creates a project file main.pro

qmake                           // this creates the Makefile

make                            // this creates the executable

The first command tells qmake to create a .pro (project) file. The second
command tells it to create a (platform-specific) makefile based on the project
file. You should now be able to type make (or nmake if you're using Visual
Studio).

Posted at: 21:27 | category: /dev | Comments ()

Important pbuilder commands

sudo pbuilder create --distribution sarge
sudo pbuilder update --override-config --distribution sid

pdebuild
   // run this in the directory with source files (above debian/)
   // it builds a deb in /var/cache/pbuilder/results

note that presently pbuilder (sid) uses gcc-4.0 and g++-4.0, which may not be
appropriate for your package.

sudo pbuilder clean

------

piuparts - to check for proper dependencies and whether package install
properly in unstable after completing the build process

cd to the source build directory (above debian/)

    piuparts ../bbmail-0.8.3_i386.deb

------

Building the final package:

// check which complier is default

cd to the source build directory (above debian/)

    dpkg-buildpackage -rfakeroot -k8CE11941

Posted at: 21:27 | category: /dev | Comments ()