Rpmbuild avec modifications (ajout de patch) : Différence entre versions
(Page créée avec « Voir https://wiki.centos.org/HowTos/RebuildSRPM . # installer le rpm source, puis extraire les sources: $ rpm -i mypackage.src.rpm $ cd ~/rpmbuild/SPECS/ rpmbuild... ») |
m |
||
| (8 révisions intermédiaires par le même utilisateur non affichées) | |||
| 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 (sans possibilit2 de desactiver par shopt): | |
| − | $ rpm -i | + | |
| + | ==installer le rpm source== | ||
| + | puis extraire les sources: | ||
| + | $ rpm -i bash-4.2.46-34.el7.src.rpm | ||
$ cd ~/rpmbuild/SPECS/ | $ cd ~/rpmbuild/SPECS/ | ||
| − | rpmbuild -bp | + | $ rpmbuild -bp bash.spec |
| − | + | ||
| + | ==trouver le fichier à modifier== | ||
| + | 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 | |
| − | $ cp | + | |
| − | + | ==copier le fichier origine avant de le modifier== | |
| − | # créer le fichier de patch avec diff: | + | $ cp bash-4.2/config-top.h bash-4.2/config-top.h.histlog |
| − | $ diff - | + | ==modifier le fichier bash-4.2/config-top.h== |
| − | # éditer | + | On va décommenter la ligne "/* #define SYSLOG_HISTORY */", commenter la ligne "#define SYSLOG_SHOPT 0" 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/histlog.patch | ||
| + | $ cat ../SOURCES/histlog.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 syslogging history to be controllable at runtime via a | ||
| + | shell option; if defined, the value is the default for the syslog_history | ||
| + | shopt option */ | ||
| + | #if defined (SYSLOG_HISTORY) | ||
| + | -#define SYSLOG_SHOPT 0 | ||
| + | +/*#define SYSLOG_SHOPT 0*/ | ||
| + | #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/ | $ cd ~/rpmbuild/SPECS/ | ||
| − | $ vi | + | $ vi bash.spec |
... | ... | ||
| − | + | Patch154: histlog.patch | |
... | ... | ||
| − | % | + | %patch154 -p1 -b .histlog |
... | ... | ||
| − | + | ==fabriquer le package modifié== | |
| − | $ rpmbuild -ba | + | $ rpmbuild -ba bash.spec |
| + | |||
| + | [[Category:Redhat]] | ||
| + | [[Category:RPM]] | ||
Version actuelle datée du 24 avril 2020 à 12:30
Voir https://wiki.centos.org/HowTos/RebuildSRPM .
Exemple: recompiler patch bash pour activer SYSLOG_HISTORY (sans possibilit2 de desactiver par shopt):
Sommaire
installer le rpm source
puis extraire les sources:
$ rpm -i bash-4.2.46-34.el7.src.rpm $ cd ~/rpmbuild/SPECS/ $ rpmbuild -bp bash.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 */", commenter la ligne "#define SYSLOG_SHOPT 0" 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/histlog.patch
$ cat ../SOURCES/histlog.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 syslogging history to be controllable at runtime via a
shell option; if defined, the value is the default for the syslog_history
shopt option */
#if defined (SYSLOG_HISTORY)
-#define SYSLOG_SHOPT 0
+/*#define SYSLOG_SHOPT 0*/
#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 bash.spec