dspinellis / dgsh

Shell supporting pipelines to and from multiple processes
http://www.spinellis.gr/sw/dgsh/
Other
323 stars 22 forks source link

Built binaries reference install destination directory #86

Closed lucaswerkmeister closed 5 years ago

lucaswerkmeister commented 7 years ago

I don’t know when this started to happen, because my local build of the dgsh-git AUR package was broken for months for unrelated reasons – but now that it’s fixed, pkgbuild reports:

WARNING: Package contains reference to $pkgdir

Looking into the package, I can see that usr/libexec/dgsh/cmp and a bunch of other files in usr/libexec/dgsh/ have only this content:

#!/home/lucas/git/aur/dgsh-git/pkg/dgsh-git//usr/libexec/dgsh/dgsh-wrap -s

~/git/aur/dgsh-git/pkg/dgsh-git/ is the DESTDIR in make install, which should never appear in the output. (Apart from that, is it correct that the script only consists of that single line?)

You can find the build script here, but basically it boils down to:

make PREFIX="/usr" config
make
make test
make DESTDIR="$pkgdir/" install

The package should only reference the PREFIX, not the DESTDIR.

dspinellis commented 7 years ago

The one line script is correct. Its role is to setup commands with the correct I/O requirements without invoking another shell instance. It thus saves an exec system call and the shell's startup cost. The script's first line must include the full path of dgsh-wrap so that the kernel can execute it through the #! mechanism. Shouldn't that be DESTDIR?

lucaswerkmeister commented 7 years ago

I thought that’s what the PREFIX is for. When building the package, $pkgdir is some meaningless directory that’s later tarballed into the package and won’t exist when the package is installed – it should only be used to copy files into, nothing more. If that’s not the intended use of DESTDIR, some other variable needs to be available to support this kind of build.

dspinellis commented 7 years ago

Thank you for the clarification. Please keep in mind that Marios and I are noobs regarding packaging. We have two types of builds. A build-install, which is used for testing, and this creates the files you saw with the line

./install-wrapped.sh $$(cd .. ; pwd)/build

Then the install target creates the files with the correct prefix using the line

./install-wrapped.sh

To eliminate the warning we could include the line in the testing process and remove the files afterwards. What do you think?

lucaswerkmeister commented 7 years ago

Please keep in mind that Marios and I are noobs regarding packaging.

Me too, I just hear things about Makefile conventions and try to infer things that make sense from them :)

I’m afraid I don’t quite understand your comment, sorry. If the two build kinds already exist, and the non-build install uses the right prefix, why does the problem occur? Or is that your suggested solution, but currently there’s just install and it does the same thing as your proposed build-install?

dspinellis commented 7 years ago

I think that the packager blindly looks for $pkgdir within the package directory and complains when it finds it. In dgsh it is used for a legitimate reason, so the warning can be safely ignored. The $pkgdir path does not occur in the final executed scripts, right?

lucaswerkmeister commented 7 years ago

I think that the packager blindly looks for $pkgdir within the package directory and complains when it finds it.

Essentially, yes. (Not sure if it looks in $pkgdir or in the final tarball, but it shouldn’t make a difference.) But since the path is in the scripts in $pkgdir, it does appear in the final executed scripts, which AFAIU won’t work once the package build dir (which contains $pkgdir) is removed.

dspinellis commented 7 years ago

$pkgdir is in the scripts used for testing, not in the installed scripts, no?

lucaswerkmeister commented 7 years ago

No, it ended up in the final usr/libexec/dgsh/cmp and other files in the installed package.

dspinellis commented 7 years ago

Hmm, this may not the case here, or I have understood something wrong.

First I configure with PREFIX=/home/dds config.

After building in /home/dds/src/dgsh

$ find /home/dds/src/dgsh -name ls
/home/dds/src/dgsh/build/libexec/dgsh/ls
/home/dds/src/dgsh/unix-tools/coreutils/tests/ls
$ cat /home/dds/src/dgsh/build/libexec/dgsh/ls
#!/home/dds/src/dgsh/build/libexec/dgsh/dgsh-wrap -s -d

Note that the path contains $pkgdir, but this should not be a problem here.

After installing in /home/dds

$ find /home/dds/libexec/ -name ls
/home/dds/libexec/dgsh/ls
$ cat /home/dds/libexec/dgsh/ls
#!/home/dds/libexec/dgsh/dgsh-wrap -s -d

Now the path references $PREFIX not $DESTDIR.

lucaswerkmeister commented 7 years ago

Okay, I’ll have to look into this again… unfortunately I’m away from home for a week, so I can’t debug this right now. I’ll get back to you.

dspinellis commented 5 years ago

Closing due to lack of submitter input.