blocklist: Add vendor import instructions

Add vendor import instructions for blocklist.

It includes a "freebsd-changes.sh" script that takes care of adapting
paths and functions into FreeBSD.

Reviewed by:	emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D49510
This commit is contained in:
Jose Luis Duran 2025-12-16 00:55:24 +00:00
parent 03603db013
commit 715cc25713
No known key found for this signature in database
GPG key ID: 5415E244477475CC
2 changed files with 115 additions and 0 deletions

View file

@ -0,0 +1,97 @@
FreeBSD maintainer's guide to blocklist
=======================================
These instructions describe the blocklist vendor import procedure,
following the Committer's Guide
(https://docs.freebsd.org/en/articles/committers-guide/#vendor-import-git).
> [!NOTE]
> This guide follows the convention that a `freebsd` remote is pointing
> to gitrepo.FreeBSD.org/src.git.
1. Grab our top level directory:
freebsd=$(git rev-parse --show-toplevel)
2. Create a Git worktree under a temporary directory:
worktree=$(mktemp -d -t blocklist)
git worktree add ${worktree} vendor/blocklist
3. Clone the blocklist repo (https://github.com/zoulasc/blocklist.git):
blocklist_repo=$(mktemp -d -t blocklist-repo)
git clone https://github.com/zoulasc/blocklist.git ${blocklist_repo}
cd ${blocklist_repo}
commit=$(git rev-parse HEAD)
commit_short=$(git rev-parse --short HEAD)
date=$(git show -s --format=%cd --date=format:%Y-%m-%d)
tag=$(git show -s --format=%cd --date=format:%Y%m%d)
4. Copy to the vendor branch using rsync (net/rsync):
rsync -va --del --exclude=".git" ${blocklist_repo}/ ${worktree}
5. Take care of added/deleted files:
cd ${worktree}
git add -A ${worktree}
git status
git diff --staged
6. Commit:
message=$(cat <<-EOM
blocklist ${date} (${commit_short})
Upstream hash ${commit}.
Obtained from: https://github.com/zoulasc/blocklist
EOM
)
git commit -e -m "Vendor import of ${message}"
7. Tag:
git tag -a -e -m "Tag ${message}" vendor/blocklist/${tag}
At this point, the vendor branch can be pushed to the FreeBSD
repo via:
git push --follow-tags freebsd vendor/blocklist
8. Merge from the vendor branch:
cd ${freebsd}
git subtree merge -P contrib/blocklist vendor/blocklist
Some files may have been deleted from FreeBSD's copy of
blocklist. When git prompts for these deleted files during the
merge, choose 'd' (leaving them deleted).
9. Resolve conflicts.
10. Diff against the vendor branch:
git diff --diff-filter=M vendor/blocklist/${tag} HEAD:contrib/blocklist
Review the diff for any unexpected changes.
11. Run the FreeBSD changes script:
cd contrib/blocklist
sh ./freebsd-changes.sh
12. If source files have been added or removed, update the
appropriate makefiles to reflect changes in the vendor's
Makefile.in.
13. Build and install world, reboot, test. Pay particular attention
to the fingerd(8) and sshd(8) integration.
14. Commit.
15. Cleanup:
rm -fr ${blocklist_repo} ${worktree}
git worktree prune

View file

@ -0,0 +1,18 @@
#!/bin/sh
#
# FreeBSD-specific changes from upstream
#
# Remove Debian port
rm -fr port/debian
# /libexec -> /usr/libexec
sed -i "" -e 's| /libexec| /usr/libexec|g' bin/blocklistd.8
sed -i "" -e 's|"/libexec|"/usr/libexec|g' bin/internal.h
# NetBSD: RT_ROUNDUP -> FreeBSD: SA_SIZE (from net/route.h)
sed -i "" -e 's/RT_ROUNDUP/SA_SIZE/g' bin/conf.c
# npfctl(8) -> ipf(8), ipfw(8), pfctl(8)
sed -i "" -e 's/npfctl 8 ,/ipf 8 ,\n.Xr ipfw 8 ,\n.Xr pfctl 8 ,/g' bin/blocklistd.8