[Bug 252132] mergemaster: needs to cope with empty $FreeBSD$ tags or /etc files must have $FreeBSD: number$

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Feb 12 03:37:25 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252132

Katsuyuki Miyoshi <katsubsd at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |katsubsd at gmail.com

--- Comment #3 from Katsuyuki Miyoshi <katsubsd at gmail.com> ---
Created attachment 222381
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=222381&action=edit
id_tools.tar.gz

This is my personal solution.

My solution is to replace "$FreeBSD$" with "$FreeBSD: MD5 $".
(MD5 is the MD5 checksum of the source file.)

"$FreeBSD: MD5 $" is not the original "$FreeBSD$" format, but it is useful
enough for mergemaster.

I'm happy with these. However, I don't know if these are enough for everyone
who does various tasks. And, I don't even know what will happen to "$FreeBSD$"
in the future.

I hope that a better response will be made.

Here are the steps:

===========================================================================
[Provides 3 files]
 replace_id.sh: This is a script that replaces "$FreeBSD ... $" in files
installed by "make distribution" with "$FreeBSD: MD5 $".

 src_id.sh: This is a git filter script.

 post-commit: This is a git hook script.

----------------------------------------------------------------------
[0] Start with the mergemaster completed by the traditional way.
 It doesn't matter if you use a subversion repository, a git repository, or any
revision of the source files. 

----------------------------------------------------------------------
[1-1] Backup the files installed by "make distribution" (That is, /etc/*,
/root/*, and /boot/device.hints)
 It's not mandatory to do this, but I recommend that you back up your /etc,
/root, /boot/device.hints files so that you can restore them in case of an
accident.

[1-2] # sh replace_id.sh
   Make sure the SOURCEDIR and DESTDIR in replace_id.sh are correct and run
replace_id.sh.

With the above, "$FreeBSD ... $" in files installed by "make distribution" will
be replaced with "$FreeBSD: MD5 $". Make sure those files are not corrupted.

----------------------------------------------------------------------
[2-1] Now let /usr/src be the new git repository.

[2-2] Install "src_id.sh" in the appropriate directory in the ${PATH}. (ex:
/usr/local/bin/src_id.sh)

And, in the git repository:

[2-3] # git config filter.src_id.smudge 'src_id.sh add'
[2-4] # git config filter.src_id.clean 'src_id.sh del'
[2-5] # echo '* filter=src_id' >> .git/info/attributes
[2-6] (After checking that your post-commit file doesn't exist in .git/hooks)
      # /bin/cp post-commit .git/hooks

[2-7] # git ls-files -z | /usr/bin/xargs -0 /bin/rm -f
[2-8] # git checkout -f

>From now on, even if you update the source files, mergemaster will work fine.
----------------------------------------------------------------------
[Notes]
When you first run mergemaster after the above work, you will be asked to merge
the following four files.

/etc/mail/freebsd.cf
/etc/mail/freebsd.submit.cf
/etc/mail/sendmail.cf
/etc/mail/submit.cf

For these, please merge at that time.
(This is because replace_id.sh doesn't support cases for those files.)
===========================================================================

That's all. Thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list