rpm-software-management / mock

Mock is a tool for a reproducible build of RPM packages.
GNU General Public License v2.0
386 stars 235 forks source link

Add some enviroment variables to /builddir/.bashrc in mock os but doesn't work when build rpm. #1382

Closed duanhaomiao closed 5 months ago

duanhaomiao commented 5 months ago

Short description of the problem

I'm doing secondary development on autospec project(use mock) to support golang. I configure config_opts['chroot_setup_cmd']='go' in .cfg file but it only installs one version of go, so I use curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer|sh command to manually install gvm to mock os to switch go verisons before using mock *.src.rpm command to build rpm. Used command like this: /usr/bin/mock --root=/etc/mock/clear.cfg shell "curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer|sh; " --uniqueext=rclone --no-cleanup-after

But when i use chroot command to login the os again, i find the gvm not installed and there's no ~/.bashrc or /builddir/.bashrc file. After that, i change my command to /usr/bin/mock --root=/etc/mock/clear.cfg shell "touch ~/.bashrc; chmod 755 /builddir/; curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer|sh; " --uniqueext=rclone --no-cleanup-after , creating .bashrc successfully and it contains gvm env scripts.

But then i run /usr/bin/mock --root=/etc/mock/clear.cfg --result=results/ results/rclone-1.56.0-1.src.rpm --uniqueext=rclone --no-clean command to build rpm, i found gvm env scripts in ~/.bashrc not loaded when executing mock build command , because i check error log and find ${GOPATH} is printed empty.

So how can i make my gvm env scripts in ~/.bashrc loaded successfully when use mock to build rpm? thank you.