Page MenuHomeFreeBSD

build: Support got
ClosedPublic

Authored by cperciva on Sun, Oct 11, 1:47 AM.
Tags
None
Referenced Files
F176529683: D60606.id190110.diff
Mon, Oct 19, 2:31 PM
F176505180: D60606.id189855.diff
Mon, Oct 19, 9:37 AM
F176503587: D60606.id189940.diff
Mon, Oct 19, 9:21 AM
F176463719: D60606.id190086.diff
Mon, Oct 19, 1:39 AM
F176445189: D60606.id190006.diff
Sun, Oct 18, 10:45 PM
F176419583: D60606.id189940.diff
Sun, Oct 18, 7:03 PM
Unknown Object (File)
Sun, Oct 18, 3:26 PM
Unknown Object (File)
Sun, Oct 18, 12:55 PM

Details

Reviewers
naddy
bapt
Group Reviewers
releng
Commits
rGa8be89928930: build: Support got
Summary

Add code for using got(1), matching how git(1) is currently used:

  1. Determining the git branch,
  2. Determining the checked-out hash,
  3. Determining the commit count,
  4. Determining the timestamp of the most recent commit,
  5. Determining if the tree is "dirty",
  6. Generating lists of files for the src and src-sys packages, and
  7. Excluding .got directories from src.txz and ports.txz.

The release engineer hopes to use this functionality in release builds,
since got's minimalism makes it a far more manageable build tool than
git.

MFC after: 1 week
Sponsored by: Amazon

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 78230
Build 75113: arc lint + arc unit

Event Timeline

release/Makefile and sys/conf/newvers.sh look ok, will have to find some time to review the other bits.
IMO it would be fine to commit this in a few parts - e.g. newvers.sh is useful independent of how release builds are produced

Makefile.inc1
2241

The pattern match is reversed from the git one. I think you mixed up the patterns for create-source-src-package and create-source-src-sys-package.

2277

The pattern match is reversed from the git one. I think you mixed up the patterns for create-source-src-package and create-source-src-sys-package.

release/Makefile.inc1
39

Any reason not to just use "got branch"?

sys/conf/newvers.sh
302

Again, I would just use "got branch" here.

Update patch.

  1. Use 'got cat HEAD' to get the timestamp of the latest commit. [1]
  1. Use 'got status' instead of 'got diff' to check for a dirty tree. [1]
  1. Use 'got info' instead of looking at .got/base-commit. [1]
  1. Use 'got branch' instead of looking at .got/head-ref. [2]
  1. Fix src vs. src-sys swapped regexes. [2]
  1. Consistently 'cd ${.CURDIR}' for running got commands.

Suggested by: stsp [1], naddy [2]

sys/conf/newvers.sh
187

That probably makes sense, but what are the desired semantics here? For instance, git diff will ignore extra files or staged changes; is that intentional or incidental?

sys/conf/newvers.sh
187

This is for adding -dirty to the uname version string. Extra files should certainly be ignored -- extra files won't, in general, change what's built, and folks may well have miscellaneous text files, editor backups, etc. littered around the tree.

Staged changes should trigger -dirty though -- D60722.

Ignore extra files in 'got status'

sys/conf/newvers.sh
187

Fixed -- now we ignore extra files; got status (unlike git status) reports staged files as modified so it was already correct for that.

sys/conf/newvers.sh
186–187

got status can directly suppress selected status codes with the -S parameter. To ignore extra files and, like the git command, differences in the executable bits, we can use

got status -S '?m'

Switch to got status -S '?m' | grep .

sys/conf/newvers.sh
186–187

Thanks! I didn't know about -S.

release/Makefile.inc1
46–47

GITCOUNT will contain the leading spaces wc outputs. This can be a problem if GITCOUNT is used without running it through a shell expression that strips whitespace. Makefile.mirrors looks affected by this. I suggest

... wc -l | tr -d ' '

You addressed this in newvers.sh with an extra echo $(...), which is another possibility.

Strip spaces from wc -l output

release/Makefile.inc1
46–47

Ooh, good catch. I didn't test the mirror staging code, so this would have caused interesting issues with the first weekly 16.0 snapshots.

This revision is now accepted and ready to land.Sat, Oct 17, 1:21 AM
This revision was automatically updated to reflect the committed changes.