-
Notifications
You must be signed in to change notification settings - Fork 0
/
apply_patch_using_upkg_howto.html
167 lines (148 loc) · 7.5 KB
/
apply_patch_using_upkg_howto.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<h2>Abstract</h2>
This howto should help you to get a patch applied to a source package using <a href="http://www.upkg.org/">upkg</a>. Upkg is the package management and build system used in the <a href="http://www.paldo.org/">Paldo Linux distribution</a>.
<h2>A concrete problem</h2>
I have a PCI TV card in my paldo workstation. Unfortunately there is no standalone gnome tv application in the the paldo main repository.
(I don't want do use MythTV only for watching TV) Thus I decided to build <a href="http://zapping.sourceforge.net/">zapping</a> from source.
Sadly I got the following error during "make".
<br>
<br>
<div style="border: 1px dotted rgb(87, 135, 184); background-color: rgb(186, 213, 224);">
<!-- http://aktuell.de.selfhtml.org/tippstricks/cgiperl/html-in-html/ -->
<pre>
In file included from io-v4l2k.c:55:
videodev2k.h:19:46: error: linux/compiler.h: No such file or directory
make[4]: *** [io-v4l2k.lo] Error 1
make[4]: Leaving directory `/home/nicolas/temp/zvbi-0.2.19.orig/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/nicolas/temp/zvbi-0.2.19.orig/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/nicolas/temp/zvbi-0.2.19.orig/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/nicolas/temp/zvbi-0.2.19.orig'
make: *** [all] Error 2</pre>
</div>
<br />
<br />
An easy workaround was to comment out the line, which included <b>linux/compiler.h</b>.
However we would like to upload upstream source packages into the paldo repository. That's why upkg is able to apply
a patch during the build process. Read on to find out how you can create a patch and apply it to a upkg spec file.
<br />
<br />
Read the <a href="http://www.paldo.org/index-section-support-page-howtos-howto-packagebuild.html">package build howto</a> if you want to get an overview of how upkg works.
<h2>Create the diff file</h2>
First download the upstream source package of your application and untar/unzip it.
I add the suffix ".orig" to the folder and make a copy of the whole folder without this suffix. My directory now looks like:
<br />
<br />
<div style="border: 1px dotted rgb(87, 135, 184); background-color: rgb(186, 213, 224);">
<!-- http://aktuell.de.selfhtml.org/tippstricks/cgiperl/html-in-html/ -->
<pre>
[nicolas@gandalf:~/temp]$ ls -la
[...]
drwxr-xr-x 9 nicolas users 4096 2006-03-29 17:01 zvbi-0.2.19
drwxr-xr-x 9 nicolas users 4096 2006-03-29 17:03 zvbi-0.2.19.orig</pre>
</div>
<br />
<br />
Now change into the work-folder (the one without the suffix) and fix the bug(s).
After this is done. Leave the work-folder and create a diff-file using the diff command.
In my example I had to change the file <b>videodev2k.h</b> which could be found in the <b>src</b> folder in <b>my work-folder</b> (zvbi-0.2.19/src/videodev2k.h).
Now I created a diff-file using the following command:
<br />
<br />
<div style="border: 1px dotted rgb(87, 135, 184); background-color: rgb(186, 213, 224);">
<!-- http://aktuell.de.selfhtml.org/tippstricks/cgiperl/html-in-html/ -->
<pre>
[nicolas@gandalf:~/temp]$ diff zvbi-0.2.19.orig/src/videodev2k.h zvbi-0.2.19/src/videodev2k.h > zvbi-0.2.19-compiler.h-1.patch</pre>
</div>
<br />
<br />
If you changed multiple source files, repeat this step for all the other files you have changed.
<br />
<br />
<h2>Compress the file</h2>
Now use <b>bzip2</b> to compress your patch(es) then copy the original (upstream) source package and the compressed patch file into your repository.
My repository folder then looks like:
<br />
<br />
<div style="border: 1px dotted rgb(87, 135, 184); background-color: rgb(186, 213, 224);">
<!-- http://aktuell.de.selfhtml.org/tippstricks/cgiperl/html-in-html/ -->
<pre>
[nicolas@gandalf:~/]$ ls -la PaldoRepo/sources/zvbi-0.2/
[...]
-rw-r--r-- 1 nicolas users 344 2006-03-29 16:30 zvbi-0.2.19-compiler.h-1.patch.bz2
-rw-r--r-- 1 nicolas users 722143 2006-03-29 15:55 zvbi-0.2.19.tar.bz2</pre>
</div>
<br />
<br />
<h2>Inform upkg about the patch</h2>
Now create a upkg spec file (as described in the <a href="http://www.paldo.org/index-section-support-page-howtos-howto-packagebuild.html">package build howto</a>).<br />
The important part is adding a <b>patch-directive</b> between the <b>archive- tag</b> (<patch name="zvbi-0.2.19-compiler.h-1"/>).
As you can see, you dont have to add the ".patch.bz2" suffix. In this case upkg would search for a file called <b>zvbi-0.2.19-compiler.h-1.patch.bz2</b> and automatically
apply it during the build process.
<br />
<br />
<div style="border: 1px dotted rgb(87, 135, 184); background-color: rgb(186, 213, 224);">
<pre> <?xml version="1.0"?>
<package name="zvbi-0.2">
<description>the vertical blanking interval (VBI) library</description>
<releases>
<release version="0.2.19" revision="1" branch="testing">
<deps>
<dep name="libpng"/>
</deps>
<build>
<script>
<archive name="zvbi-$VERSION">
<patch name="zvbi-$VERSION-compiler.h-1"/>
<cmd>
./configure --prefix=/usr
--infodir=/usr/share/info
--mandir=/usr/share/man
--sysconfdir=/etc
--enable-nss=no
</cmd>
<cmd>make -j 2</cmd>
<cmd>make install</cmd>
</archive>
</script>
</build>
</release>
</releases>
</package></pre>
</div>
<br />
<br />
<h2>Start compiling and installation</h2>
Now you're ready to compile and install your application. The patch will automatically be added during this process. The following command will invoke everything:
<br>
<br>
<div style="border: 1px dotted rgb(87, 135, 184); background-color: rgb(186, 213, 224);">
<pre> [root@gandalf:~]# upkg-build zvbi-0.2
Generating script...
Writing script...
Executing script...
The following extra packages will be installed:
zvbi-0.2
The following packages will be built from source:
zvbi-0.2
Do you want to continue? [Y/n]
Building zvbi-0.2-0.2.19-1 (testing)...
[root@gandalf:~]#</pre>
</div>
<br>
<br>
If you want to see verbose output, you can pass <b>--verbose</b> to upkg-build:
<br>
<br>
<div style="border: 1px dotted rgb(87, 135, 184); background-color: rgb(186, 213, 224);">
<pre> [root@gandalf:~]# upkg-build --verbose zvbi-0.2</pre>
</div>
<br>
<br>
You should now be able to run your application.
<br>
<br>
<h2>Log Files of upkg-build</h2>
If you want to see, what upkg exactly did, take a look at <b>/var/lib/upkg/logs/PACKAGE-VERSION.log.bz2</b>.
In my case I see all the steps upkg took in <b>/var/lib/upkg/logs/zvbi-0.2-x86-glibc-2.4-gcc-4.1-1-0.2.19-1.log.bz2</b>