Rpmbuild avec modifications (ajout de patch) : Différence entre versions
m |
m |
||
| Ligne 1 : | Ligne 1 : | ||
Voir https://wiki.centos.org/HowTos/RebuildSRPM . | Voir https://wiki.centos.org/HowTos/RebuildSRPM . | ||
| + | |||
| + | Exemple: recompiler patch bash pour activer SYSLOG_HISTORY: | ||
==installer le rpm source== | ==installer le rpm source== | ||
puis extraire les sources: | puis extraire les sources: | ||
| − | $ rpm -i | + | $ rpm -i bash-4.2.46-30.el7.src.rpm |
$ cd ~/rpmbuild/SPECS/ | $ cd ~/rpmbuild/SPECS/ | ||
| − | rpmbuild -bp mypackage.spec | + | $ rpmbuild -bp mypackage.spec |
==trouver le fichier à modifier== | ==trouver le fichier à modifier== | ||
Dans l'arborescence extraite sous ~/rpmbuild/BUILD/ : | Dans l'arborescence extraite sous ~/rpmbuild/BUILD/ : | ||
$ cd ~/rpmbuild/BUILD/ | $ cd ~/rpmbuild/BUILD/ | ||
| − | $ find . -name | + | $ find . -name config-top.h |
| + | ./bash-4.2/config-top.h | ||
| + | |||
==copier le fichier origine avant de le modifier== | ==copier le fichier origine avant de le modifier== | ||
| − | $ cp | + | $ cp bash-4.2/config-top.h bash-4.2/config-top.h.histlog |
| − | ==modifier le fichier | + | ==modifier le fichier bash-4.2/config-top.h== |
| + | On va décommenter la ligne "/* #define SYSLOG_HISTORY */" et éventuellement modifier SYSLOG_FACILITY/LEVEL. | ||
==créer le fichier de patch avec diff:== | ==créer le fichier de patch avec diff:== | ||
| − | $ diff - | + | $ diffcmd="diff -up bash-4.2/config-top.h.histlog bash-4.2/config-top.h" |
| − | + | $ echo $diffcmd > ../SOURCES/histlog.patch | |
| + | $ $diffcmd >> ../SOURCES/nompatch.patch | ||
| + | $ cat ../SOURCES/nompatch.patch | ||
| + | diff -up bash-4.2/config-top.h.histlog bash-4.2/config-top.h | ||
| + | --- bash-4.2/config-top.h.histlog 2018-07-22 18:16:19.894335183 +0200 | ||
| + | +++ bash-4.2/config-top.h 2018-07-22 18:16:20.085339645 +0200 | ||
| + | @@ -103,10 +103,10 @@ | ||
| + | |||
| + | /* Define if you want each line saved to the history list in bashhist.c: | ||
| + | bash_add_history() to be sent to syslog(). */ | ||
| + | -/* #define SYSLOG_HISTORY */ | ||
| + | +#define SYSLOG_HISTORY | ||
| + | #if defined (SYSLOG_HISTORY) | ||
| + | -# define SYSLOG_FACILITY LOG_USER | ||
| + | -# define SYSLOG_LEVEL LOG_INFO | ||
| + | +# define SYSLOG_FACILITY LOG_LOCAL6 | ||
| + | +# define SYSLOG_LEVEL LOG_DEBUG | ||
| + | #endif | ||
| + | |||
| + | /* Define if you want to include code in shell.c to support wordexp(3) */ | ||
| + | |||
| + | Nota: les 3 premières lignes sont nécessaires à patch pour retrouver le fichier à patcher (cf man patch et options passées dans le fichier spec ci-dessous, notamment le nombre de / avec -p1). A noter: patch va chercher le nom du fichier dans la 3eme ligne. | ||
==éditer mypackage.spec et ajouter la définition du nouveau patch == | ==éditer mypackage.spec et ajouter la définition du nouveau patch == | ||
Version du 23 juillet 2018 à 10:00
Voir https://wiki.centos.org/HowTos/RebuildSRPM .
Exemple: recompiler patch bash pour activer SYSLOG_HISTORY:
Sommaire
installer le rpm source
puis extraire les sources:
$ rpm -i bash-4.2.46-30.el7.src.rpm $ cd ~/rpmbuild/SPECS/ $ rpmbuild -bp mypackage.spec
trouver le fichier à modifier
Dans l'arborescence extraite sous ~/rpmbuild/BUILD/ :
$ cd ~/rpmbuild/BUILD/ $ find . -name config-top.h ./bash-4.2/config-top.h
copier le fichier origine avant de le modifier
$ cp bash-4.2/config-top.h bash-4.2/config-top.h.histlog
modifier le fichier bash-4.2/config-top.h
On va décommenter la ligne "/* #define SYSLOG_HISTORY */" et éventuellement modifier SYSLOG_FACILITY/LEVEL.
créer le fichier de patch avec diff:
$ diffcmd="diff -up bash-4.2/config-top.h.histlog bash-4.2/config-top.h"
$ echo $diffcmd > ../SOURCES/histlog.patch
$ $diffcmd >> ../SOURCES/nompatch.patch
$ cat ../SOURCES/nompatch.patch
diff -up bash-4.2/config-top.h.histlog bash-4.2/config-top.h
--- bash-4.2/config-top.h.histlog 2018-07-22 18:16:19.894335183 +0200
+++ bash-4.2/config-top.h 2018-07-22 18:16:20.085339645 +0200
@@ -103,10 +103,10 @@
/* Define if you want each line saved to the history list in bashhist.c:
bash_add_history() to be sent to syslog(). */
-/* #define SYSLOG_HISTORY */
+#define SYSLOG_HISTORY
#if defined (SYSLOG_HISTORY)
-# define SYSLOG_FACILITY LOG_USER
-# define SYSLOG_LEVEL LOG_INFO
+# define SYSLOG_FACILITY LOG_LOCAL6
+# define SYSLOG_LEVEL LOG_DEBUG
#endif
/* Define if you want to include code in shell.c to support wordexp(3) */
Nota: les 3 premières lignes sont nécessaires à patch pour retrouver le fichier à patcher (cf man patch et options passées dans le fichier spec ci-dessous, notamment le nombre de / avec -p1). A noter: patch va chercher le nom du fichier dans la 3eme ligne.
éditer mypackage.spec et ajouter la définition du nouveau patch
Voir dans le fichier pour un patch existant, il y a 2 entrées, par ex:
$ cd ~/rpmbuild/SPECS/ $ vi mypackage.spec ... Patch153: log2syslog.patch ... %patch153 -p1 -b .log2syslog ...
fabriquer le package modifié
$ rpmbuild -ba mypackage.spec