You are not logged in.

#1 2022-02-20 18:27:53

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

package() function doesn't recognise shell script

In the PKGBUILD file for an AUR I am working on, I get the following error in my package() function:

./install.sh: No such file or directory

here is the function:

package() {
    cd /opt/"$pkgname"/pymoab
    ./install.sh
    python setup.py install
}

The file is in the directory, and it is called 'install.sh.cmake'.

I have tried changing the command in the package() function multiple ways, including:

bash install.sh
bash install.sh.cmake
bash ./install.sh
bash ./install.sh.cmake
./install.sh
./install.sh.cmake
. ./install.sh
. ./install.sh.cmake

All give the same error.

I originally wrote this as a set of shells scripts, which work well. In the shell script the command is:

bash install.sh

So I'm not sure why it doesn't work in the package() function.

All input appreciated. Let me know if I can provide more detail.

Offline

#2 2022-02-20 18:30:41

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: package() function doesn't recognise shell script

If /opt/"$pkgname"/pymoab is created by the PKGBUILD you can not use it in the PKGBUILD as it will not exist until the package is installed.

Offline

#3 2022-02-20 18:32:29

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

Ohh that would explain it. Thanks.

Offline

#4 2022-02-20 18:34:14

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: package() function doesn't recognise shell script

So are you actually using Arch now or have you just reposted this hiding the fact that your using a different distro?


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2022-02-20 18:34:38

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

But when I look at other AURs, I see that package() is entering directories created in the build function.

Offline

#6 2022-02-20 18:35:13

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

@Slithery, using Arch and seeing the same issue

Offline

#7 2022-02-20 18:52:55

ayekat
Member
Registered: 2011-01-17
Posts: 1,590

Re: package() function doesn't recognise shell script

LukeLabrie wrote:

But when I look at other AURs, I see that package() is entering directories created in the build function.

Yes, but /opt (or anything underneath) is certainly not created by the build() function. Your PKGBUILD code should ideally only operate within $srcdir and $pkgdir.


pkgshackscfgblag

Offline

#8 2022-02-23 16:52:36

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

I updated my package() function to only include $srcdir and $pkgdir but I am still seeing the same error:

package() {
	cd $srcdir/$pkgname/build
	make DESTDIR="${pkgdir}" install
	cd $srcdir/$pkgname/pymoab
	bash install.sh
	python setup.py install
}

bash: install.sh: No such file or directory

Any ideas?

Offline

#9 2022-02-23 16:53:48

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,559

Re: package() function doesn't recognise shell script

What are you trying to package, exactly?

Offline

#10 2022-02-23 16:57:38

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

