Rpmbuild avec modifications (ajout de patch) : Différence entre versions
m |
m |
||
| Ligne 43 : | Ligne 43 : | ||
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. | 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 | + | ==éditer bash.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: | + | Voir dans le fichier pour un patch existant, il y a 2 entrées, la première déclare le patch, la seconde passe les options de la commande patch par ex: |
$ cd ~/rpmbuild/SPECS/ | $ cd ~/rpmbuild/SPECS/ | ||
| − | $ vi | + | $ vi bash.spec |
... | ... | ||
| − | + | Patch154: histlog.patch | |
... | ... | ||
| − | % | + | %patch154 -p1 -b .histlog |
... | ... | ||
Version du 23 juillet 2018 à 11:09
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 bash.spec et ajouter la définition du nouveau patch
Voir dans le fichier pour un patch existant, il y a 2 entrées, la première déclare le patch, la seconde passe les options de la commande patch par ex:
$ cd ~/rpmbuild/SPECS/ $ vi bash.spec ... Patch154: histlog.patch ... %patch154 -p1 -b .histlog ...
fabriquer le package modifié
$ rpmbuild -ba mypackage.spec