You are not logged in.

#1 2011-10-05 17:25:04

monstermudder78
Member
Registered: 2008-05-18
Posts: 120

[SOLVED] PKGBUILD batterymon-clone

I have looked at the wiki for creating pkgbuilds and I think I am in over my head.  Troubleshooting one or two minor mistakes is a little different than writing one from scratch.  Could someone help me please?

https://github.com/denilsonsa/batterymon-clone

# Maintainer: Your Name <youremail@domain.com>
pkgname=batterymon-clone
pkgver=1.3.0
pkgrel=1
pkgdesc="a simple battery monitor tray icon using acpi"
arch=()
url=""
license=('GPL')
groups=()
depends=(python pygtk)
makedepends=()
optdepends=(notify-python)
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=($pkgname-$pkgver.tar.gz)
noextract=()
md5sums=() #generate with 'makepkg -g'

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

  ./configure --prefix=/usr
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  make DESTDIR="$pkgdir/" install
}

Thanks.

Edit to reflect completed PKGBUILD.
https://aur.archlinux.org/packages.php?ID=52974

Last edited by monstermudder78 (2011-10-06 22:12:47)

Offline

#2 2011-10-05 19:50:10

jomasti
Member
From: USA
Registered: 2010-08-17
Posts: 96

Re: [SOLVED] PKGBUILD batterymon-clone

Well, since you're wanting to use 1.3.0, you should switch to the 1.3.0 tag on Github, then get the download link for the tarball. Use 'makepkg -o' to extract it and check the src directory to see how the folder is named, then adjust the cd line accordingly. Second, you'll only need to use package() like used in the Python Package Guidelines in the wiki. You should change python to python2 in both package() and the depends, since that is what this uses. Also, notify-python is packaged as python-notify on Arch. I think that may be enough, but I can't actually test since I don't have access to my Arch machine, at the moment.

Offline

#3 2011-10-05 23:36:10

monstermudder78
Member
Registered: 2008-05-18
Posts: 120

Re: [SOLVED] PKGBUILD batterymon-clone

I have made a little progress, but still need more help/spoon-feeding.

I downloaded the .tar but makepkg -o only gave errors.  I extracted with tar but not sure what to look for next.

# Maintainer: Your Name <youremail@domain.com>
pkgname=batterymon-clone
pkgver=1.3.0
pkgrel=1
pkgdesc="a simple battery monitor tray icon using acpi"
arch=()
url=""
license=('GPL')
groups=()
depends=(python2 pygtk)
makedepends=()
optdepends=(python-notify)
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=(https://github.com/denilsonsa/batterymon-clone/tarball/v$pkgver)
noextract=()
md5sums=('149ee01cece897c6d8e5d42da52e2123')

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

  ./configure --prefix=/usr
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  make DESTDIR="$pkgdir/" install
}

Last edited by monstermudder78 (2011-10-05 23:38:17)

Offline

#4 2011-10-06 00:47:02

jomasti
Member
From: USA
Registered: 2010-08-17
Posts: 96

Re: [SOLVED] PKGBUILD batterymon-clone

Oops. Didn't notice the missing arch input. You should put arch=('any') for python packages, usually. That wiki page I linked you to earlier should have explained the rest of what you had to do, which is just use the package function, like below, except with the name of the directory that was extracted rather than $pkgname-$pkgver. Also, since there is another batterymon in the AUR, you should use conflicts=(batterymon) and provides=(batterymon), since you wouldn't need both of them.

package() {
  cd "$srcdir/$pkgname-$pkgver"
  python2 setup.py install --root="$pkgdir/" --optimize=1
}

EDIT: fixed some typing errors

Last edited by jomasti (2011-10-06 00:47:43)

Offline

#5 2011-10-06 01:16:48

monstermudder78
Member
Registered: 2008-05-18
Posts: 120

Re: [SOLVED] PKGBUILD batterymon-clone

Ok, I think I understood your last post, how does this look:

# Maintainer: Your Name <youremail@domain.com>
pkgname=batterymon-clone
pkgver=1.3.0
pkgrel=1
pkgdesc="A simple battery monitor tray icon using acpi"
arch=('any')
url=""
license=('GPL')
groups=()
depends=('python2' 'pygtk')
makedepends=()
optdepends=('python-notify')
provides=('batterymon')
conflicts=('batterymon')
replaces=()
backup=()
options=()
install=
changelog=
source=(https://github.com/denilsonsa/batterymon-clone/tarball/v$pkgver)
noextract=()
md5sums=('149ee01cece897c6d8e5d42da52e2123')

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

  ./configure --prefix=/usr
  make
}

package() {
  cd "$srcdir/denilsonsa-batterymon-clone-edf00a8/"
  python2 setup.py install --root="$pkgdir/" --optimize=1
}

Last edited by monstermudder78 (2011-10-06 01:19:07)

Offline

