:: Re: [DNG] etckeeper: was: Er, Not …
Top Pagina
Delete this message
Reply to this message
Auteur: Olaf Meeuwissen
Datum:  
Aan: wirelessduck
CC: dng
Onderwerp: Re: [DNG] etckeeper: was: Er, Not that way ? .Re: Announcing Devuan 4.0: Chimaera!
Hi wirelessduck,

wirelessduck@??? writes:

>> On 21 Oct 2021, at 22:47, Olaf Meeuwissen <paddy-hack@???> wrote:
>>
>> Hi wirelessduck,
>>
>> wirelessduck--- via Dng writes:
>>
>>>>> On 20 Oct 2021, at 20:45, Olaf Meeuwissen via Dng <dng@???> wrote:
>>>>
>>>> I really looked into snapshotting but the etckeeper commit messages also
>>>> list which packages changed, like so (after I "beautified" the logging a
>>>> bit to suit my taste and needs)
>>>>
>>>> commit dd9602a525e590f24ec19904248938e6ab76e999 (HEAD -> master)
>>>> Author: olaf <olaf@quark>
>>>> Date: Mon Oct 11 21:48:25 2021 +0900
>>>>
>>>>     Committing changes in /etc after APT run

>>>>
>>>>     Package changes:
>>>>     - debconf 1.5.71 all
>>>>     + debconf 1.5.71+deb10u1 all
>>>>     - libgssapi-krb5-2 1.17-3+deb10u2 amd64
>>>>     + libgssapi-krb5-2 1.17-3+deb10u3 amd64
>>>>     - libk5crypto3 1.17-3+deb10u2 amd64
>>>>     + libk5crypto3 1.17-3+deb10u3 amd64
>>>>     - libkrb5-3 1.17-3+deb10u2 amd64
>>>>     + libkrb5-3 1.17-3+deb10u3 amd64
>>>>     - libkrb5support0 1.17-3+deb10u2 amd64
>>>>     + libkrb5support0 1.17-3+deb10u3 amd64
>>>>     - libmariadb3 1:10.3.29-0+deb10u1 amd64
>>>>     + libmariadb3 1:10.3.31-0+deb10u1 amd64

>>>>
>>>> which gives me a chance to pinpoint any culprits and submit bug reports
>>>> if necessary with detailed info on the changed packages.
>>>
>>> Is this formatting configured in etckeeper or gitconfig? I would like
>>> to try and replicate. It looks very useful.
>>
>> TL;DR: in etckeeper.
>>
>> The etckeeper utility does a good job of collecting the package changes
>> out-of-the-box but the exact output is slightly different from what I
>> included above. The out-of-the-box behaviour includes the output of
>>
>> diff -U0 $before $after | egrep '^[-+]'
>>
>> where $before and $after are "files" with the output of
>>
>>  dpkg-query -W -f '${Status}\t${Package} ${Version}\n' | \
>>          egrep '(ok installed|ok config-files)' | cut -f2,3

>>
>> I've tweaked that a bit to insert a space after the '^[-+]' and run the
>> diff output through `sort -k2` so I get the before and after package
>> info closer together. I've also made a few very minor changes to start
>> the message with a capital and capitalized APT.
>>
>> Without my changes, the above would have looked something like
>>
>> commit dd9602a525e590f24ec19904248938e6ab76e999 (HEAD -> master)
>> Author: olaf <olaf@quark>
>> Date: Mon Oct 11 21:48:25 2021 +0900
>>
>>      committing changes in /etc after apt run

>>
>>      Package changes:
>>      -debconf 1.5.71 all
>>      +debconf 1.5.71+deb10u1 all
>>      -libgssapi-krb5-2 1.17-3+deb10u2 amd64
>>      +libgssapi-krb5-2 1.17-3+deb10u3 amd64
>>      -libk5crypto3 1.17-3+deb10u2 amd64
>>      -libkrb5-3 1.17-3+deb10u2 amd64
>>      -libkrb5support0 1.17-3+deb10u2 amd64
>>      +libk5crypto3 1.17-3+deb10u3 amd64
>>      +libkrb5-3 1.17-3+deb10u3 amd64
>>      +libkrb5support0 1.17-3+deb10u3 amd64
>>      -libmariadb3 1:10.3.29-0+deb10u1 amd64
>>      +libmariadb3 1:10.3.31-0+deb10u1 amd64

>>
>> BTW, the version in chimaera (and later) also includes a section that
>> lists the packages with configuration changes and includes the command
>> line invocation that triggered the changes.
>>
>> Oh, I've also made a few changes to record package changes if nothing
>> below /etc has changed.
>>
>> Hope this helps,
>
> Many thanks.
>
> I think the piping to sort alone is good enough that it should be
> implemented upstream. I wonder if there is any special ordering to the
> original non-sorted output as I can’t now see why you would want it
> unsorted?


The piping to sort relies on inserting a space. Without the space,
you'd be sorting on package version numbers, doh!, but yes, trying to
get this included upstream might be a good idea.

# `dpkg-query -W` already sorts on package name. It's just that diff
# only looks at what it gets. The `sort` I added is after the egrep.

Hope this helps,
--
Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
 GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
 Support Free Software                        https://my.fsf.org/donate
 Join the Free Software Foundation              https://my.fsf.org/join