|
1 | | -dnf-plugin-diff - compare package contents against local changes |
2 | | -================================================================ |
| 1 | +dnf-plugin-diff - show local changes in RPM packages |
| 2 | +==================================================== |
3 | 3 |
|
4 | | -Typical use-case: |
| 4 | +It is often very convenient to edit files installed/tracked by RPM - |
| 5 | +typically to hot-fix a source code on production system, or change the |
| 6 | +default configuration files. |
5 | 7 |
|
6 | | -$ echo '# some change' >> \ |
7 | | - /usr/lib/python3.6/site-packages/dnf-plugins/diff.py |
8 | | -$ dnf diff dnf-plugin-diff |
9 | | -Last metadata expiration check: 0:04:12 ago on Mon 03 Sep 2018 05:12:09 PM CEST. |
10 | | ---- /usr/lib/python3.6/site-packages/dnf-plugins/diff.py 2018-09-03 16:41:36.000000000 +0200 |
11 | | -+++ /usr/lib/python3.6/site-packages/dnf-plugins/diff.py 2018-09-03 17:16:17.476547131 +0200 |
12 | | -@@ -96,3 +96,5 @@ |
13 | | - else: |
14 | | - self._diff_package(pkg, check_pkg, |
15 | | - self._list_of_changed_files(check_pkg)) |
16 | | -+ |
17 | | -+# some change |
| 8 | +It is easy to detect what files have been changed in particular installed |
| 9 | +RPM package (`$ rpm -V PACKAGE` helps here), but it was a pretty laborious |
| 10 | +job to print the actual changes (diff). You had to a) download the |
| 11 | +original RPM package, b) extract the package somewhere, c) detect what |
| 12 | +files have actually been changed on the system and d) manually diff the |
| 13 | +extracted files against the changed files installed on the system. This |
| 14 | +is where the simple helper `dnf-plugin-diff` steps in. |
| 15 | + |
| 16 | + |
| 17 | +Options/usage |
| 18 | +------------- |
| 19 | + |
| 20 | +$ dnf diff PKG [FILE [FILE ...]] |
| 21 | + |
| 22 | +Diff original <PKG> contents against the locally changed files. By |
| 23 | +default - `dnf diff` prints (to stdout) complete changes. Optionally the |
| 24 | +output can be filtered by <FILE> arguments. |
| 25 | + |
| 26 | + |
| 27 | +Typical use-case |
| 28 | +---------------- |
| 29 | + |
| 30 | +I recall I changed a configuration of my `cgit` service, so I check what |
| 31 | +configuration files I changed: |
| 32 | + |
| 33 | + $ rpm -V cgit |
| 34 | + S.5....T. c /etc/cgitrc |
| 35 | + S.5....T. c /etc/httpd/conf.d/cgit.conf |
| 36 | + |
| 37 | +But to see what has actually been change, I can do: |
| 38 | + |
| 39 | + $ dnf diff cgit /etc/httpd/conf.d/cgit.conf |
| 40 | + --- /etc/httpd/conf.d/cgit.conf 2018-08-18 03:31:33.000000000 +0200 |
| 41 | + +++ /etc/httpd/conf.d/cgit.conf 2018-12-15 10:27:23.310626910 +0100 |
| 42 | + @@ -1,5 +1,5 @@ |
| 43 | + Alias /cgit-data /usr/share/cgit |
| 44 | + ScriptAlias /cgit /var/www/cgi-bin/cgit |
| 45 | + -<Directory "/usr/share/cgit"> |
| 46 | + +<Directory "/data/cgit"> |
| 47 | + Require all granted |
| 48 | + </Directory> |
18 | 49 |
|
19 | 50 |
|
20 | 51 | How to install |
21 | 52 | -------------- |
22 | 53 |
|
23 | | -$ dnf copr enable praiskup/dnf-plugin-diff |
24 | | -$ dnf install dnf-plugins-diff |
| 54 | +Temporarily, it's built only in copr: |
| 55 | + |
| 56 | + $ dnf copr enable praiskup/dnf-plugin-diff |
| 57 | + |
| 58 | +Execute: |
| 59 | + |
| 60 | + $ dnf diff ... |
| 61 | + No such command: diff. Please use /usr/bin/dnf --help |
| 62 | + It could be a DNF plugin command, try: "dnf install 'dnf-command(diff)'" |
| 63 | + $ sudo dnf install 'dnf-command(diff)' |
| 64 | + |
| 65 | + |
| 66 | +Build from source |
| 67 | +----------------- |
| 68 | + |
| 69 | + $ autoreconf -vfi |
| 70 | + $ ./configure --prefix=/usr |
| 71 | + $ sudo make install |
| 72 | + |
25 | 73 |
|
26 | | -or build from source: |
| 74 | +Build RPM from source |
| 75 | +--------------------- |
27 | 76 |
|
28 | | -$ autoreconf -vfi && ./configure --prefix=/usr && sudo make install |
| 77 | +Run `make dist` and use *.tar.gz file with rpm/*.spec file. |
0 commit comments