You are not logged in.
I've written a bash script that uses crontab to schedule a desktop background slideshow in GNOME 3.
I would like to share it with Arch users, so I've written my first PKGBUILD to fetch the script from my GitHub repository and create the corresponding package.
Here is the PKGBUILD:
# Maintainer: Mauro Fruet <maurofruet@gmail.com>
pkgname=dbsg-git
pkgver=20120409
pkgrel=1
pkgdesc="Schedule a desktop background slideshow in GNOME 3."
arch=('any')
url='https://github.com/maurofruet/dbsg'
license=('GPL3')
optdepends=('cron: allow to schedule a desktop background slideshow')
makedepends=('git')
install=dbsg.install
_gitroot=https://github.com/maurofruet/dbsg.git
_gitname=dbsg
build() {
cd "$srcdir"
msg "Connecting to GIT server...."
if [ -d "$_gitname" ]; then
cd "$_gitname" && git pull origin
msg "The local files are updated."
else
msg "Cloning $_gitroot..."
git clone --depth=1 "$_gitroot" "$_gitname"
fi
msg "GIT checkout done or server timeout."
}
package() {
cd "$srcdir/$_gitname"
install -Dm755 "$_gitname" "$pkgdir/usr/bin/$_gitname"
gzip -c "$_gitname.1" > "$_gitname.1.gz"
install -Dm644 "$_gitname.1.gz" "$pkgdir/usr/share/man/man1/$_gitname.1.gz"
}I have a couple of questions, before submitting the tarball:
- Are the arrays depends and optdepends correct? The script is designed to work only in GNOME 3, so should I put gnome-shell in the depends or optdepends array? namcap says I shouldn't.
- I haven't put any checksum in the PKGBUILD. namcap says it's not needed. Is it a problem?
Mauro
Offline
checksums are meant to verify downloaded files, but you don't download any files.
namcap only gives guidelines and mainly looks to the binaries in the package to determine which dependencies there are.
Since you designed it to run in Gnome3, a dependency unique to gnome3 is a good choice.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Thank you for the reply.
Now it's clear why makepkg -g didn't calculate any checksums.
I didn't put gnome-shell as a dependency because namcap says it's not necessary:
dbsg-git W: Dependency included and not needed ('gnome-shell')Indeed, the only commands in my script that depend on GNOME 3 are those that use gsettings to get and set the desktop background. However, if there is no process of gnome-shell in execution, these commands are not executed and an error message is printed by my script.
Do you think I should put gnome-shell in the depends array anyway? I can't put gnome, since it is a group of packages, not a package itself. Or can I? (I've tried, but makepkg fails)
Offline
Indeed, the only commands in my script that depend on GNOME 3 are those that use gsettings to get and set the desktop background. However, if there is no process of gnome-shell in execution, these commands are not executed and an error message is printed by my script.
I think only packages & virtual packages (like java-environment) can be used in depends.
You have cron as optdepend, does the script work without cron installed ?
If not, it should be a depend instead of an optdepend.
I've taken a peek at your script, and most of the lines appear to be desktop-agnostic, except :
gsettings set org.gnome.desktop.background picture-uri "$new"
/usr/bin/gsettings get org.gnome.desktop.background picture-urigsettings is in glib2 , the org.gnome.desktop.background schema is in gsettings-desktop-schemas .
Since gsettings-desktop-schemas requires glib2, gsettings-desktop-schemas should be in depends, but glib2 is not needed.
It does look like namcap may be correct that gnome-shell is not needed, and i have a strong feeling your script will work with things like gnome-fallback, unity and maybe even Mate (gnome2 fork).
If you don't feel like testing that , put gnome-shell in depends and add something in the readme-file that the script has only been tested with gnome-shell.
Last edited by Lone_Wolf (2012-04-10 10:26:23)
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
You have cron as optdepend, does the script work without cron installed ?
If not, it should be a depend instead of an optdepend.
I have to modify a little my script, but in principle it can be used even without scheduling the change of the desktop background. So I think cron should be in optdepends.
I've taken a peek at your script, and most of the lines appear to be desktop-agnostic, except :
gsettings set org.gnome.desktop.background picture-uri "$new" /usr/bin/gsettings get org.gnome.desktop.background picture-urigsettings is in glib2 , the org.gnome.desktop.background schema is in gsettings-desktop-schemas .
Since gsettings-desktop-schemas requires glib2, gsettings-desktop-schemas should be in depends, but glib2 is not needed.It does look like namcap may be correct that gnome-shell is not needed, and i have a strong feeling your script will work with things like gnome-fallback, unity and maybe even Mate (gnome2 fork).
If you don't feel like testing that , put gnome-shell in depends and add something in the readme-file that the script has only been tested with gnome-shell.
I have modified a bit my script and I have verified that it works even in gnome fallback mode. I will soon check if it works even with unity and mate.
It's quite strange, but namcap says that even gsettings-desktop-schemas is not needed. I think I'm going to include it anyway in depends, since I use gsettings to change the desktop background.
namcaps says also this:
dbsg-git W: Dependency bash detected but optional (programs ['bash'] needed in scripts ['usr/bin/dbsg'])Should I include also bash in depends? I've read that it has not to be put in makedepends (it's assumed to be installed), but what about depends? I think it wouldn't be necessary to put it there.
Offline
namcap' weakest point appear to be scripts, if gsettings-desktop-schemas is not present your script will fail so it should be in depends.
The wiki page about aur states that base & base-devel need to be installed if you use aur packages, so putting it in depends is not necessary.
Your script starts with #!bin/bash , so if bash is not installed users will get an error message.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Ok, thank you very much for your suggestions.
I've uploaded the package to the AUR, so if someone wants to try it, suggestions and bug reports are appreciated.
I've tested it on Gnome 3, gnome-fallback mode and also Unity. It may work even with mate, but I haven't tested this yet.
In the next future, I could extend it so that it can work also with other desktop environments.
Offline