You are not logged in.

#1 2011-04-04 14:04:04

HyperBaton
Member
From: Belgium
Registered: 2008-01-18
Posts: 207

First PKGBUILD: 'cannot stat' error for source file

I'm attempting my first PKGBUILD and I've run into some trouble.

PKGBUILD:

# Maintainer: Simon Wydooghe <hyperbaton at gmail dot com>

pkgname=vpcs
pkgver=0.21a
pkgrel=1
pkgdesc="Simulates up to 9 computers for ping/traceroute purposes."
arch=('i686' 'x86_64')
url="http://vpcs.sourceforge.net/"
license=('GPL')
makedepends=('p7zip')
source=('${pkgname}_${pkgver}.7z::http://downloads.sourceforge.net/project/${pkgname}/binary/${pkgver}/${pkgname}_${pkgver}.7z')
noextract=('${pkgname}_${pkgver}.7z')
md5sums=('dac71bdf9d04a3b7e69fe25b15f1ee5c')

package() {
  local vpcsdir="opt/vpcs"
  local binary="vpcs32"

  cd "${srcdir}"
  mv ${pkgname}_${pkgver}.7z.part ${pkgname}_${pkgver}.7z
  7z e -o"${pkgname}-${pkgver}" "${pkgname}_${pkgver}.7z"
  cd "${pkgname}-{$pkgver}"
  mv startup.vpc readme.txt ${pkgdir}/${vpcsdir}
  if [ $CARCH = "x86_64" ]; then
    binary="vpcs64"
  fi
  mv ${binary} ${pkgdir}/${vpcsdir}/vpcs
  chmod +x ${pkgdir}/${vpcsdir}/vpcs
}

Error when running makepkg:

[hb@hb-desktop vpcs]$ makepkg
==> Making package: vpcs 0.21a-1 (Mon Apr  4 15:48:07 CEST 2011)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving Sources...
  -> Downloading ${pkgname}_${pkgver}.7z...
--2011-04-04 15:48:07--  http://downloads.sourceforge.net/project/vpcs/binary/0.21a/vpcs_0.21a.7z
Resolving downloads.sourceforge.net... 216.34.181.59
Connecting to downloads.sourceforge.net|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://switch.dl.sourceforge.net/project/vpcs/binary/0.21a/vpcs_0.21a.7z [following]
--2011-04-04 15:48:07--  http://switch.dl.sourceforge.net/project/vpcs/binary/0.21a/vpcs_0.21a.7z
Resolving switch.dl.sourceforge.net... 130.59.138.21, 2001:620:0:1b::21
Connecting to switch.dl.sourceforge.net|130.59.138.21|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1168714 (1.1M) [application/x-7z-compressed]
Saving to: “vpcs_0.21a.7z.part”

100%[======================================================================================================================================>] 1,168,714   1.10M/s   in 1.0s    

2011-04-04 15:48:08 (1.10 MB/s) - “vpcs_0.21a.7z.part” saved [1168714/1168714]

mv: cannot stat `/home/hb/abs/vpcs/${pkgname}_${pkgver}.7z.part': No such file or directory
==> ERROR: Failure while downloading ${pkgname}_${pkgver}.7z
    Aborting...

So it seems that '.part' is being added to the source filename when being downloaded by makepkg. I added '${pkgname}_${pkgver}.7z::' in front of the source url to rename the file (I believe that's correct, no?).

This is the PKGBUILD directory after running makepkg:

[hb@hb-desktop vpcs]$ ls -l
total 1152
-rw-r--r-- 1 hb hb     884 Apr  4 15:47 PKGBUILD
drwxr-xr-x 2 hb hb    4096 Apr  4 16:01 src
-rw-r--r-- 1 hb hb 1168714 Mar  8 04:18 vpcs_0.21a.7z.part

I can stat the file in question:

[hb@hb-desktop vpcs]$ stat vpcs_0.21a.7z.part 
  File: `vpcs_0.21a.7z.part'
  Size: 1168714       Blocks: 2288       IO Block: 4096   regular file
Device: 805h/2053d    Inode: 1046825     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/      hb)   Gid: ( 1000/      hb)
Access: 2011-04-04 16:01:22.000000000 +0200
Modify: 2011-03-08 04:18:48.000000000 +0100
Change: 2011-04-04 16:01:22.477037824 +0200
 Birth: -

So can someone tell me which moronic error I've made this time? :-)

Offline

#2 2011-04-04 14:10:28

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: First PKGBUILD: 'cannot stat' error for source file

source=('${pkgname}_${pkgver}.7z::http://downloads.sourceforge.net/project/${pkgname}/binary/${pkgver}/${pkgname}_${pkgver}.7z')
noextract=('${pkgname}_${pkgver}.7z')


don't use single quotes here, use double quotes. pkgname and pkgver are never expanded


source=("${pkgname}_${pkgver}.7z::http://downloads.sourceforge.net/project/${pkgname}/binary/${pkgver}/${pkgname}_${pkgver}.7z")
noextract=("${pkgname}_${pkgver}.7z")

Last edited by wonder (2011-04-04 14:11:31)


Give what you have. To someone, it may be better than you dare to think.

Offline

#3 2011-04-04 14:32:46

HyperBaton
Member
From: Belgium
Registered: 2008-01-18
Posts: 207

Re: First PKGBUILD: 'cannot stat' error for source file

Excellent, thanks, that did the trick!

While I've opened this topic anyway, I have another question. The application in question uses a configuration file which it only looks for in the directory the executable resides in (unless a specific command line argument is given). For this reason, it seems most logical to place the application under /opt. But /opt is not in $PATH by default. What is the best way to add the directory /opt/vpcs to $PATH but to also remove it from $PATH when the application is removed?

Last edited by HyperBaton (2011-04-04 14:33:45)

Offline

#4 2011-04-07 14:40:32

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,849

Re: First PKGBUILD: 'cannot stat' error for source file

No need to change the path, add a shell script to start vcps to the package, place that in $pkgdir/usr/bin .

the shell script would look something like this :

#!/bin/bash
cd /opt/vcps
<insert startup command for vpcs>

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2011-04-07 14:45:25

HyperBaton
Member
From: Belgium
Registered: 2008-01-18
Posts: 207

Re: First PKGBUILD: 'cannot stat' error for source file

Thanks for the reply, I did indeed try it like this yesterday and it worked like a charm. I should have updated my own topic though smile

Offline

Board footer

Powered by FluxBB