-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
$ hugo version hugo v0.121.1+extended linux/amd64 BuildDate=2024-02-06T18:00:00-06:00 VendorInfo=Fedora:0.121.1-1.fc39
Hugo includes optional code to support website deployment. This code brings in many dependencies, and Hugo provides an option to deactivate it (-tags nodeploy).
I maintain the official Hugo package for Fedora. Packaging the deploy code's dependencies has become difficult, so I now build the Hugo package without the deploy features. The trouble is that the Fedora packaging system automatically resolves dependencies by inspecting the imports found in Go code. I can partially address this by removing the "deploy" directory before building. However, config/allconfig/allconfig.go and config/allconfig/alldecoders.go import from the deploy directory regardless of the presence of the nodeploy tag.
Would it be possible to make conditional the use of deploy in allconfig.go and alldecoders.go with something like this
//go:build !nodeploy
// +build !nodeploy
?
That would go a long way to make packaging less fragile and more straight forward.
Here are my current steps, which might help illustrate what I am trying to describe:
rm -rf deploy
.- Patch things with sed:
sed -i '/"github.com\/gohugoio\/hugo\/deploy"/d' config/allconfig/allconfig.go # Remove import.
sed -i 's/Deployment deploy.DeployConfig/Deployment bool/g' config/allconfig/allconfig.go # Replace use with bool.
sed -i '/"github.com\/gohugoio\/hugo\/deploy"/d' config/allconfig/alldecoders.go # Remove import.
sed -i 's/p.c.Deployment, err =/\/\/ p.c.Deployment, err =/g' config/allconfig/alldecoders.go # Comment out use.
- Run go build with
-tags nodeploy
. - Run go test with
-tags nodeploy
.
Steps 1, 3, and 4 are fine. Step 2 is what I would like to avoid.