You are not logged in.

#1 2013-03-01 21:04:59

Herk
Member
Registered: 2013-01-20
Posts: 4

lm-sensors LXDE lxpanel plugin PKGBUILD, please review

Hello,
I've written a PKGBUILD for the sensors_lxpanel_plugin package (http://danamlund.dk/sensors_lxpanel_plugin/) which allows to display different sensors in lxpanel. Since it's my first package, I'd be grateful if someone more experienced could take a look at the PKGBUILD and provide answers or pointers to answers to my questions below.

  1. I only tested it on my computer (x64). Is it safe to put i686 as architecture in the PKGBUILD? I see no reason why it shouldn't, but usually "if it's not tested, it's broken"... Perhaps someone with a i686 install could test it?

  2. It's possible to build and install the package without the lxpanel installed, but it wouldn't be very useful. Should lxpanel be ad dependency in the PKGBUILD? Namcap will complain of it. Or would it be better to have the install procedure print it somewhere? Also, see c)

  3. What if someone installs this package and then uninstalls lxpanel? Will pacman complain about files in the directory it tries to remove? Or installs this first and then lxpanel? Having lxpanel as depended package would solve this I guess. See b)

  4. It is required that you have run sensors-detect to have configured the sensors. Is it necessary to print that out during the install, or can the user be expected to read this at the homepage of the package?

  5. The package needs to be installed in the "plugins" folder under lxpanel (usually in /usr/lib/lxpanel/plugins/). Can I count on this during the installation? Running make install does not work with --prefix, so I made the package() function copy the necessary file the to the FAKEROOT/usr/lib/lxpanel/plugins/ directory. Any comments on this? Can it be improved? I can of course write some pre_install function which checks if it exists, and warn if it does not? What is good practice?


Here's the PKGBUILD

