why does pkgmk exports PKG and SRC?

Erich Eckner crux at eckner.net
Wed Jan 25 19:42:57 UTC 2017


I don't understand, how the build function should work if PKG and SRC
are not exported. On the other hand I can't find a difference in
exporting PKG and SRC and calling build afterwards versus calling
"PKG=$PKG SRC=$SRC build" - maybe I'm missing something here ...

If I look at pkgmk, it should not be required to "export PKG=$pkg" in
your build function at the end. You could simply use another shell for

(unset PKG; build_which_modifies_PKG_internally)

or even simpler


if the build still works if $PKG is set already.


On 25.01.2017 12:16, phi wrote:
> Hi, everyone, I've just encountered a weird bug when I'm making a port, the
> configure script works fine if I run it by hand, but always fail if it was
> invoked inside pkgmk. After digging for a while, I found out that the configure
> script uses the shell variable PKG internally. Checked pkgmk, I see that pkgmk
> exports PKG and SRC before calling build().
> Relevant code in pkgmk:
> 	build_package() {
> 		...
> 		make_work_dir    # here export PKG and SRC
> 		...
> 		(set -e -x ; build)
> I think it's better to change that to:
> 	build_package() {
> 		...
> 		make_work_dir # do not export
> 		...
> 		(set -e -x; PKG=$PKG SRC=$SRC build)
> I don't know if this change would affect other things.
> Without making any change in pkgmk, my port currently looks like:
> 	build() {
> 		local pkg=$PKG
> 		unset PKG
> 		... # build using $pkg
> 		export PKG=$pkg
> 	}
> _______________________________________________
> CRUX mailing list
> CRUX at lists.crux.nu
> https://lists.crux.nu/mailman/listinfo/crux

More information about the CRUX mailing list