#1 remove handling of gopath dirs from the golang package as they are no longer necessary and will conflict with https://pagure.io/go-rpm-macros/
Opened 5 years ago by nim. Modified 4 years ago
rpms/ nim/golang nogopath  into  rawhide

file modified
-17
@@ -441,12 +441,6 @@ 

  ln -sf %{goroot}/bin/go $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/go

  ln -sf %{goroot}/bin/gofmt $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/gofmt

  

- # ensure these exist and are owned

- mkdir -p $RPM_BUILD_ROOT%{gopath}/src/github.com

- mkdir -p $RPM_BUILD_ROOT%{gopath}/src/bitbucket.org

- mkdir -p $RPM_BUILD_ROOT%{gopath}/src/code.google.com/p

- mkdir -p $RPM_BUILD_ROOT%{gopath}/src/golang.org/x

- 

  # make sure these files exist and point to alternatives

  rm -f $RPM_BUILD_ROOT%{_bindir}/go

  ln -sf /etc/alternatives/go $RPM_BUILD_ROOT%{_bindir}/go
@@ -511,17 +505,6 @@ 

  %exclude %{goroot}/test/

  %{goroot}/*

  

- # ensure directory ownership, so they are cleaned up if empty

- %dir %{gopath}

- %dir %{gopath}/src

- %dir %{gopath}/src/github.com/

- %dir %{gopath}/src/bitbucket.org/

- %dir %{gopath}/src/code.google.com/

- %dir %{gopath}/src/code.google.com/p/

- %dir %{gopath}/src/golang.org

- %dir %{gopath}/src/golang.org/x

- 

- 

  # gdbinit (for gdb debugging)

  %{_sysconfdir}/gdbinit.d

  

Everything except
%dir %{gopath}
%dir %{gopath}/src

is useless nowadays as our Go packages own their directories properly now, and %{gopath} + %{gopath}/src are going to be provided cleanly by the go-filesystem subpackage generated from fo-rpm-macros

It makes sense to put ownership of all the directories you are removing to a different package.

is useless nowadays as our Go packages own their directories properly now

Not true. E.g. %{gopath}/src/github.com/ would be owned by all packages that have the base gopath starting with github.com. Please suggest, who is going to own all the directories you have just removed.

FPC has ruled a long time ago that multiple ownership of directories is ok as long as the directory permissions are the same:

“When co-owning directories, you must ensure that the ownership and permissions on the directory match in all packages that own it.” Guidelines

And, all cleaned up Go packages we have been building for months do own all the directories they need below %{gopath}/src. Example.

Of course pre-cleanup packages do everything manually and have correctness problems everywhere. Fixing directory ownership of Go packages was actually one of the first objectives of my Go macros work — the initial implementation computed dependencies from directory ownerships, before we added .goipath files to the mix, so it absolutely required them to be reliable.

%{gopath}/src and %{gopath} on the other hand can not be shared between the macro package and golang, because otherwise it’s impossible to touch the %{gopath} definition without conflicting with the golang package. Plus, having the golang package provide directory ownership for things that could be used with gcc-go is a correctness problem (not that I care too much about gcc-go, there is work enough getting the main compiler working reliably).

One of the possible results of golist issue 2 it that we will need to move %{gopath} to %{_libdir} to avoid breaking tooling by installing arch-specific file mixes in %{_datadir}.

Therefore the go-rpm-macros in pagure creates a specific go-filesystem subpackage that owns %{gopath}/src and %{gopath} so those can be redefined as needed without conflicts everywhere. And the copr test mass rebuild does redefine those to check the redefine actually work shall we need it.

rebased onto a0ddb599fcf66725a8b3afbc06dc530ac29b30f4

4 years ago

rebased onto af8e815

4 years ago