Skip to content

Correct the timing of setting the environmental variable for package building

This patch fixes the timing of setting the environmental variables for golang packages.

Currently, dh-golang sets the environmental variables for the building in Debian::Debhelper::Buildsystem::golang::new, which affects other stages of dh command,like override_* or execute_*. This can cause unexpected failures in some cases. ex. #1049392

I think Debhelper plugins should not interfere with the build process unless necessary. Most plugins follow this principle, only except dh-haskel and dh-mkcmake. This patch makes dh-golang follow that principle.

Of course,this patch may have side effects on other packages that depend on dh-golang, so I checked them all by checking their Debian/rules like below,

$ awk '/^Package:/{package=$2;find=0}/^Build-Depends:..*dh-golang/{find=1}(/\.debian\.tar/){file=$3} (find==1) && /^Directory:/{print "http://deb.debian.o
rg/debian/"$2"/"file}' /var/lib/apt/lists/deb.debian.org_debian_dists_sid_*_source_Sources | xargs -n 1 wget

$ for file in $(ls -1) 
do
  base=$(basename $file .debian.tar.xz)
  base=$(basename $base .debian.tar.gz)
  mkdir $base
  (cd $base; tar xf ../$file )
done
$ find . -name 'rules' | xargs awk '/^override/ || /^execute/ { if (found==0) {print "** "FILENAME};found=1} found==1 {print $0}' | tee suspect.log

$ less suspect.log

As result,these are the only packages that may be affected by this patch:

golang-github-docker-docker-credential-helpers_0.6.4+ds1-1
mender-connect_2.1.0+ds1-4
secsipidx_1.2.0-2
thrift_0.19.0-2
docker.io_20.10.25+dfsg1-2

The impact of this patch is minimal, as you can see. I hope you will consider applying it.

Please let me know if you have any feedback.

Edited by Takahide Nojima

Merge request reports

Loading