Samba 3.0.22 Porting by Vidya Sagar

15
Now you should have a file named samba-3.0.22.tar. Typical uncompressed tarballs are created with relative
pathnames and will eventually restore files relative to the current working directory. It is usually a good idea to
know in advance what is the content of tarball and that can be achieved by issuing tar –tvf <package.tar>
which reveals the directory structure to be created and files it contains. Next is to extract the contents of tarball.
Shell/iX> tar –xvf samba-3.0.22.tar
The directory samba-3.0.22 just extracted as the result of executing tar command, contains the entire source tree.
It is good idea to have a count of all the files inside it, so that you can track the files changed for MPE/iX. Use
command ls –ltR | wc –l to get the total number of files inside source tree. In order to differentiate between
the vanilla and mpe source directory, it is a good practice to maintain two source directories vanialla(original) and
mpe(modified source tree for MPE/iX). You should rename the vanilla source directory by appending –mpe into
that i.e. for Samba rename samba-3.0.22 to samba-3.0.22-mpe. Now the source tree is ready to accommodate
the changes with respect to MPE/iX. Later on completion of port you need to evaluate source diff of the vanilla
and mpe source directory to ease the future refresh. More about source diff and how to apply them in a port
refresh is coming up in next section.
3.4 Applying source patches
Patches are nothing but the “diff” of two source tree. Conventionally a bug fix is released by means of source
code patch. Whoever wants to incorporate that fix needs to apply the patch into the already existing source code
using well known GNU command patch. For the ease of future porters MPE/iX leveraged this strategy.
The first step in building a new release of Samba on MPE is to apply the MPE source diff from the previous
version of Samba that is currently running on MPE/iX. The diff file essentially tells how to transform the files in first
directory tree to match the files in the second directory tree. The previous version source diff are conventionally
named diff-<prev-version>-mpe.txt and placed in /$HPACCOUNT/$HPGROUP/src/ directory.
To modify a vanilla Samba source tree with an MPE diff file, we execute the GNU patch program as shown below:
shell/iX> cd mpe-source-dir
shell/iX> /usr/local/bin/patch -p1 -i /path/to/diff.txt
That is, in order to build Samba-3.0.22, apply the diff file of last ported version of samba which is diff-2.2.8a-
mpe.txt as shown below:
shell/iX> cd /SAMBA/SMB3022/src/samba-3.0.22-mpe
shell/iX> /usr/local/bin/patch -p1 -i /SAMBA/SMB228A/src/diff-2.2.8a-mpe.txt
The patch program will then use the diff file to modify the source files in the vanilla-source-dir directory. The -p1
option says to strip the first pathname component from each entry in the diff file before trying to find a matching
file in the current source directory. The -i option gives the path to the input diff file.
The patch program will tell you whether or not each source file referenced in the diff file were successfully
modified. For files that cannot be modified, i.e. the new version of Samba is too different from the previous
version used to produce the diff file, reject files named *.rej will be created in the corresponding directory
containing the diff modifications that could not be applied.
For each *.rej file you will need to investigate the corresponding source code file and manually make the
modifications needed to get that code to run on MPE/iX.
The same procedure can be used to apply a patch (bug fix) released by Samba organization. You should apply
the patch on vanilla source tree, followed by applying the bug-fix and finally apply the source diff of previous
ported version.
It is encouraged to take a source code diff once you finish the port by the GNU diff program as shown below and
keep them in /$HPACCOUNT/$HPGROUP/src directory:
shell/iX> /usr/local/bin/diff -ruN samba-vanilla-sourcedir samba-mpe-sourcedir >/path/to/diff.txt
For example following steps apply diff for Samba-3.0.22: