LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Arch (https://www.linuxquestions.org/questions/arch-29/)
-   -   Unable to create functional PKGBUILD for font collection (https://www.linuxquestions.org/questions/arch-29/unable-to-create-functional-pkgbuild-for-font-collection-4175647817/)

Neyzan 02-07-2019 09:57 AM

Unable to create functional PKGBUILD for font collection
 
I am trying to create my first package with a collection of some fonts I use, to install on my Arch Linux system. I followed the relevant instructions to create a package for my fonts, but while I modified the template PKGBUILD accordingly I get the error "install: cannot stat 'OTF/*.otf': No such file or directory" (when I hash out the relevant line I get the same error for all "install" commands).
I uploaded the necessary files in my GitHub repo and made the following PKGBUILD.

Code:

pkgname=free-metal-fonts
pkgver=0.1
_relver=0.1
pkgrel=1
pkgdesc="This is a collection of rock and metal style free fonts compiled by Neyzan (NeyzanRumi)"
url="https://github.com/NeyzanRumi/Font-Collections/tree/master/Free-Metal-Fonts/"
arch=(any)
license=(SIL OFL v1.1 and GNU GPL v3)
_tarname=free-metal-fonts-${_relver//\//-}
source=("$_tarname.tar.gz::https://github.com/NeyzanRumi/Font-Collections/tree/master/Free-Metal-Fonts/$_relver.tar.gz")
sha256sums=('ef3180aab212b839e99665db67a821c074e8107ed4401878acff92e293d5d84d')

package() {
  cd $_tarname
  install -d "$pkgdir/usr/share/fonts/${pkgname%-fonts}"
  install -t "$pkgdir/usr/share/fonts/${pkgname%-fonts}" -m644 OTF/*.otf
  install -t "$pkgdir/usr/share/fonts/${pkgname%-fonts}" -m644 TTF/*.ttf
  install -Dm644 OFL "$pkgdir/usr/share/licenses/$pkgname/OFL"
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
  install -Dm644 README.md "$pkgdir/usr/share/licenses/$pkgname/README.md"
}

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

Can anyone tell me were I went wrong?

Roboron 02-07-2019 02:40 PM

Well the error is clear. You are trying to open a directory that doesn't exist (OTF).

mralk3 02-07-2019 04:49 PM

Unable to create functional PKGBUILD for font collection
 
Adjust the script to take the directory listing of the font files and loop through each one. Then copy each font into the desired location. I think you problem is due to the install command being unable to expand the directory listing. Check the man page.

Edit:. You could also simplify it all by using the cp command to copy the files and the chmod command to set the permissions.

ondoho 02-08-2019 01:08 PM

^ fwiw i read recently on bbs.archlinux.org that creators of PKGBUILDs are encouraged to use 'install' instead of sudo-copying etc.
i am positive that the install command can achieve what is desired here.
Code:

man install

Neyzan 02-15-2019 06:26 AM

I modified the PKGBUILD based on some other font packages (e.g.the otf-gfs) as shown below. The PKGBUILD now functions when I have the tarball on my system and give the PGKBUILD that particular sha256sum, but when I attempt to download it from my git repo I get a validation error and when I check the sha256sum is different. Any idea how to solve this?

Code:

pkgname=free-metal-fonts
pkgver=0.1
_relver=20190215
pkgrel=1
pkgdesc="This is a collection of rock and metal style free fonts compiled by Neyzan (NeyzanRumi)"
url="https://github.com/NeyzanRumi/Font-Collections/tree/master/Free-Metal-Fonts/"
arch=(any)
license=(SIL OFL v1.1 and GNU GPL v3)
makedepends=('tar')
depends=()

source=("https://github.com/NeyzanRumi/Font-Collections/tree/master/Free-Metal-Fonts/free-metal-fonts-20190215.tar.gz")
sha256sums=('ecf9f2f2b1eb3e16ff5cf966d1177fd21dc3eeb9bc3aefac8206ecfe6f460231')

package() {
  cd "$srcdir"
  tar -xvf free-metal-fonts-20190215.tar.gz
  sudo install -Dm755 $srcdir/free-metal-fonts-20190215/*otf /usr/share/fonts/
  sudo install -Dm755 $srcdir/free-metal-fonts-20190215/*ttf /usr/share/fonts/
  sudo install -Dm755 $srcdir/free-metal-fonts-20190215/*TTF /usr/share/fonts/
  sudo install -d /usr/share/licenses/$pkgname/
  sudo install -Dm755 $srcdir/free-metal-fonts-20190215/OFL /usr/share/licenses/$pkgname
  sudo install -Dm755 $srcdir/free-metal-fonts-20190215/COPYING /usr/share/licenses/$pkgname
  sudo install -Dm755 $srcdir/free-metal-fonts-20190215/README.md /usr/share/licenses/$pkgname
  sudo cat /usr/share/licenses/$pkgname/README.md
}


ondoho 02-16-2019 06:17 AM

Quote:

Originally Posted by Neyzan (Post 5962350)
but when I attempt to download it from my git repo I get a validation error and when I check the sha256sum is different. Any idea how to solve this?

AUR PKGBUILDS for *-git packages usually use 'SKIP' for the repo's checksum.


All times are GMT -5. The time now is 08:44 PM.