# Maintainer: Rikard Falkeborn <rikard.falkeborn@gmail.com>
pkgname=sensors_lxpanel_plugin
pkgver=1.0
pkgrel=1
pkgdesc="Monitor temperature/voltages/fan speeds in LXDE through lm-sensors."
arch=('i686' 'x86_64')
url="http://danamlund.dk/sensors_lxpanel_plugin"
license=('GPL2')
groups=(lxde)
depends=('gtk2' 'menu-cache' 'lm_sensors')
changelog=changelog
source=(http://danamlund.dk/sensors_lxpanel_plugin/${pkgname//_/-}-$pkgver.tar.gz)
md5sums=('949e9a8142872291c380e372b385920c')

build() {
  cd "$srcdir/${pkgname//_/-}-$pkgver"
  make
}

package() {
    PLUGIN_DIR='/usr/lib/lxpanel/plugins/'
    mkdir -p $pkgdir/usr/lib/lxpanel/plugins/
    cp $srcdir/${pkgname//_/-}-$pkgver/sensors.so $pkgdir/usr/lib/lxpanel/plugins/sensors.so
}

And the changelog (don't know if it's necessary?)

2013-03-01 Rikard Falkeborn <rikard.falkeborn@gmail.com>

	* 1.0-1 :
	First version of package.

Offline

#2 2013-03-01 21:19:52

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

Re: lm-sensors LXDE lxpanel plugin PKGBUILD, please review

For the most part, it looks good, so let's answer some of the questions.

a. I usually build a package in a clean chroot for i686. If it builds fine, I put it in the arch array. https://wiki.archlinux.org/index.php/De … ean_Chroot
b. Anything that's needed for the main function of the software should be in the depends array. In this case, if the plugin won't do anything without lxpanel, add it. Namcap's warnings are just to let you know about possible errors.
c. See b.
d. I would put any instructions like that in a post install script. You can run sensors-detect from the script if you'd like.
e. Usually, you add the --prefix to the make command, then use "make DESTDIR="$pkgdir" install" in the package function. If this doesn't work, use the "install" command to copy the file manually. install -Dm755 <source> <dest> will make all required directories, copy the file, and set the permissions to 755 (change that to whatever you need).

The changelog is completely optional.

Notes on the PKGBUILD:
You define PLUGIN_DIR, but then don't use it?
It's best to put anything that contains a variable in quotation marks like you did with the cd command. This prevents problems if it expands to include a space.

Last edited by Scimmia (2013-03-01 21:20:29)

Offline

#3 2013-03-02 15:54:44

Herk
Member
Registered: 2013-01-20
Posts: 4

Re: lm-sensors LXDE lxpanel plugin PKGBUILD, please review

Regarding e), thanks for the tip.

What I really meant to ask was the following: make install in the package does the following things:

install: 
	if [ -d "/usr/lib/lxpanel/plugins" ]; then \
	  cp sensors.so /usr/lib/lxpanel/plugins; \
	elif [ -d "/usr/lib64/lxpanel/plugins" ]; then \
	  cp sensors.so /usr/lib64/lxpanel/plugins; \
	else \
	  echo ;\
	  echo Couldn\'t find lxpanel/plugins directory.; \
	  echo Checked /usr/lib/lxpanel/plugins and /usr/lib64/lxpanel/plugins; \
	  echo Find it yourself by running \'locate deskno.so\'; \
	  echo Then copy sensors.so to that directory.; \
	fi

I.e., not possible to use the --prefix or DESTDIR if I understood it correctly. Even if it would have been, it would not possible to run makepkg since make install tries to locate /usr/lib/lxpanel/plugins which doesn't exist in the empty chroot (again, if I understand everything correct). That's the reason I just put the file in $pkgdir/usr/lib/lxpanel/plugins/sensors.so in package(). But what if someone has installed lxpanel into some different directory? Then sensors.so wont end up in the correct directory. Could/should the PKGBUILD handle that?

Updated PKGBUILD:

# Maintainer: Rikard Falkeborn <rikard.falkeborn@gmail.com>
pkgname=sensors_lxpanel_plugin
pkgver=1.0
pkgrel=1
pkgdesc="Monitor temperature/voltages/fan speeds in LXDE through lm-sensors."
arch=('i686' 'x86_64')
url="http://danamlund.dk/sensors_lxpanel_plugin"
license=('GPL2')
groups=(lxde)
depends=('lm_sensors' 'lxpanel')
source=(http://danamlund.dk/sensors_lxpanel_plugin/${pkgname//_/-}-$pkgver.tar.gz)
md5sums=('949e9a8142872291c380e372b385920c')

build() {
  cd "$srcdir/${pkgname//_/-}-$pkgver"
  make
}

package() {
     install -Dm755 "$srcdir/${pkgname//_/-}-$pkgver/sensors.so" "$pkgdir/usr/lib/lxpanel/plugins/sensors.so"
}

Offline

#4 2013-03-02 20:40:43

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: lm-sensors LXDE lxpanel plugin PKGBUILD, please review

Herk wrote:

But what if someone has installed lxpanel into some different directory? Then sensors.so wont end up in the correct directory. Could/should the PKGBUILD handle that?

If the user has customized lxpanel, it's up to the user to adapt this plugin accordingly for personal use.

You should only make these accommodations if there are multiple provisions for a package. For example, if you depend on java-environment, use stuff like $JAVA_HOME instead of a single implementation's hardcoded path.

Last edited by tdy (2013-03-02 20:41:59)

Offline

#5 2013-03-05 17:56:56

Herk
Member
Registered: 2013-01-20
Posts: 4

Re: lm-sensors LXDE lxpanel plugin PKGBUILD, please review

tdy wrote:
Herk wrote:

But what if someone has installed lxpanel into some different directory? Then sensors.so wont end up in the correct directory. Could/should the PKGBUILD handle that?

If the user has customized lxpanel, it's up to the user to adapt this plugin accordingly for personal use.

Ok, thanks. I think I'll upload this to the AUR when I get home.

Offline

#6 2013-03-19 14:59:36

breecummins
Member
Registered: 2012-10-31
Posts: 11

Re: lm-sensors LXDE lxpanel plugin PKGBUILD, please review

I don't see this in the AUR yet and I'm interested in trying the plugin. Will you upload it soon?

Offline

#7 2013-03-19 17:11:40

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: lm-sensors LXDE lxpanel plugin PKGBUILD, please review

Offline

#8 2013-03-19 18:20:45

breecummins
Member
Registered: 2012-10-31
Posts: 11

Re: lm-sensors LXDE lxpanel plugin PKGBUILD, please review

Thank you! Not sure why my searches failed.

Offline

Board footer

Powered by FluxBB