You are not logged in.

#1 2015-11-05 23:31:47

balinbob
Member
From: North Carolina
Registered: 2010-03-07
Posts: 21

my 1st PKGBUILD, for my own code...

Please, I would appreciate validation of and feedback on my first PKGBUILD.
The two plugins for Terminator are my code as well, and I'm new to Git.

This works for me, although there are some things I'm not sure about.  For one, I seem to have to create the
'/usr/share/doc/terminator-plugins' before using 'install', which it seems 'install' should do for me.   Also, is this
a suitable directory for these files?

# Maintainer: Bob Allred  <balinbob@gmail.com>
pkgname=terminator-plugins-git
pkgver=94964ae
pkgrel=1
pkgdesc='two plugins for customizing the terminator terminal emulator'
arch=('any')
url='https://github.com/balinbob/terminator-plugins'
license=('GPL2')
depends=('terminator')
makedepends=('git')
source=('git+https://github.com/balinbob/terminator-plugins')
md5sums=('SKIP')
install="${pkgname}.install"

_gitroot="https://github.com/balinbob/terminator-plugins"
_gitname="terminator-plugins"
build() {
  cd "${srcdir}"
  msg "Connecting to GIT server...."

  if [[ -d "${_gitname}" ]]; then
    cd "${_gitname}" && git pull origin
    msg "The local files are updated."
  else
    git clone "${_gitroot}" "${_gitname}"
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting build..."

  rm -rf "${srcdir}/${_gitname}-build"
  git clone "${srcdir}/${_gitname}" "${srcdir}/${_gitname}-build"

}

pkgver () {
  cd "${srcdir}/${_gitname}"
  echo $(git describe --always | sed 's/-/./g')
}

package() {
  cd "${srcdir}/${_gitname}-build"
  mkdir -p "${pkgdir}/usr/lib/python2.7/site-packages/terminatorlib/plugins"
  mkdir -p "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm755 ae.py setter.py my_plugin.py "${pkgdir}/usr/lib/python2.7/site-packages/terminatorlib/plugins" 
  install -Dm644 LICENSE INSTALL README.md "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim:set ts=2 sw=2 et:

thanks, Bob    smile

Offline

#2 2015-11-06 00:13:39

basica
Member
From: Australia
Registered: 2012-10-31
Posts: 217

Re: my 1st PKGBUILD, for my own code...

From my quick look: makepkg should do the pulling from git for you automatically. Check the git packages in the AUR to see some examples. Also regarding install, when using install it will only create the folder if you're installing a single file IIRC.

Offline

#3 2015-11-06 00:37:58

balinbob
Member
From: North Carolina
Registered: 2010-03-07
Posts: 21

Re: my 1st PKGBUILD, for my own code...

basica wrote:

From my quick look: makepkg should do the pulling from git for you automatically. Check the git packages in the AUR to see some examples. Also regarding install, when using install it will only create the folder if you're installing a single file IIRC.

As to the 'install' question, I think you hit the nail on the head, thanks!

The git clone's I got from other pkgbuilds, as you suggested.  Or from the /usr/share/pacman prototype pkgbuilds. I believe one is required to download the files, the other is to create a directory to build the package.  Then the original is left intact for future updates?

Thanks much

Offline

#4 2015-11-06 00:45:01

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

Re: my 1st PKGBUILD, for my own code...

Read this: https://wiki.archlinux.org/index.php/VC … guidelines
High points:
First, that whole git in the build function is from ancient PKGBUILDs, no longer relevant.

Second, git describe doesn't work when there's no tags.

Online

#5 2015-11-06 01:01:16

balinbob
Member
From: North Carolina
Registered: 2010-03-07
Posts: 21

Re: my 1st PKGBUILD, for my own code...

Scimmia, thank you.    I will try again!

Bob

Offline

#6 2015-11-06 01:40:35

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

Re: my 1st PKGBUILD, for my own code...

It's a good start - the above comments should have it in great shape.  But might I also suggest you reconsider the package name and description.

The description might be easier to start with: ok, two plugins to customize terminator ... but to customize it in what way?  "plugins to make terminator purple and print polar bear icons" would be a more clear - that is if that's what these did, I'm guessing it's not.

Then the package name might be easier to pin down once the description specifies what new behavior/feature/look-feel these add to terminator.  I suspect there are lots of terminator plugins, so calling your package "terminator-plugins" seems to try to own too big of a stage.  Following from my silly desciption above, one package name might be terminator-purple-bears-git.

EDIT: after checking out the github page, including background zoom and real-time appearance editor in the description would be good.  The package name could be trickier "terminator-backgroundzoom-rt-appearance-git" is getting too long.  Perhaps something like "terminator-BGZ-RTAE-plugins-git" could be a start.  This looses some clarity (but that could be provided in the description) but it does keep it short and identifies the plugins.  There is precident for brief initialisms for such things, just look at linux-rt or linux-ck.


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

Offline

#7 2015-11-06 15:55:42

balinbob
Member
From: North Carolina
Registered: 2010-03-07
Posts: 21

Re: my 1st PKGBUILD, for my own code...

@Trilby, thank you.

@all, please see the new PKGBUILD

# Maintainer: Bob Allred  <balinbob + gmail.com>
pkgname=terminator-plugins-bgz-rtae-git
pkgver=r5.94964ae
pkgrel=1
pkgdesc='backgroundzoom & appearanceeditor, plugins for customizing terminator terminal emulator'
arch=('any')
url='https://github.com/balinbob/terminator-plugins'
license=('GPL2')
depends=('terminator')
makedepends=('git')
source=('git+https://github.com/balinbob/terminator-plugins')
md5sums=('SKIP')
install="${pkgname}.install"
_gitname="terminator-plugins"

pkgver () {
  cd "${srcdir}/${_gitname}"
  ( set -o pipefail
    git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  )
}

package() {
  cd "${srcdir}/${_gitname}"
  mkdir -p "${pkgdir}/usr/lib/python2.7/site-packages/terminatorlib/plugins"
  mkdir -p "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm755 ae.py setter.py my_plugin.py "${pkgdir}/usr/lib/python2.7/site-packages/terminatorlib/plugins" 
  install -Dm644 INSTALL README.md "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

# vim:set ts=2 sw=2 et:

Offline

#8 2015-11-06 16:09:15

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

Re: my 1st PKGBUILD, for my own code...

Looks fine, from here we just nit-pick.

Functions are guaranteed to start in "$srcdir", so there's no need to have that in the inital "cd". Nothing wrong with having it there, either.

You're using the "-D" option on install when you've already made the dirs. No biggie, it works, but you could get rid of it. Or you could add the "-t" switch before the target dir and not worry about making them beforehand.

If you keep making the dirs beforehand, people generally use "install -d" instead of "mkdir -p". Again, no biggie.

Online

#9 2015-11-06 17:03:54

balinbob
Member
From: North Carolina
Registered: 2010-03-07
Posts: 21

Re: my 1st PKGBUILD, for my own code...

@Scimmia:

Thanks.   Yes, I see those things, and they are good to tidy up.

Offline

Board footer

Powered by FluxBB