You are not logged in.

#1 2017-03-13 17:27:46

JohnBobSmith
Member
From: Canada
Registered: 2014-11-29
Posts: 804

New custom PKGBUILD woes. [SOLVED]

Hi all,

When I'm not farming as a ranch hand, I like to experiment with code. I've made myself a very basic unit converter: https://github.com/JohnBobSmith/ConvertIt and I'm trying to get it to work *after* installing it with a PKGBUILD:

[jbs@dmb-gaming-laptop convertit]$ cat PKGBUILD 
# Maintainer: David "JohnBobSmith" Bogner <myrunescapeemail609@gmail.com>
pkgname=convertit
pkgver=0.1
pkgrel=1
pkgdesc="A small utility for converting measurements (Temperature, Metric, Imperial)"
arch=(x86_64)
makedepends=('git')
url="https://github.com/JohnBobSmith/convertit"
license=('MIT')
source=("git+https://github.com/JohnBobSmith/convertit.git")
md5sums=('SKIP')

build() {
        cd "$pkgname/src/"
        make
}

package() {
        cd "$pkgname"
        install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
        install -D -m755 "src/convertit" "${pkgdir}/usr/bin/${pkgname}/convertit"
}
[jbs@dmb-gaming-laptop convertit]$ 

First attempt at this so bear with me. The above PKGBUILD seems to work okay, but I cannot run convetertit -F 35 from the command line. I get command not found:

[jbs@dmb-gaming-laptop convertit]$ convertit -F 35
bash: convertit: command not found
[jbs@dmb-gaming-laptop convertit]$ 

The tab completion seems to give us some hints:

[jbs@dmb-gaming-laptop convertit]$ conv <tab>
convert       convert-mans  convolutions  
[jbs@dmb-gaming-laptop convertit]$ conv

My binary isn't recognized? It is present in /urs/bin/:

[jbs@dmb-gaming-laptop convertit]$ ls /usr/bin/ | grep convertit
convertit
[jbs@dmb-gaming-laptop convertit]$ 

How can I use my custom binary in the shell, without having to cd into the build directory and ./convertit ?

Thanks!

EDIT: FIxed the title. Oops XD.

Last edited by JohnBobSmith (2017-03-13 17:43:05)


I am diagnosed with bipolar disorder. As it turns out, what I thought was my greatest weakness is now my greatest strength.

Everyday, I make a conscious choice to overcome my challenges and my problems. It's not easy, but its better than the alternative...

Offline

#2 2017-03-13 17:32:02

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,796

Re: New custom PKGBUILD woes. [SOLVED]

As a sanity check, what is the output of ls -l /usr/bin/convertit     ?
What is the output of file /usr/bin/convertit     ?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Online

#3 2017-03-13 17:37:11

JohnBobSmith
Member
From: Canada
Registered: 2014-11-29
Posts: 804

Re: New custom PKGBUILD woes. [SOLVED]

So it seems it's a directory. That would do it:

[jbs@dmb-gaming-laptop ~]$ ls -l /usr/bin/convertit
total 16
-rwxr-xr-x 1 root root 14472 Mar 13 11:19 convertit
[jbs@dmb-gaming-laptop ~]$ file /usr/bin/convertit/
/usr/bin/convertit/: directory
[jbs@dmb-gaming-laptop ~]$ 

I'm going to fix that by putting the *actual* binary in /usr/bin and seeing what happens. Standby...


I am diagnosed with bipolar disorder. As it turns out, what I thought was my greatest weakness is now my greatest strength.

Everyday, I make a conscious choice to overcome my challenges and my problems. It's not easy, but its better than the alternative...

Offline

#4 2017-03-13 17:42:41

JohnBobSmith
Member
From: Canada
Registered: 2014-11-29
Posts: 804

Re: New custom PKGBUILD woes. [SOLVED]

Thanks ewaller, that did it. A minor goof in the PKGBUILD put the binary in a subdirectory of itself. This has been fixed:

[jbs@dmb-gaming-laptop convertit]$ cat PKGBUILD 
# Maintainer: David "JohnBobSmith" Bogner <myrunescapeemail609@gmail.com>
pkgname=convertit
pkgver=0.1
pkgrel=1
pkgdesc="A small utility for converting measurements (Temperature, Metric, Imperial)"
arch=(x86_64)
makedepends=('git')
url="https://github.com/JohnBobSmith/convertit"
license=('MIT')
source=("git+https://github.com/JohnBobSmith/convertit.git")
md5sums=('SKIP')

build() {
        cd "$pkgname/src/"
        make
}

package() {
        cd "$pkgname"
        install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
        install -D -m755 "src/convertit" "${pkgdir}/usr/bin/convertit"
}
[jbs@dmb-gaming-laptop convertit]$ 

And installing with the above PKGBUILD now works as expected. Solved. big_smile


I am diagnosed with bipolar disorder. As it turns out, what I thought was my greatest weakness is now my greatest strength.

Everyday, I make a conscious choice to overcome my challenges and my problems. It's not easy, but its better than the alternative...

Offline

#5 2017-03-13 17:48:33

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

Re: New custom PKGBUILD woes. [SOLVED]

Side note, since you're building from git HEAD, the pkgname should be suffixed with -git and there should be a pkgver function.

Offline

#6 2017-03-13 17:55:59

JohnBobSmith
Member
From: Canada
Registered: 2014-11-29
Posts: 804

Re: New custom PKGBUILD woes. [SOLVED]

Good point. What should go inside the pkgver function? *consults the wiki*

EDIT: [offtopic]removed  colon-o, yikes smiley face. Thats an ugly one... [/offtopic]

Last edited by JohnBobSmith (2017-03-13 17:56:52)


I am diagnosed with bipolar disorder. As it turns out, what I thought was my greatest weakness is now my greatest strength.

Everyday, I make a conscious choice to overcome my challenges and my problems. It's not easy, but its better than the alternative...

Offline

#7 2017-03-13 18:26:48

JohnBobSmith
Member
From: Canada
Registered: 2014-11-29
Posts: 804

Re: New custom PKGBUILD woes. [SOLVED]

Having followed the wiki, https://wiki.archlinux.org/index.php/VC … 9_function, here lies the final PKGBUILD.

[jbs@dmb-gaming-laptop convertit]$ cat PKGBUILD 
# Maintainer: David "JohnBobSmith" Bogner <myrunescapeemail609@gmail.com>
pkgname=convertit-git
pkgver=r9.b86eb07
pkgrel=1
pkgdesc="A small utility for converting measurements (Temperature, Metric, Imperial)"
arch=(x86_64)
makedepends=('git')
url="https://github.com/JohnBobSmith/convertit-git"
license=('MIT')
source=("git+https://github.com/JohnBobSmith/convertit-git.git")
md5sums=('SKIP')

pkgver() {
  cd "$pkgname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
        cd "$pkgname/src/"
        make
}

package() {
        cd "$pkgname"
        install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
        install -D -m755 "src/convertit" "${pkgdir}/usr/bin/convertit"
}
[jbs@dmb-gaming-laptop convertit]$ 

Thanks for the help!


I am diagnosed with bipolar disorder. As it turns out, what I thought was my greatest weakness is now my greatest strength.

Everyday, I make a conscious choice to overcome my challenges and my problems. It's not easy, but its better than the alternative...

Offline

Board footer

Powered by FluxBB