xref: /freebsd/contrib/one-true-awk/FREEBSD-upgrade (revision fd2a4a31d9df9beb793c892af72aeb1c1bf5dd42)
1*fd2a4a31SWarner LoshNotes on upgrading awk from upstream
2*fd2a4a31SWarner Losh
3*fd2a4a31SWarner LoshFreeBSD imports awk from the one true awk github project. This is the blessed
4*fd2a4a31SWarner Loshsuccessor to Brian Kernighan's efforts to maintain awk after he left Lucent.
5*fd2a4a31SWarner Losh
6*fd2a4a31SWarner Loshgit@github.com:onetrueawk/awk.git
7*fd2a4a31SWarner Losh
8*fd2a4a31SWarner LoshWe also track the bsd-features branch. This is a branch that takes the
9*fd2a4a31SWarner Loshtraditional one true awk and adds features that the BSD projects have added over
10*fd2a4a31SWarner Loshthe years that are useful, but not too over the top (like bit functions).
11*fd2a4a31SWarner Losh
12*fd2a4a31SWarner LoshThe typical update cycle goes something like:
13*fd2a4a31SWarner Losh
14*fd2a4a31SWarner Losh(1) Create a work tree for the vendor/one-true-awk branch
15*fd2a4a31SWarner Losh	% cd freebsd-main
16*fd2a4a31SWarner Losh	% git worktree create ../ota vendor/one-true-awk
17*fd2a4a31SWarner Losh(2) Update the onetrueawk github
18*fd2a4a31SWarner Losh	% cd ../awk
19*fd2a4a31SWarner Losh	% git pull --rebase
20*fd2a4a31SWarner Losh	% git branch --show-current
21*fd2a4a31SWarner Losh	bsd-features
22*fd2a4a31SWarner Losh	% git show-ref HEAD
23*fd2a4a31SWarner Losh	f9affa922c5e074990a999d486d4bc823590fd93 refs/remotes/origin/HEAD
24*fd2a4a31SWarner Losh(3) Copy that to the vendor branch and push upstream
25*fd2a4a31SWarner Losh	% rm -rf ../ota/*	# trailing /* is important
26*fd2a4a31SWarner Losh	% cp -a * ../ota
27*fd2a4a31SWarner Losh	% cd ../ota
28*fd2a4a31SWarner Losh	% git add *
29*fd2a4a31SWarner Losh	% git commit -m"Import awk YYYYMMDD hash f9affa922c5e" # 12 places
30*fd2a4a31SWarner Losh	% git commit --amend
31*fd2a4a31SWarner Losh	<insert the relevant bits from the FIXES file>
32*fd2a4a31SWarner Losh	% diff -ur ../awk .
33*fd2a4a31SWarner Losh	# Sanity check to make sure it looks good. The vendor branch should
34*fd2a4a31SWarner Losh	# contain the unaltered sources from upstream since it's active
35*fd2a4a31SWarner Losh	# again (for a while we were importing submitted patches to the
36*fd2a4a31SWarner Losh	# vendor branch given the long lag with the old upstream, but no more)
37*fd2a4a31SWarner Losh	% git tag -a -s vendor/one-true-awk/f9affa92		# 8 places
38*fd2a4a31SWarner Losh	<enter gpg password>
39*fd2a4a31SWarner Losh	% git push --follow-tags freebsd vendor/one-true-awk
40*fd2a4a31SWarner Losh(4) Merge this into main
41*fd2a4a31SWarner Losh	% git subtree merge -P contrib/one-true-awk vendor/one-true-awk
42*fd2a4a31SWarner Losh	# resolve any conflicts and commit
43*fd2a4a31SWarner Losh	# Be sure to use the same or similar commit message as you did for
44*fd2a4a31SWarner Losh	# the import. If you import multiple versions before merging to head
45*fd2a4a31SWarner Losh	# you may need to combine the messages. Also, if there's more than
46*fd2a4a31SWarner Losh	# a screen of changes, you may want to abstract them down into an
47*fd2a4a31SWarner Losh	# easy to digest summary.
48*fd2a4a31SWarner Losh	% cd usr.bin/awk
49*fd2a4a31SWarner Losh	% sudo make check
50*fd2a4a31SWarner Losh	# make sure all the tests pass
51*fd2a4a31SWarner Losh	% cd ../..
52*fd2a4a31SWarner Losh	# awk is a build tool, so test the builds
53*fd2a4a31SWarner Losh	% make buildworld / buildkernel for amd64, armv7, i386 and aarch64 (or
54*fd2a4a31SWarner Losh	  make universe/tinderbox if there's a lot of changes).
55*fd2a4a31SWarner Losh	% git push freebsd
56*fd2a4a31SWarner Losh(5) Oops, lost the race to push while testing, the following will rebase things
57*fd2a4a31SWarner Losh	% git fetch freebsd
58*fd2a4a31SWarner Losh	% git rebase --rebase-merges -i freebsd/main
59