You are not logged in.

#1 2017-08-21 21:45:17

jahid
Member
From: Khulna, Bangladesh
Registered: 2017-06-06
Posts: 12
Website

My first PKGBUILD

I have built my first ever PKGBUILD for a small wrapper around pacaur that I am using (pacget). I like how pacaur works, but it does not provide the search functionality like yaourt. On the other hand yaourt prompts for confirmation before each install which is annoying. There are several wrappers of pacaur available, among them I tried pac which produced some errors. Anyway, I wanted to do something on my own, so I created a small script that wraps around pacaur and does some additional tasks that I require.

This is an example use case:

# Upgrade
pacget -Syu

# The following installs the package linux-lts
pacget -S linux-lts

# The following is a short form to pacget -S linux-lts
pacget linux-lts


# The following will search for gimp in both official repo and AUR
# and give you option to select packages to install
pacget -s gimp

# The following will search only arch official repo
# and give you option to select packages to install
pacget -Ss gimp

And an example screenshot:

https://neurobin.org/img/pacget-ex.png

Github | AUR

N.B: Suggestions and critics are welcome.

Last edited by jahid (2017-08-22 01:27:41)


Jahid | GithubTutorials

Offline

#2 2017-08-21 23:27:21

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: My first PKGBUILD

Read the Code of Conduct and only post thumbnails http://wiki.archlinux.org/index.php/Cod … s_and_code

and don't pacman -Sy $package, it breaks things.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-08-22 01:31:36

jahid
Member
From: Khulna, Bangladesh
Registered: 2017-06-06
Posts: 12
Website

Re: My first PKGBUILD

jasonwryan wrote:

don't pacman -Sy $package, it breaks things.

Thanks for the link, it explains it quite nicely. I have removed the -Sy thingy from the post and from my package.


Jahid | GithubTutorials

Offline

#4 2017-08-22 10:47:45

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

Re: My first PKGBUILD

jahid wrote:

I like how pacaur works, but it does not provide the search functionality

Are you sure?  It has documented methods for searching the repos and AUR as well as others for AUR-only searches.  It's also itself a wrapper to cower which definitely does search the AUR.

As for the PKGBUILD review, that'd be easier if it was posted here.  But some first notes:

1) The code has a BSD license, but your PKGBUILD lists the license as GPL.  Pick one.

2) Get rid of all the empty variables in the PKGBUILD.

3) This is not a vcs build, so use a checksum.

4) Get rid of all the empty functions (everything but package() can go).

Last edited by Trilby (2017-08-22 10:54:22)


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

Offline

#5 2017-08-22 13:19:19

jahid
Member
From: Khulna, Bangladesh
Registered: 2017-06-06
Posts: 12
Website

Re: My first PKGBUILD

Trilby wrote:
jahid wrote:

I like how pacaur works, but it does not provide the search functionality

Are you sure?  It has documented methods for searching the repos and AUR as well as others for AUR-only searches.  It's also itself a wrapper to cower which definitely does search the AUR.

jahid wrote:

I like how pacaur works, but it does not provide the search functionality like yaourt

yaourt search gives an interactive option to select single or multiple packages to install.

Thanks for the advices, I will implement them in next upload.


Jahid | GithubTutorials

Offline

#6 2017-08-22 14:00:05

jahid
Member
From: Khulna, Bangladesh
Registered: 2017-06-06
Posts: 12
Website

Re: My first PKGBUILD

Trilby wrote:

As for the PKGBUILD review, that'd be easier if it was posted here.

Current state of the PKGBUILD:

# Maintainer: Md. Jahidul Hamid <jahidulhamid@yahoo.com>
pkgname=pacget
pkgver=1.0.4
pkgrel=2
pkgdesc="A wrapper around pacaur to mimic yaourt's search feature"
arch=('any')
url="https://github.com/neurobin/pacget"
license=('BSD')
depends=('pacaur')
optdepends=('pkgfile: support for package search by file name')
source=("https://github.com/neurobin/$pkgname/archive/$pkgver.tar.gz")
md5sums=('6b1c401b998b4414c5ba7bb1099b28a7')
validpgpkeys=('3331 6137 5B22 27AC F7AA  6351 A4A2 CA5B 6BDA A871')

package() {
	cd "$pkgname-$pkgver"
	make DESTDIR="$pkgdir/" install
}

Last edited by jahid (2017-08-22 14:20:15)


Jahid | GithubTutorials

Offline

#7 2017-08-22 16:04:22

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

Re: My first PKGBUILD

You could rewrite the code to remove the pkgfile optdepend, all of pkgfiles functionality is now built directly into pacman (look at the man page for the -F switch).

Last edited by Slithery (2017-08-22 16:05:39)


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

#8 2017-08-27 13:57:52

jahid
Member
From: Khulna, Bangladesh
Registered: 2017-06-06
Posts: 12
Website

Re: My first PKGBUILD

slithery wrote:

You could rewrite the code to remove the pkgfile optdepend, all of pkgfiles functionality is now built directly into pacman (look at the man page for the -F switch).

Good point, I have updated it to wrap the -F switch to provide yaourt like search and install and removed pkgfile dependency.

PKGBUILD file

Last edited by jahid (2017-08-27 13:58:33)


Jahid | GithubTutorials

Offline

#9 2017-08-27 14:21:00

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

Re: My first PKGBUILD

Run your pacget script through www.shellcheck.net, it will point out the typo that you've missed smile

Last edited by Slithery (2017-08-27 14:21:16)


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

#10 2017-08-27 14:56:35

jahid
Member
From: Khulna, Bangladesh
Registered: 2017-06-06
Posts: 12
Website

Re: My first PKGBUILD

slithery wrote:

Run your pacget script through www.shellcheck.net, it will point out the typo that you've missed smile

Thanks for pointing out. Though the typo was harmless in this case tongue it did not have any impact. Other yellow colored warnings, you can ignore them, they have reasons to be like that wink

Last edited by jahid (2017-08-27 15:12:00)


Jahid | GithubTutorials

Offline

Board footer

Powered by FluxBB