You are not logged in.

#1 2012-11-20 17:50:21

kevin89
Arch Linux f@h Team Member
From: Netherlands
Registered: 2007-03-14
Posts: 218

First PKGBUILD

Hello,

I'm trying to create an AUR package for a vim plugin. I've read the wiki and mostly just tried to copy from a working PKGBUILD in the AUR.

Basically, the only thing my package needs to do is copy the .vim file to $HOME/.vim/ftplugin/tex on install, and on uninstall it should delete the file.

I've come up with this:

 pkgname=tex-pdf
 pkgver=1.41
 pkgrel=1
 _scriptid=18261
 pkgdesc="Vim plugin for lightweight TeX compilation"
 arch=('any')
 url="http://www.vim.org/scripts/script.php?script_id=3230"
 license=('unknown')
 depends=('vim')
 groups=('vim-plugins')
 source=(${pkgname}.vim::http://www.vim.org/scripts/download_script.php?src_id=${_scriptid})
 md5sums=('265515e570b851fa74907231b2178615')
 
 package() {
   cd ${srcdir}
 
   install -m 700 -d tex_pdf.vim \
                 $pkgdir/$HOME/.vim/ftplugin/tex/tex_pdf.vim
 
 }

Now I can create and install the package (the file is copied to the right directory after install), but there are some problems:

1. On uninstall it deletes my $HOME./vim folder!
2. Namcap of the resulting package

tex-pdf W: File (home/) exists in a non-standard directory.
tex-pdf W: File (home/kevin/) exists in a non-standard directory.
tex-pdf W: File (home/kevin/.vim/) exists in a non-standard directory.
tex-pdf W: File (home/kevin/.vim/ftplugin/) exists in a non-standard directory.
tex-pdf W: File (home/kevin/.vim/ftplugin/tex/) exists in a non-standard directory.
tex-pdf W: File (home/kevin/.vim/ftplugin/tex/tex_pdf.vim/) exists in a non-standard directory.
tex-pdf W: Directory (home/kevin/.vim/ftplugin/tex/tex_pdf.vim) is empty
tex-pdf W: Dependency included and not needed ('vim')

3.

warning: directory permissions differ on home/kevin/
filesystem: 700  package: 755

Forgive my ignorance regarding creating AUR packages, I've tried to mimick some existing ones regarding vim plugins but to no avail so far. A push in the right direction would be cool!

Offline

#2 2012-11-21 00:44:23

Stebalien
Member
Registered: 2010-04-27
Posts: 1,224
Website

Re: First PKGBUILD

Packages should never touch home directories. Install to '/usr/share/vim/vimfiles/ftplugin/'.


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C
Do not email: honeypot@stebalien.com

Offline

#3 2012-11-21 17:06:38

kevin89
Arch Linux f@h Team Member
From: Netherlands
Registered: 2007-03-14
Posts: 218

Re: First PKGBUILD

Thank you for your comment, I got it working now. It's in the AUR now.

Offline

#4 2012-11-21 18:54:26

Stebalien
Member
Registered: 2010-04-27
Posts: 1,224
Website

Re: First PKGBUILD

A couple of notes on the packaging:
1. You don't need '|| return 1' anymore. The build will automatically fail if anything fails.
2. The downloaded file is a '.tar.gz' not a '.vim'. You probably shouldn't give it a '.vim' extension.
3. There is a reason the plugin is packaged under 'ftplugin/tex/' and not 'plugin/'. Putting the plugin under the former causes it to run only when editing a tex file while putting it under the latter causes it to always run.
4. VIM plugin packages are usually named 'vim-<name>' so this package would be vim-tex-pdf.


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C
Do not email: honeypot@stebalien.com

Offline

Board footer

Powered by FluxBB