#6 2011-10-06 02:08:44

jomasti
Member
From: USA
Registered: 2010-08-17
Posts: 96

Re: [SOLVED] PKGBUILD batterymon-clone

Remove all of the build function, and it's good to go. You can remove the lines you aren't using, too, if you want.

Offline

#7 2011-10-06 17:00:18

monstermudder78
Member
Registered: 2008-05-18
Posts: 120

Re: [SOLVED] PKGBUILD batterymon-clone

So I have made it this far:
https://aur.archlinux.org/packages.php?ID=52974

However when I try to run batterymon I get the following error:

Traceback (most recent call last):
  File "/usr/bin/batterymon", line 589, in <module>
    main()
  File "/usr/bin/batterymon", line 578, in main
    pm = PowerManager()
  File "/usr/bin/batterymon", line 486, in __init__
    self.adapters = AcAdapterDetector().get_all()
  File "/usr/bin/batterymon", line 75, in get_all
    for name in os.listdir(basepath):
OSError: [Errno 2] No such file or directory: '/proc/acpi/ac_adapter'

So I still have some work to do.  Thank you though for getting me this far.

Offline

#8 2011-10-06 17:18:57

jomasti
Member
From: USA
Registered: 2010-08-17
Posts: 96

Re: [SOLVED] PKGBUILD batterymon-clone

Well, that doesn't look like a problem with the program because it runs fine for me. It's a problem with the ACPI. Did you build your own custom kernel? Might have left out some ACPI options in it. Or it could be something else. I'm not exactly sure.

Offline

#9 2011-10-06 20:07:56

monstermudder78
Member
Registered: 2008-05-18
Posts: 120

Re: [SOLVED] PKGBUILD batterymon-clone

No custom kernel that I am aware of, however I believe the problem is related to the EeePC 1000HE that I am using.

Thanks for all your help.

EDIT:
So this is what I have come up with:

$ batterymon
Traceback (most recent call last):
  File "/usr/bin/batterymon", line 589, in <module>
    main()
  File "/usr/bin/batterymon", line 578, in main
    pm = PowerManager()
  File "/usr/bin/batterymon", line 486, in __init__
    self.adapters = AcAdapterDetector().get_all()
  File "/usr/bin/batterymon", line 75, in get_all
    for name in os.listdir(basepath):
OSError: [Errno 2] No such file or directory: '/proc/acpi/ac_adapter'

$ acpitool -a
  AC adapter     : <info not available> 

$ acpi
Battery 0: Charging, 98%, charging at zero rate - will never fully charge.

Not sure if this sheds any light on what I may be able to tweak to get this to work or not?

Last edited by monstermudder78 (2011-10-06 22:11:37)

Offline

#10 2011-10-07 02:49:48

jomasti
Member
From: USA
Registered: 2010-08-17
Posts: 96

Re: [SOLVED] PKGBUILD batterymon-clone

No problem. I wonder what the issue is. Is the eeepc_laptop module loaded? Could acpi-eeepc-generic help? Or maybe adding acpi_osi=Linux to your GRUB boot line could help.

Offline

#11 2011-10-07 04:35:24

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: [SOLVED] PKGBUILD batterymon-clone

It might be acpitool. It went out of whack again with kernel 3.0.6. Or maybe /proc/acpitool isn't created.

Offline

#12 2011-10-07 17:06:44

monstermudder78
Member
Registered: 2008-05-18
Posts: 120

Re: [SOLVED] PKGBUILD batterymon-clone

Jomasti, could I ask what kernel you are using?  This is what the writer of v1.3.0 had to say:

I've looked at my 2.6.38 kernel, and I have this enabled:
CONFIG_ACPI_PROCFS_POWER:
For backwards compatibility, this option allows deprecated power /proc/acpi/ directories to exist, even when they have been replaced by functions in /sys. The deprecated directories (and their replacements) include:
/proc/acpi/battery/* (/sys/class/power_supply/*)
/proc/acpi/ac_adapter/* (sys/class/power_supply/*)
This option has no effect on /proc/acpi/ directories and functions, which do not yet exist in /sys This option, together with the proc directories, will be deleted in 2.6.39. So, batterymon-clone must be updated to support /sys/class/power_supply/*, instead of deprecated /proc/acpi/*

Does this make sense in relation to the kernel you are using?  I am using 3.0-ARCH and /proc/acpi/ac_adapter doesn't exist for me.

Offline

#13 2011-10-07 19:33:48

jomasti
Member
From: USA
Registered: 2010-08-17
Posts: 96

Re: [SOLVED] PKGBUILD batterymon-clone

Yes, that makes sense. I'm using linux-lqx from the AUR. I just checked the config for it, and it does have CONFIG_ACPI_PROCFS_POWER enabled. So I guess the problem lies with the software after all! My bad. Good to know, though.

Offline

Board footer

Powered by FluxBB