You are not logged in.
Hi there,
the following PKGBUILD works for me and I can use my scanner after installing it. Still, is there anything I missed in order to make this valid for the AUR?
pkgname=iscan-plugin-gt-1500
pkgver=2.2.0_1
pkgrel=1
pkgdesc="iscan plugin for the Epson GT-1500 scanner."
arch=('i686' 'x86_64')
url="http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX"
license=('custom')
depends=('iscan' 'iscan-data')
makedepends=('rpmextract')
install=gt-1500.install
source=(http://download.ebz.epson.net/dsc/f/01/00/02/09/21/79a6200fed4b7bd1c0ce04909e1a4f64e854b9fb/iscan-plugin-gt-1500-2.2.0-1.i386.rpm)
[[ $CARCH == "x86_64" ]] && \
source=(http://download.ebz.epson.net/dsc/f/01/00/02/09/21/89f74a7055d4c0fd8c7842a212e80f534b957bfa/iscan-plugin-gt-1500-2.2.0-1.x86_64.rpm)
md5sums=('7732026cc89dd7cf5502ce752d8d6930')
[[ $CARCH == "x86_64" ]] && md5sums=('8eb6899ce77a173c9c7366c1b6af7a04')
package() {
cd "$startdir"
rpmextract.sh $(basename ${source[0]})
cp -R $startdir/usr $pkgdir
mkdir $pkgdir/usr/share/licences
mv $pkgdir/usr/share/doc/iscan-plugin-gt-1500-2.2.0 $pkgdir/usr/share/licences/
rmdir $pkgdir/usr/share/doc
}
Thanks!
Last edited by bugfix (2013-04-11 13:28:56)
Offline
First of all, it looks like the way you're declaring your source and md5sum arrays doesn't make much sense. The easier way would be to have
if [[ "$CARCH" == "i686" ]]; then
source=('Source URL here')
md5sums=('mmm, checksums')
elif [[ "$CARCH" == "x86_64" ]]; then
source=('x64 source')
md5sums=('x64 checksums')
fi
On a related note, I'd recommend that you use one of the sha2 algorithms for hashing, not md5. Though md5 is still widely used, it really shouldn't be. Further more, you should have the rpmextract bit in the build() function, not the package function. Next, it may be worth your while, if you're going to extract things manually, to include that source-file in the noextract array. Next to last, avoid using "startdir", there are much better options to make things cleaner. And finally (after the quick glance that I had), always quote your variables (including "${pkgdir}" and "${srcdir}"), it's good form and will make things less likely to break.
[Edit]: A further suggestion: If you're going to use `cp`, in that case, I'd recommend you use `cp -dpr --no-preserve=ownership [directories you want to copy]`
All the best,
-HG
Last edited by HalosGhost (2013-04-10 23:26:23)
Offline
It's a good idea to include your .install in the source array and include a *sum for it. That way, if you ever change it, users that just download the updated PKGBUILD will get an integrity check fail because their .install is out of date.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Thank you very much for your input! I have only just adopted this package and wanted to change as little as possible (mainly replacing deb2targz with rpmextract) but your changes really make a lot of sense.
This is how it looks now, still works perfectly.
pkgname=iscan-plugin-gt-1500
pkgver=2.2.0_1
pkgrel=1
pkgdesc="iscan plugin for the Epson GT-1500 scanner."
arch=('i686' 'x86_64')
url="http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX"
license=('custom')
depends=('iscan' 'iscan-data')
makedepends=('rpmextract')
install=gt-1500.install
noextract=('iscan-plugin-gt-1500-2.2.0-1.i386.rpm' 'iscan-plugin-gt-1500-2.2.0-1.x86_64.rpm')
if [[ "$CARCH" == "i686" ]]; then
source=('http://download.ebz.epson.net/dsc/f/01/00/02/09/21/79a6200fed4b7bd1c0ce04909e1a4f64e854b9fb/iscan-plugin-gt-1500-2.2.0-1.i386.rpm' 'gt-1500.install')
sha256sums=('cbb3e7855b9d119aca3070777076d461125de9b907822a1d3fa4669b10cb6514' 'bcaa2139106cc7f3049008925de32e5f2c91f41dbdeba6bc5c9f65ae424efe26')
elif [[ "$CARCH" == "x86_64" ]]; then
source=('http://download.ebz.epson.net/dsc/f/01/00/02/09/21/89f74a7055d4c0fd8c7842a212e80f534b957bfa/iscan-plugin-gt-1500-2.2.0-1.x86_64.rpm' 'gt-1500.install
')
sha256sums=('f5e3efa4e739b80e87443b1b1124c79036ef7ed684d8d5f58f5ce4e5754516db' 'bcaa2139106cc7f3049008925de32e5f2c91f41dbdeba6bc5c9f65ae424efe26')
fi
build() {
cd "$srcdir"
rpmextract.sh "$(basename ${source[0]})"
}
package() {
cp -dpr --no-preserve=ownership usr "$pkgdir"
mkdir "$pkgdir"/usr/share/licences
mv "$pkgdir"/usr/share/doc/iscan-plugin-gt-1500-2.2.0 "$pkgdir"/usr/share/licences/
rmdir "$pkgdir"/usr/share/doc
}
First of all, it looks like the way you're declaring your source and md5sum arrays doesn't make much sense.
Your version indeed seems way more logical.
Further more, you should have the rpmextract bit in the build() function, not the package function.
I don't even know why I didn't put it there in the first place
Next to last, avoid using "startdir", there are much better options to make things cleaner.
It says so in the wiki as well, must have overread that.
always quote your variables (including "${pkgdir}" and "${srcdir}")
Will do!
It's a good idea to include your .install in the source array and include a *sum for it.
Smart!
Thank you again! Anything else that I missed?
Offline
Thank you very much for your input! I have only just adopted this package and wanted to change as little as possible (mainly replacing deb2targz with rpmextract) but your changes really make a lot of sense.
deb2targz isn't needed anyway. makepkg extracts with bsdtar, which extracts .deb files just fine. Cleaner solution, IMO, than requiring a makedep.
Online
bugfix wrote:Thank you very much for your input! I have only just adopted this package and wanted to change as little as possible (mainly replacing deb2targz with rpmextract) but your changes really make a lot of sense.
deb2targz isn't needed anyway. makepkg extracts with bsdtar, which extracts .deb files just fine. Cleaner solution, IMO, than requiring a makedep.
Your're right, this works just as well and doesn't require any makedepends...
pkgname=iscan-plugin-gt-1500
pkgver=2.2.0_1
pkgrel=1
pkgdesc="iscan plugin for the Epson GT-1500 scanner."
arch=('i686' 'x86_64')
url="http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX"
license=('custom')
depends=('iscan' 'iscan-data')
install=gt-1500.install
if [[ "$CARCH" == "i686" ]]; then
source=('http://download.ebz.epson.net/dsc/f/01/00/02/09/21/79a6200fed4b7bd1c0ce04909e1a4f64e854b9fb/iscan-plugin-gt-1500-2.2.0-1.i386.rpm' 'gt-1500.install')
sha256sums=('cbb3e7855b9d119aca3070777076d461125de9b907822a1d3fa4669b10cb6514' 'bcaa2139106cc7f3049008925de32e5f2c91f41dbdeba6bc5c9f65ae424efe26')
elif [[ "$CARCH" == "x86_64" ]]; then
source=('http://download.ebz.epson.net/dsc/f/01/00/02/09/21/89f74a7055d4c0fd8c7842a212e80f534b957bfa/iscan-plugin-gt-1500-2.2.0-1.x86_64.rpm' 'gt-1500.install
')
sha256sums=('f5e3efa4e739b80e87443b1b1124c79036ef7ed684d8d5f58f5ce4e5754516db' 'bcaa2139106cc7f3049008925de32e5f2c91f41dbdeba6bc5c9f65ae424efe26')
fi
build() {
cd "$srcdir"
}
package() {
cp -dpr --no-preserve=ownership usr "$pkgdir"
mkdir "$pkgdir"/usr/share/licences
mv "$pkgdir"/usr/share/doc/iscan-plugin-gt-1500-2.2.0 "$pkgdir"/usr/share/licences/
rmdir "$pkgdir"/usr/share/doc
}
Last edited by bugfix (2013-04-11 10:16:11)
Offline
Thank you again! Anything else that I missed?
First off, this looks far cleaner, so you're definitely on the right track. Here are a couple suggestions to clean it up a bit more. Instead of the `mv` command, it's considered better form (at least, from what I've seen) to use the `install` builtin. Next, wherever you can, try and make it so that things can be updated by just changing one of the variable/array declarations at the top rather than editing the whole PKGBUILD.
For instance, rather than having noextract declare the names of the source files verbosely, have them be declared using the variables:
noextract=("${pkgname}-${pkgver//_/-}.$CARCH.rpm")
Doing this means that on the release of a new version, you won't have to touch that array at all, and you only need to declare it for one item, not both explicitly as you have now. You can apply this logic throughout your PKGBUILD. At a glance, using this type of logic will allow you to clean up the `mv`/`install` command in the package() function, and your source arrays.
However, the source arrays, specifically, I think can be cleaned up quite a bit using this logic and refining the if/elif statement. Here's how I would do it:
if [[ "$CARCH" == "i686" ]]; then
_srcurl="http://download.ebz.epson.net/dsc/f/01/00/02/09/21/79a6200fed4b7bd1c0ce04909e1a4f64e854b9fb"
sha256sums=('cbb3e7855b9d119aca3070777076d461125de9b907822a1d3fa4669b10cb6514')
elif [[ "$CARCH" == "x86_64" ]]; then
_srcurl="http://download.ebz.epson.net/dsc/f/01/00/02/09/21/89f74a7055d4c0fd8c7842a212e80f534b957bfa"
sha256sums=('f5e3efa4e739b80e87443b1b1124c79036ef7ed684d8d5f58f5ce4e5754516db')
fi
source=("$_srcurl/${pkgname}-${pkgver//_/-}.$CARCH.rpm"
"gt-1500.install")
sha256sums+=('bcaa2139106cc7f3049008925de32e5f2c91f41dbdeba6bc5c9f65ae424efe26')
Also, because the source array is referenced by the noextract array, it is good form to have the noextract array follow the source array in the PKGBUILD.
And, if you follow Scimmia's advice and drop rpmextract from the makedepends, and just have it extract using the standard bsdtar (which is a good idea), there's no reason to have the build() at all. Just have the `cd "${srcdir}"` at the beginning of the package() function.
A last note, while all these things clean up the PKGBUILD so that it looks nicer and can be updated more simply in the future (by using variables to their fullest extent rather than hard-coded declarations), the beautiful thing about PKGBUILD is that it's essentially just bash scripting. If it builds correctly, installs correctly and works, then there's nothing wrong with putting it on the AUR.
[Edit]: I decided I liked this way of doing the if/elif statement better
All the best,
-HG
Last edited by HalosGhost (2013-04-11 10:39:26)
Offline
build() { cd "$srcdir" } package() { cp -dpr --no-preserve=ownership usr "$pkgdir" mkdir "$pkgdir"/usr/share/licences mv "$pkgdir"/usr/share/doc/iscan-plugin-gt-1500-2.2.0 "$pkgdir"/usr/share/licences/ rmdir "$pkgdir"/usr/share/doc }
It won't work quite like that, you probably didn't have a clean src dir. Once makepkg extracts the deb file, you end up with three files: control.tar.gz, data.tar.gz, and debian-binary. The program is in data.tar.gz, so you just have to extract that yourself. I do "bsdtar -xf data.tar.gz -C "$pkgdir"" in the package function to extract everything directly to $pkgdir.
And you don't need the build if it's not doing anything.
Last edited by Scimmia (2013-04-11 10:25:23)
Online
It won't work quite like that, you probably didn't have a clean src dir. Once makepkg extracts the deb file, you end up with three files: control.tar.gz, data.tar.gz, and debian-binary. The program is in data.tar.gz, so you just have to extract that yourself. I do "bsdtar -xf data.tar.gz -C "$pkgdir" in the package function to extract everything directly to $pkgdir.
And you don't need the build if it's not doing anything.
bugfix is using a .rpm now though
All the best,
-HG
Offline
Scimmia wrote:It won't work quite like that, you probably didn't have a clean src dir. Once makepkg extracts the deb file, you end up with three files: control.tar.gz, data.tar.gz, and debian-binary. The program is in data.tar.gz, so you just have to extract that yourself. I do "bsdtar -xf data.tar.gz -C "$pkgdir" in the package function to extract everything directly to $pkgdir.
And you don't need the build if it's not doing anything.
bugfix is using a .rpm now though
All the best,
-HG
I think you missed his last post...
Online
I think you missed his last post...
I don't think so. He applied what you said, that bsdtar could extract .debs to his current setup, still using a .rpm. Feel free to look at the code he posted again.
All the best,
-HG
Offline
wow, you're right. He kept the RPMs and just got rid of all of the extraction. That makes no sense at all.
Online
The license file should be named the same thing as the package. You don't need the version number appended.
Also, I find it more readable how the sha256sums work in a PKGBUILD like this one: https://aur.archlinux.org/packages/su/s … y/PKGBUILD; First it creates the arrays (assuming x86_86), then checks for i686 and overwrites the relevant key.
Means you only need the hash for the .install file once.
Offline
This is how it looks right now.
#Created with lots of help from HalosGhost, Scimmia and WorMzy
pkgname=iscan-plugin-gt-1500
pkgver=2.2.0_1
pkgrel=1
pkgdesc="iscan plugin for the Epson GT-1500 scanner."
arch=('i686' 'x86_64')
url="http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX"
license=('custom')
depends=('iscan' 'iscan-data')
install=gt-1500.install
if [[ "$CARCH" == "i686" ]]; then
_pkgurlid="79a6200fed4b7bd1c0ce04909e1a4f64e854b9fb"
sha256sums=('cbb3e7855b9d119aca3070777076d461125de9b907822a1d3fa4669b10cb6514')
elif [[ "$CARCH" == "x86_64" ]]; then
_pkgurlid="89f74a7055d4c0fd8c7842a212e80f534b957bfa"
sha256sums=('f5e3efa4e739b80e87443b1b1124c79036ef7ed684d8d5f58f5ce4e5754516db')
fi
source=("http://download.ebz.epson.net/dsc/f/01/00/02/09/21/$_pkgurlid/${pkgname}-${pkgver//_/-}.$CARCH.rpm"
"gt-1500.install")
sha256sums[1]='bcaa2139106cc7f3049008925de32e5f2c91f41dbdeba6bc5c9f65ae424efe26'
package() {
cd "$srcdir"
cp -dpr --no-preserve=ownership usr "$pkgdir"
mkdir "$pkgdir"/usr/share/licences
install -Dm644 "${pkgdir}/usr/share/doc/iscan-plugin-gt-1500-2.2.0/AVASYSPL.en.txt" "${pkgdir}/usr/share/licences/"
rm -r "$pkgdir"/usr/share/doc
}
Offline
The license file should be named the same thing as the package. You don't need the version number appended.
Also, I find it more readable how the sha256sums work in a PKGBUILD like this one: https://aur.archlinux.org/packages/su/s … y/PKGBUILD; First it creates the arrays (assuming x86_86), then checks for i686 and overwrites the relevant key.
Means you only need the hash for the .install file once.
Personally, I find that less readable, but to each their own.
You can still include the .install file and it's hash once by using things like "source+=" and "sha256sums+=" to append them to the arrays as HalosGhost already pointed out.
And I didn't realize that libarchive/bsdtar would extract rpms as well. It didn't the last time I tried it, but that was a long time ago. Makes rpm PKGBUILDs easier.
Last edited by Scimmia (2013-04-11 10:47:11)
Online
Personally, I find that less readable, but to each their own.
You can still include the .install file and it's hash once by using things like "source+=" and "sha256sums+=" to append them to the arrays as HalosGhost already pointed out.
I'm with Scimmia on this one, I really prefer the explicit if/elif statement and using the ARRAY+= setup. bugfix, I cleaned up the code I recommended earlier so it should play a bit nicer.
The last bit before you upload it is the maintainer tag. It should be a single line at the top of the form like this:
# Maintainer: your name (or handle) <your email at provider dot com>
All the best,
-HG
Offline
I really appreciate that you guys take the time to make sure it all works out.
# Maintainer:
#Created with lots of help from HalosGhost, Scimmia and WorMzy
pkgname=iscan-plugin-gt-1500
pkgver=2.2.0_1
pkgrel=1
pkgdesc="iscan plugin for the Epson GT-1500 scanner."
arch=('i686' 'x86_64')
url="http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX"
license=('custom')
depends=('iscan' 'iscan-data')
install=gt-1500.install
if [[ "$CARCH" == "i686" ]]; then
_srcurl="http://download.ebz.epson.net/dsc/f/01/00/02/09/21/79a6200fed4b7bd1c0ce04909e1a4f64e854b9fb"
sha256sums=('cbb3e7855b9d119aca3070777076d461125de9b907822a1d3fa4669b10cb6514')
elif [[ "$CARCH" == "x86_64" ]]; then
_srcurl="http://download.ebz.epson.net/dsc/f/01/00/02/09/21/89f74a7055d4c0fd8c7842a212e80f534b957bfa"
sha256sums=('f5e3efa4e739b80e87443b1b1124c79036ef7ed684d8d5f58f5ce4e5754516db')
fi
source=("$_srcurl/${pkgname}-${pkgver//_/-}.$CARCH.rpm"
"gt-1500.install")
sha256sums+=('bcaa2139106cc7f3049008925de32e5f2c91f41dbdeba6bc5c9f65ae424efe26')
package() {
cd "$srcdir"
cp -dpr --no-preserve=ownership usr "$pkgdir"
mkdir "$pkgdir"/usr/share/licences
install -Dm644 "${pkgdir}/usr/share/doc/iscan-plugin-gt-1500-2.2.0/AVASYSPL.en.txt" "${pkgdir}/usr/share/licences/"
rm -r "$pkgdir"/usr/share/doc
}
Good to go? If I want to update the package, I just resubmit my new tarball, right?
Last edited by bugfix (2013-04-12 15:20:30)
Offline
I really appreciate that you guys take the time to make sure it all works out.
Good to go? If I want to update the package, I just resubmit my new tarball, right?
Well, I'd follow SidK's advice about having the license named the name of the package where you install it. And, you can't just submit the pkg.tar.xz. You need to build the source package using `makepkg -S`, and then upload the resulting src.tar.gz.
Also, if you really want to reference other people who helped with the PKGBUILD, you can add Contributor lines. They look exactly the same as maintainer lines, but with "Contributor" instead of "Maintainer." If you honestly want to reference me in that list, you can grab the information from one of the PKGBUILDs I have up on the AUR, but you really don't need to.
Also, you can still clean up that `install` command using the variable logic I mentioned. I imagine it would look something like this:
install -Dm644 "${pkgdir}/usr/share/doc/${pkgname}-${pkgver//_1/}/AVASYSPL.en.txt" "${pkgdir}"/usr/share/licences/"${pkgname}"/
And Scimmia is correct, with the -D option on install, you shouldn't have the mkdir command.
All the best,
-HG
Last edited by HalosGhost (2013-04-11 11:04:32)
Offline
Not quite, your license installation still isn't right. If you do install with the -D option, you don't need the preceding mkdir, you need to put the file name in the destination, and it needs to be in a subdir with the pkgname. something like "$pkgdir/usr/share/licences/$pkgname/AVASYSPL.en.txt"
Online
I think we're getting there...
# Maintainer:
# Contributor: Sam Stuewe <halosghost at archlinux dot info>; Scimmia; WorMzy
pkgname=iscan-plugin-gt-1500
pkgver=2.2.0_1
pkgrel=1
pkgdesc="iscan plugin for the Epson GT-1500 scanner."
arch=('i686' 'x86_64')
url="http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX"
license=('custom')
depends=('iscan' 'iscan-data')
install=gt-1500.install
if [[ "$CARCH" == "i686" ]]; then
_srcurl="http://download.ebz.epson.net/dsc/f/01/00/02/09/21/79a6200fed4b7bd1c0ce04909e1a4f64e854b9fb"
sha256sums=('cbb3e7855b9d119aca3070777076d461125de9b907822a1d3fa4669b10cb6514')
elif [[ "$CARCH" == "x86_64" ]]; then
_srcurl="http://download.ebz.epson.net/dsc/f/01/00/02/09/21/89f74a7055d4c0fd8c7842a212e80f534b957bfa"
sha256sums=('f5e3efa4e739b80e87443b1b1124c79036ef7ed684d8d5f58f5ce4e5754516db')
fi
source=("$_srcurl/${pkgname}-${pkgver//_/-}.$CARCH.rpm"
"gt-1500.install")
sha256sums+=('bcaa2139106cc7f3049008925de32e5f2c91f41dbdeba6bc5c9f65ae424efe26')
package() {
cd "$srcdir"
cp -dpr --no-preserve=ownership usr "$pkgdir"
install -Dm644 "${pkgdir}/usr/share/doc/${pkgname}-${pkgver//_1/}/AVASYSPL.en.txt" "${pkgdir}/usr/share/licenses/${pkgname}/AVASYSPL.en.txt"
rm -r "$pkgdir"/usr/share/doc
}
Last edited by bugfix (2013-04-12 15:20:17)
Offline
If Scimmia and WorMzy don't mind being referenced, you should give them their own contributor lines. Other than that, it looks fine to me.
All the best,
-HG
Offline
If Scimmia and WorMzy don't mind being referenced, you should give them their own contributor lines. Other than that, it looks fine to me.
I'll give them their own lines if they're okay with that. I think credit should be given where credit is due.
Offline
Oh wait, it just dawned on me that you were writing i386 when referencing the ix86 source file. If it is i3 and not i6, then that source array won't work for x86 machines.
Okay, I think if you change the source=() array to the following, it should work fine, but I don't have an i686 install on me, so I do not have a simple way to test.
source=("$_srcurl/${pkgname}-${pkgver//_/-}.${CARCH//i686/i386}.rpm"
I genuinely don't know if that will work, but I think it might.
[Edit]: Alright, I actually do think that will work fine. Now that you've got the package up on the AUR, you should add [Solved] to the beginning of your thread title.
All the best,
-HG
Last edited by HalosGhost (2013-04-11 13:26:49)
Offline
Oh wait, it just dawned on me that you were writing i386 when referencing the ix86 source file. If it is i3 and not i6, then that source array won't work for x86 machines.
Okay, I think if you change the source=() array to the following, it should work fine, but I don't have an i686 install on me, so I do not have a simple way to test.source=("$_srcurl/${pkgname}-${pkgver//_/-}.${CARCH//i686/i386}.rpm"
I genuinely don't know if that will work, but I think it might.
[Edit]: Alright, I actually do think that will work fine. Now that you've got the package up on the AUR, you should add [Solved] to the beginning of your thread title.
All the best,
-HG
Good catch, I already thought that i686 superseded i386 or something...
Offline
Good catch, I already thought that i686 superseded i386 or something...
i386 and i686 are different architectures, but many companies release packages under the moniker "i386" when they often mean "ix86". Either way, the only reason the PKGBUILD would have failed for i686 platforms without that edit was because the name of the source file is "i386" even though it will likely function for i686 just fine so the download of the file itself would fail.
All the best,
-HG
Last edited by HalosGhost (2013-04-11 13:33:22)
Offline