You are not logged in.

#1 2022-04-14 21:46:19

newsboost
Member
Registered: 2016-07-24
Posts: 157

PKGBUILD review request: python-stego-lsb

Hi,

I've attempted to create my first PKGBUILD file and after several hours I've come up with this:


# Maintainer: Martin Joergensen <newsboost@gmail.com>
pkgname=python-stego-lsb
_name=${pkgname#python-}
pkgver="1.3.3"
pkgrel=1
pkgdesc="Least Significant Bit Steganography for .bmp, .png, WAV sound files, and byte sequences."
arch=('any')
url="https://github.com/ragibson/Steganography"
license=('MIT')
depends=(python python-click python-pillow python-numpy)
makedepends=(python-setuptools)
provides=('stegolsb')
source=(
  "https://files.pythonhosted.org/packages/2a/11/b4779629886222381320f9ceb3a3104a598dec0f628e1dae2c2d4d402b25/stego_lsb-${pkgver}.tar.gz"
)
md5sums=(e2cfaa247f0caace30dc62f85cffcef2)

build() {
  cd "${_name//-/_}-$pkgver"
  python3 setup.py build
}

package() {
  cd "${_name//-/_}-$pkgver"
  install -D -m644 "LICENSE.md" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  install -D -m644 "README.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md"
  python setup.py install --root="$pkgdir/" --optimize=1 --skip-build
}

I'm not particularly very proud of the hardcoded "mv stego..."-line in the prepare()-function. As you can see I tried something else above, but hen I had to replace a dash with an underscore - or was it the other way and I gave up on that and took the easier solution? I'm also really not sure about many of the fields, e.g. I typed in "stegolsb" in the "provides"-field and I copied a line for the "makedepends" from another MAKEPKG file which also used python-wheel. I think I also need to work out some dependencies: I think there are errors here because I just did "makepkg -si" and extracted that and yes, there's a binary but then I get "ModuleNotFoundError: No module named 'click'". What is the proper test-workflow and procedure for a local test, is it just "makepkg -si"?

Sorry for these noobish question, I hope someone could please provide a bit of feedback, I think I'm on the right way, but need a few things to be fixed, thanks!

Last edited by newsboost (2022-04-15 22:49:44)

Offline

#2 2022-04-14 22:15:32

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

Re: PKGBUILD review request: python-stego-lsb

Just get rid of the prepare function completely and cd to the correct dir at the beginning of each function. There's also no need to rename the source file.

MIT license file needs to be installed.

I know there's a way of getting a better link to the source file, but I can't remember if off the top of my head. I'll see if I can look it up later if nobody comes up with it.

Sounds like you're missing a dep on python-click.

Offline

#3 2022-04-14 23:09:51

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

Re: PKGBUILD review request: python-stego-lsb

Scimmia wrote:

Just get rid of the prepare function completely and cd to the correct dir at the beginning of each function. There's also no need to rename the source file.

MIT license file needs to be installed.

I know there's a way of getting a better link to the source file, but I can't remember if off the top of my head. I'll see if I can look it up later if nobody comes up with it.

Python_package_guidelines#Source?  _name would also cover the rename / cd

Offline

#4 2022-04-15 12:45:24

newsboost
Member
Registered: 2016-07-24
Posts: 157

Re: PKGBUILD review request: python-stego-lsb

Scimmia wrote:

Just get rid of the prepare function completely and cd to the correct dir at the beginning of each function. There's also no need to rename the source file.

MIT license file needs to be installed.

I know there's a way of getting a better link to the source file, but I can't remember if off the top of my head. I'll see if I can look it up later if nobody comes up with it.

Sounds like you're missing a dep on python-click.

Great, thanks a lot! About the missing dep: correct. I checked out the "src/stego_lsb-1.3.3/stego_lsb.egg-info/requires.txt"-file and added those listed there as dependencies - I don't suspect it's normal to manually distrust such a file and manually uninstall and test all combinations? I think that file can be trusted as dependencies or if not we can fix it along the way. I also searched in the forum and thought I should install the README.md - I've updated the original post with the latest version. Seems to run nicely now. I think I've fixed it all (but am still a bit uncomfortable, think I'll try to stick around in this forum to learn for a while and become more familiar with MAKEPKG), thanks for great help!

Last edited by newsboost (2022-04-15 20:44:47)

Offline

#5 2022-04-15 12:47:54

newsboost
Member
Registered: 2016-07-24
Posts: 157

Re: PKGBUILD review request: python-stego-lsb

loqs wrote:

Python_package_guidelines#Source?  _name would also cover the rename / cd

Agree, I took this solution, thanks a lot!


UPDATE:
I also digged more and came across https://thiagowfx.github.io/2022/01/arc … -workflow/ - which lead me to install clean-chroot-manager. My config (non-root): ~/.config/clean-chroot-manager.conf is:

CHROOTPATH64="/tmp/clean-chroot-manager"
# use: "sudo mkdir -p /tmp/clean-chroot-manager" to init, temporary storage

I then ran "sudo ccm s" - and things are fine until:

==> Making package: python-stego-lsb 1.3.3-1 (Fri 15 Apr 2022 11:21:19 PM CEST)
==> Checking runtime dependencies...
==> Installing missing dependencies...
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
==> ERROR: 'pacman' failed to install missing dependencies.
==> Missing dependencies:
  -> python
  -> python-click
  -> python-pillow
  -> python-numpy
==> Checking buildtime dependencies...
==> Installing missing dependencies...
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
==> ERROR: 'pacman' failed to install missing dependencies.
==> Missing dependencies:
  -> python-build
  -> python-installer
  -> python-wheel
==> ERROR: Could not resolve all dependencies.
==> ERROR: Build failed, check /tmp/clean-chroot-manager/user/build

I tried to understand the "sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?" - reinstalled the sudo package. hmm. Permissions are:

ls -latrh `which sudo`
-rwsr-xr-x 1 root root 207K Mar  4 07:23 /usr/bin/sudo

Weird - not as I expected...


UPDATE 2:
Just for the record, using /tmp is a really bad idea, don't do that mistake. I modified (non-root)  .config/clean-chroot-manager.conf:

CHROOTPATH64="/home/user/Downloads/clean-chroot-manager-scratch"
# use: "sudo mkdir -p /home/user/Downloads/clean-chroot-manager-scratch"

And now things are better. I've updated the "makedepends" line, which I had doubts about (lines were copied from another MAKEPKG). Initially I think I got something usable - but then I removed all the files except for PKGBUILD and decided to try:

> ls -altrh
total 8.0K
lrwxrwxrwx 1 user user   11 Apr 14 22:30 PKGBUILD -> ../PKGBUILD
drwxr-xr-x 5 user user 4.0K Apr 16 00:36 ..
drwxr-xr-x 2 user user 4.0K Apr 16 00:48 .

/home/user/Downloads/python-stego-lsb/tmp [user@HPomen] [0:51]
> sudo rm -rf ../../clean-chroot-manager-scratch/* ; sudo ccm s
----> No buildroot has been created so making one now...
==> Creating install root at /home/user/Downloads/clean-chroot-manager-scratch/root
==> Installing packages to /home/user/Downloads/clean-chroot-manager-scratch/root
:: Synchronizing package databases...
 core..
...
..
==> Validating source files with md5sums...
    stego_lsb-1.3.3.tar.gz ... Passed
==> ERROR: PKGBUILD does not exist.
==> ERROR: Build failed, check /home/user/Downloads/clean-chroot-manager-scratch/user/build

It is true that /home/user/Downloads/clean-chroot-manager-scratch/user/build is empty - but why doesn't it take or use the PKGBUILD file from the initial working directory, where I issued the "sudo rm -rf ../../clean-chroot-manager-scratch/* ; sudo ccm s" commands?

Anyway, I think the PKGBUILD is correct, would just appreciate getting this last dependecy-check right before marking as solved so I know it (fully) works...

Last edited by newsboost (2022-04-15 22:57:30)

Offline

Board footer

Powered by FluxBB