this PKGBUILD is for moab (https://bitbucket.org/fathomteam/moab)

Offline

#11 2022-02-23 17:00:17

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: package() function doesn't recognise shell script

Post the complete PKGBUILD you are having issues with, we need to see it in it's entirety.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#12 2022-02-23 17:01:28

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,559

Re: package() function doesn't recognise shell script

So the CMakeLists.txt file includes this ( https://bitbucket.org/fathomteam/moab/s … t#lines-89 ), and it has to be processed by cmake to make the install.sh script. Have you done this?

Or better yet, skip install.sh all together, all it does is call setup.py. https://bitbucket.org/fathomteam/moab/s … e#lines-12

Last edited by Scimmia (2022-02-23 17:03:40)

Offline

#13 2022-02-23 17:02:56

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

Sure, see below:

pkgname=moab
pkgver=git
pkgrel=1
pkgdesc="The Mesh-Oriented datABase MOAB is a component for representing and evaluating mesh data"
arch=(x86_64)
url="https://bitbucket.org/fathomteam/moab"
license=(GPL3)
makedepends=(
	git
	python
	cmake
	gcc-fortran
	eigen
	netcdf
	hdf5
	cython
	blas
	lapack
	python-numpy
	python-setuptools
	"glibc>=2.34"
)
provides=("${pkgname%}")
source=("${pkgname}::git+${url}.git")

build() {
	cd $srcdir/$pkgname
	mkdir build && cd build
	# test later if it's necessary to have double compilation
	cmake .. -DENABLE_HDF5=ON \
		       -DENABLE_PYMOAB=ON \
		       -DENABLE_NETCDF=ON \
		       -DENABLE_FORTRAN=OFF \
		       -DENABLE_BLASLAPACK=OFF \
		       -DBUILD_SHARED_LIBS=ON
	make
}

package() {
	cd $srcdir/$pkgname/build
	make DESTDIR="${pkgdir}" install
	cd $srcdir/$pkgname/pymoab
	bash install.sh
	python setup.py install
}

Offline

#14 2022-02-23 17:06:57

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

@Scimmia I don't think I've done that and I'm not really clear on what it means, but when I wrote this as a set of shell scripts it worked fine, so I'm not convinced that that's the issue.

Offline

#15 2022-02-23 17:07:59

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,559

Re: package() function doesn't recognise shell script

If you had to run 'python setup.py' separately, it DIDN'T work fine.

Offline

#16 2022-02-23 17:10:41

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

I see. Well that comes after the bash install.sh command so I don't think it would be the reason that that didn't run no?

Offline

#17 2022-02-23 17:12:08

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

ah I just saw your edit. I've tried that and then I get the same error on the python script. Will try again now.

Offline

#18 2022-02-23 17:25:19

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

Similar error on the python script:

[$srcdir]/moab/pymoab/setup.py': [Errno 2] No such file or directory

I can see the file in the directory as "setup.py.in"

Offline

#19 2022-02-23 17:30:07

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,559

Re: package() function doesn't recognise shell script

Found it. You're building in $srcdir/$pkgname/build, but you're trying to install pymoab from the raw, unbuilt source in $srcdir/$pkgname/pymoab.

Before you upload the PKGBUILD, though, you have a LOT of things to fix. Even the pkgname is wrong.

Last edited by Scimmia (2022-02-23 17:30:33)

Offline

#20 2022-02-24 15:50:38

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

Ok. I'm not sure how that resolves the issue I'm seeing though. Shouldn't it still be able to run a bash script or a python script even if that were the case? Regardless of where I am building/installing, those files exist in the directories when the commands are run.

What do you mean that the pkgname is wrong?

Offline

#21 2022-02-24 16:06:15

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,559

Re: package() function doesn't recognise shell script

That's my entire point, those files do not exist where you're trying to run them. Look for yourself. They only exist in build/pymoab.

As for cleaning up the PKGBUILD, including the pkgname, start here: https://wiki.archlinux.org/title/VCS_package_guidelines

Offline

#22 2022-02-24 16:12:13

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,529
Website

Re: package() function doesn't recognise shell script

For cleaning up the PKGBUILD, follow the link above and review the pkgname, pkgver, depends, and makedepends variables (and some checksum variable), then add a pkgver and prepare function to create the build directory as the current use of mkdir (at least without "-p") in the build function will make rebuilds fail.

Last edited by Trilby (2022-02-24 16:13:50)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#23 2022-02-24 16:22:37

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

When I look I see the files there. If I go to .../src/moab/pymoab I see both the the python script and the shell script (not sure if this forum allows for screenshots). Just to demonstrate, I added an ls command just before it tries to run the python script.

package() {
	cd $srcdir/$pkgname/build
	make DESTDIR="${pkgdir}" install
	cd $srcdir/$pkgname/pymoab
	ls
	python setup.py install
}

Here is the output

CMakeLists.txt	cmake		  interface_notes.txt  pyproject.toml	 setup.py.cmake.in  tests
Makefile.am	install.sh.cmake  pymoab	       requirements.txt  setup.py.in


python: can't open file '[$srcdir/$pkgname]/pymoab/setup.py': [Errno 2] No such file or directory

So unless I'm misunderstanding something about the way this package() function works, it is certainly in the correct directory when it attempts to run the files.

Offline

#24 2022-02-24 16:28:27

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,559

Re: package() function doesn't recognise shell script

install.sh.cmake and setup.py.cmake.in/setup.py.in ARE NOT SCRIPTS. We covered this back in post #12. You cannot run them.

Offline

#25 2022-02-24 16:46:48

LukeLabrie
Member
Registered: 2022-02-19
Posts: 28

Re: package() function doesn't recognise shell script

I see. Seems to be working now. I am past that error at least. Thanks for your help.

Offline

Board footer

Powered by FluxBB