Chapter 28. Applying a patch

Pre-process patchfile

Patches can be specific to a single version of eCosPro or can be applicable to a number of versions. If a patch is specific to a single version, the patchfile provided should already be directed at that specific version and will not require pre-processing.

If a patchfile is intended to be applied against a number of different versions of eCosPro you will need to pre-process the patchfile to create a new patchfile that is specific to your version. This is because the naming convention of directories used by CDL (see Chapter 22) includes the version number of individual packages, and patchfiles include the path to the files which are to be changed. As the naming convention for versions used is simple and the path names of files can be simply changed within the patchfile, a generic patchfile directed at the version "patchfile" is usually provided rather than providing a patchfile for each version of eCosPro affected.

To pre-process the patchfile, open a command prompt with the "Shell Environment" shortcut in the eCosPro group and change to the directory that contains the downloaded patchfile. Then run the command below replacing X, Y and Z below with the major, minor and sub-minor version numbers of your release respectively. For example, for eCosPro version 3.1.15 the major version number is 3, the minor version is 1, and the sub-minor version number is 15.

Figure 28-1. Pre-process patch on Linux

test@ubuntu:~$ cd /tmp/download
test@ubuntu:/tmp/download$ sed 's@/current/@/vX_Y_Z/@' < issue-1001234.pat > issue-1001234-new.pat

Figure 28-2. Pre-process patch on Windows

C:\> cd C:\TEMP
C:\TEMP> sed 's@/current/@/vX_Y_Z/@' < issue-1001234.pat > issue-1001234-new.pat

For example, use v3_1_15 for version 3.1.15, v3_1_3 for version 3.1.3 and so on.

Figure 28-3. Example of the pre-process of a patch on Linux for version 3.1.15

test@ubuntu:~$ cd /tmp/download
test@ubuntu:/tmp/download$ sed 's@/current/@/v3_1_15/@' < issue-1001234.pat > issue-1001234-new.pat
Documentation license for this page: eCosPro License