You are not logged in.

#176 2012-01-26 15:17:24

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: Paconky: displays repo and AUR pkg info in conky

I have the same problem. It usually only shows the updates from AUR, only occasionally it shows updates from the official repository.

$ paconky /tmp/paconky
WARNING: database file for 'core' does not exist
WARNING: database file for 'extra' does not exist
WARNING: database file for 'community' does not exist
dropped info
dropped msearch
dropped search
${color1}${hr}
${color1}[${color2}AUR${color1}]                     ${color3}4 new packages
dmenu-xft                          4.5-1
dropbox                         1.2.51-1
sandfox                          1.1.2-1
ttf-ms-fonts                       2.0-9
${color1}${hr}

$ sudo pacman -Syu
:: Synchronizing package databases...
 core                     106.3 KiB   166K/s 00:01 [######################] 100%
 extra                   1183.5 KiB   255K/s 00:05 [######################] 100%
 community               1034.9 KiB   245K/s 00:04 [######################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for inter-conflicts...

Targets (16): chromium-16.0.912.77-1  curl-7.24.0-1  gcc-4.6.2-6
              gcc-libs-4.6.2-6  gtk-update-icon-cache-2.24.9-1  gtk2-2.24.9-1
              iproute2-3.2.0-2  libarchive-3.0.3-3  linux-3.2.1-2
              mdadm-3.2.3-1  poppler-0.18.3-1  poppler-glib-0.18.3-1
              sg3_utils-1.33-1  syslog-ng-3.3.4-1  udev-179-1
              wireless_tools-29-6

I hope it can be fixed. It was great to always know if there were updates, and for which packages.

Offline

#177 2012-02-04 05:10:33

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Paconky: displays repo and AUR pkg info in conky

Repo databases are downloaded by the pyalpm backend. It seems that pyalpm might not be handling HTTP errors correctly, because I see several error messages about failing to download different databases each time it is run.

This doesn't seem to be a direct paconky issue because the script on the site is the one that I am using, and I see all of the available updates. Presumably it manages to get all the databases after it runs a few times. You can try changing your main mirror to see if that helps, otherwise send the error messages to the pyalpm developer.

Btw, even if you see new packages when you run pacman -Syu, it doesn't necessarily mean that paconky isn't working. The update interval should be set to two hours, and the main mirror releases scripts in a cronjob (I think), so it may release hundreds of packages between 2 update intervals.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#178 2012-02-04 08:43:55

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: Paconky: displays repo and AUR pkg info in conky

Thanks. I changed mirror and now it works.

Offline

#179 2012-02-08 08:42:29

amsri
Member
Registered: 2011-06-17
Posts: 48

Re: Paconky: displays repo and AUR pkg info in conky

After I changed mirrors it started working but now again it doesn,t seem to be working, It is only saying all packages up-to-date while there are actually updates available.

Offline

#180 2012-02-08 21:48:34

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: Paconky: displays repo and AUR pkg info in conky

It seems that it only works after running pacman -Syu.

$ paconky /tmp/paconky
deleted 28 rows from info
${color1}${hr}
${color1}[${color2}local packages${color1}]              ${color3}up-to-date
${color1}${hr}

$ paconky /tmp/paconky2
WARNING: database file for 'core' does not exist
WARNING: database file for 'extra' does not exist
WARNING: database file for 'community' does not exist
${color1}${hr}
${color1}[${color2}local packages${color1}]              ${color3}up-to-date
${color1}${hr}

$ sudo pacman -Syu
Password: 
:: Synchronizing package databases...
 core                     106.5 KiB   325K/s 00:00 [######################] 100%
 extra                   1275.4 KiB   480K/s 00:03 [######################] 100%
 community               1093.9 KiB   476K/s 00:02 [######################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for inter-conflicts...

Targets (20): boo-0.9.4.9-2  cups-1.5.2-1  faad2-2.7-3
              hicolor-icon-theme-0.12-2  libasyncns-0.8-4  libcups-1.5.2-1
              libmad-0.15.1b-6  libraw1394-2.0.7-2  libsndfile-1.0.25-2
              libvorbis-1.3.3-1  linux-3.2.5-1  linux-firmware-20120205-1
              linux-headers-3.2.5-1  musicbrainz-2.1.5-5  ntfs-3g-2011.4.12-2
              ntfsprogs-2011.4.12-2  phonon-1:4.6.0-2  pm-utils-1.4.1-4
              tdb-1.2.9-2  zip-3.0-3

Total Download Size:    68.34 MiB
Total Installed Size:   178.73 MiB
Net Upgrade Size:       16.53 MiB

Proceed with installation? [Y/n]n

$ paconky /tmp/paconky3
WARNING: database file for 'core' does not exist
WARNING: database file for 'extra' does not exist
WARNING: database file for 'community' does not exist
${color1}${hr}
${color1}[${color2}core${color1}]                    ${color3}3 new packages
linux                            3.2.5-1
linux-firmware                20120205-1
linux-headers                    3.2.5-1
${color1}${hr}

${color1}${hr}
${color1}[${color2}extra${color1}]                  ${color3}17 new packages
boo                            0.9.4.9-2
cups                             1.5.2-1
[...]
${color1}${hr}

Offline

#181 2012-02-08 22:37:16

damacas
Member
From: Ontario, Canada
Registered: 2011-05-27
Posts: 50

Re: Paconky: displays repo and AUR pkg info in conky

I have tried changing the mirror several times with no change.  I can confirm Lennie's observation that it seems to work following a pacman database sync.

Offline

#182 2012-02-09 20:07:31

forkboy
Member
From: Blackpool, England
Registered: 2005-09-03
Posts: 74

Re: Paconky: displays repo and AUR pkg info in conky

Confirmed not working properly here too

Offline

#183 2012-02-16 10:30:50

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Paconky: displays repo and AUR pkg info in conky

I've updated the script. Please try it and let me know if it works.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#184 2012-02-16 22:48:48

damacas
Member
From: Ontario, Canada
Registered: 2011-05-27
Posts: 50

Re: Paconky: displays repo and AUR pkg info in conky

I updated the script, but I am having the same issues.  No notice of updates until I:

pacman -Sy

After that it reports the update-able packages.

Offline

#185 2012-02-17 09:03:51

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Paconky: displays repo and AUR pkg info in conky

I have uploaded another version. Please try again.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#186 2012-02-17 12:51:50

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: Paconky: displays repo and AUR pkg info in conky

Now it seems to work for me.  It shows one new package in extra, and I don't remember having run pacman -Sy... Nice to have it working again. Thank you.

Offline

#187 2012-02-17 12:55:33

damacas
Member
From: Ontario, Canada
Registered: 2011-05-27
Posts: 50

Re: Paconky: displays repo and AUR pkg info in conky

Great that did it here too.

Offline

#188 2012-02-19 03:18:00

damacas
Member
From: Ontario, Canada
Registered: 2011-05-27
Posts: 50

Re: Paconky: displays repo and AUR pkg info in conky

Hmm, well the script seemed to be working fine all day. Successfully reported new packages several times...and then:

paconky /home/jeff/.paconky/pacman/
Traceback (most recent call last):
  File "/usr/bin/paconky", line 243, in <module>
    main(sys.argv[1])
  File "/usr/bin/paconky", line 225, in main
    aur_pkgs = aur.info(foreign.keys())
  File "/usr/lib/python3.2/site-packages/AUR.py", line 653, in info
    return self.get('info', args)
  File "/usr/lib/python3.2/site-packages/AUR.py", line 547, in get
    for pkg in self.aur_info(not_found):
  File "/usr/lib/python3.2/site-packages/AUR.py", line 454, in aur_query
    result = aur_multiquery(typ, args)
  File "/usr/lib/python3.2/site-packages/AUR.py", line 77, in aur_multiquery
    f = urllib.request.urlopen(URL)
  File "/usr/lib/python3.2/urllib/request.py", line 138, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.2/urllib/request.py", line 375, in open
    response = meth(req, response)
  File "/usr/lib/python3.2/urllib/request.py", line 487, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.2/urllib/request.py", line 413, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.2/urllib/request.py", line 347, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.2/urllib/request.py", line 495, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

Offline

#189 2012-02-19 03:19:27

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Paconky: displays repo and AUR pkg info in conky

The AUR is down at the moment...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#190 2012-02-19 13:29:50

damacas
Member
From: Ontario, Canada
Registered: 2011-05-27
Posts: 50

Re: Paconky: displays repo and AUR pkg info in conky

OK, thanks jasonwryan, now that makes sense.  All is working again.

Offline

#191 2012-02-19 15:11:47

forkboy
Member
From: Blackpool, England
Registered: 2005-09-03
Posts: 74

Re: Paconky: displays repo and AUR pkg info in conky

Afraid it still doesn't work for me...

EDIT: apologies, it does appear to work now

Last edited by forkboy (2012-02-19 23:25:32)

Offline

#192 2012-02-26 04:48:18

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Paconky: displays repo and AUR pkg info in conky

I've moved the script on the server with the last server update. The link in the first post has been updated.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#193 2012-02-26 17:48:33

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Paconky: displays repo and AUR pkg info in conky

Bumping just to say that I've added exception handling to the db sync loop. It should now display something even when it fails to download some of the databases.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#194 2012-03-08 18:53:23

tjpp
Member
Registered: 2009-09-13
Posts: 9

Re: Paconky: displays repo and AUR pkg info in conky

Today, after an upgrade I got


tjpp@kauffmann:~$ ~/.scripts/paconky.py /tmp/paconky
Traceback (most recent call last):
  File "/home/tjpp/.scripts/paconky.py", line 77, in <module>
    import AUR
  File "/usr/lib/python3.2/site-packages/AUR.py", line 45, in <module>
    from XyneXDG.BaseDirectory import get_cache_home
ImportError: No module named BaseDirectory

Offline

#195 2012-03-08 22:59:56

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Paconky: displays repo and AUR pkg info in conky

Strange.

Try re-installing python3-xynexdg.
If it still doesn't work, post the output of "pacman -Qi python3-xynexdg" and "pacman -Ql python3-xynexdg".


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#196 2012-03-12 14:06:11

tjpp
Member
Registered: 2009-09-13
Posts: 9

Re: Paconky: displays repo and AUR pkg info in conky

I had:
tjpp@kauffmann:~$ yaourt python3-xynexdg
1 xyne-any/python3-xynexdg 2012.02.28.4117-1 [installed]
    Implementation of various freedesktop.org standards, for internal use in Xyne's modules.
2 aur/python3-xynexdg 2012.02.28.12269-1 [installed: 2012.02.28.4117-1] (9)
    Implementation of various freedesktop.org standards, for internal use in Xyne'"'"'s modules.
==> Digite o n° de pacotes a serem instalados (ex: 1 2 3 ou 1-3)
==> ------------------------------------------------------------
==> 2

Surprisingly, AUR is more recent than xyne-any. Now everything works. Thanks a lot

Offline

#197 2012-03-12 15:19:58

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Paconky: displays repo and AUR pkg info in conky

So everything is working again?


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#198 2012-04-03 05:09:19

enifeder
Member
Registered: 2012-03-21
Posts: 13

Re: Paconky: displays repo and AUR pkg info in conky

I am getting the following errors when trying to run this.

Traceback (most recent call last):
  File ".scripts/paconky.py", line 238, in <module>
    main(sys.argv[1])
  File ".scripts/paconky.py", line 189, in main
    os.rename(tmp_local_db_path, tmp_local_db_path + '.old')
OSError: [Errno 20] Not a directory

Can someone let me know what is going wrong here,
Thanks.

Offline

#199 2012-04-03 16:26:05

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Paconky: displays repo and AUR pkg info in conky

@enifeder
It probably means that you have something in the temporary database that shouldn't be there. What path are you passing to paconky? Check what's in that path.

I've updated it to handle such cases gracefully, but you should check what caused it.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#200 2012-04-04 12:34:39

enifeder
Member
Registered: 2012-03-21
Posts: 13

Re: Paconky: displays repo and AUR pkg info in conky

Xyne wrote:

@enifeder
It probably means that you have something in the temporary database that shouldn't be there. What path are you passing to paconky? Check what's in that path.

I've updated it to handle such cases gracefully, but you should check what caused it.

I am calling paconky with the following:

${execpi 3600 ~/.scripts/paconky.py ~/.scripts/repos.paconky}

repos.paconky:

#SET MSG_0 up to date
#SET MSG_1 1 new pkg
#SET MSG_N %N% new pkgs
#
${color1}repo status ${alignr}${color2}%MSG%${voffset 5}
${color3}%PKG_NAME% ${alignr}%PKG_VER%

And here is my paconky.py:

#!/usr/bin/env python3

# Author: Xyne

"""Display information about upgradable packages in Conky.

This script is meant to be customized. The default is just an example.

USAGE
  paconky.py /temporary/database/path

EXAMPLES
  A static path:

      paconky.py ~/.cache/pacman

  Using tmpfs:

      paconky.py /dev/shm/pacman

  If the XDG_CACHE_HOME variable is set with 1 path:

      paconky.py "$XDG_CACHE_HOME"/pacman

  ... or with multiple paths:

      paconky.py "$(echo $XDG_CACHE_HOME | cut -d':' -f1)"/pacman


DEPENDENCIES
  * pyalpm
  * python3-aur


EXAMPLE CONKY CONFIGURATION FILE

  alignment top_left
  gap_x 5
  gap_y 0
  maximum_width 200
  minimum_size 200,1
  own_window yes
  own_window_transparent yes
  own_window_type override
  own_window_hints below

  update_interval 3600
  total_run_times 0
  double_buffer yes

  use_xft yes
  xftfont lime:pixelsize=10
  xftalpha 0.9

  default_color ff0000
  default_outline_color black
  default_shade_color black

  uppercase no
  override_utf8_locale no

  text_buffer_size 4096

  color1 444444
  color2 cccccc
  color3 777777


  TEXT
  ${execp /path/to/paconky.py /tmp/paconky}



"""

import AUR
import pyalpm
import os
import sys

from collections import OrderedDict
from pycman import config, action_sync



def display(upgradable_sync, upgradable_aur):
  """Display the output.

  upgradable_sync: An OrderedDict of sync database names and sets of tuples.
  Each tuple consists of the local package and sync package returned by pyalpm.

  upgradable_aur: A list of tuples. Each tuple consists of the local package
  returned by pyalpm and a dictionary object returned from the AUR.

  """

  # Necessary because of the buggy way conky handles alignr.
  width = 40


  # To change the output, edit these formatting strings.
  # You can change anything except the number of "%s" in each.
  # If you need to insert a percent sign, use "%%".
  header = '${color1}${hr}\n${color1}[${color2}%s${color1}]%s${color3}%s'
  one = '1 new package'
  many = '%d new packages'
  line = '\n%s%s%s'
  footer = '\n${color1}${hr}\n${voffset 10}'

  # Nothing to upgrade.
  if not (upgradable_sync or upgradable_aur):
    hdr = 'local packages'
    msg = 'up-to-date'
    # -2 for brackets
    spacer = ' ' * (width - len(hdr) - len(msg) - 2)
    print(header % (hdr,spacer,msg) + footer);

  else:
    for k, v in upgradable_sync.items():
      hdr = k
      n = len(v)
      if n > 1:
        msg = many % n
      else:
        msg = one

      # -2 for brackets.
      spacer = ' ' * (width - len(hdr) - len(msg) - 2)
      print(header % (hdr,spacer,msg), end='');

      v = sorted(v, key=lambda x: x[0].name)
      for local, sync in v:
        name, version = local.name, sync.version
        spacer = ' ' * (width - len(name) - len(version))
        print(line % (name, spacer, version), end='')

      print(footer)


    if upgradable_aur:
      hdr = 'AUR'
      n = len(upgradable_aur)
      if n > 1:
        msg = many % n
      else:
        msg = one

      # -2 for brackets.
      spacer = ' ' * (width - len(hdr) - len(msg) - 2)
      print(header % (hdr,spacer,msg), end='');

      upgradable_aur.sort(key=lambda x: x[0].name)
      for local, aur in upgradable_aur:
        name, version = local.name, aur['Version']
        spacer = ' ' * (width - len(name) - len(version))
        print(line % (name, spacer, version), end='')

      print(footer)




def main(tmp_db_path):
  # Use a temporary database path to avoid issues caused by synchronizing the
  # sync database without a full system upgrade.

  # See the discussion here:
  #   https://bbs.archlinux.org/viewtopic.php?pid=951285#p951285

  # Basically, if you sync the database and then install packages without first
  # upgrading the system (-y), you can do some damage.

  
  tmp_db_path = os.path.abspath(tmp_db_path)
  conf = config.PacmanConfig(conf = '/etc/pacman.conf')
  db_path = conf.options['DBPath']
  if tmp_db_path == db_path:
    print("temporary path cannot be %s" % db_path)
    sys.exit(1)
  local_db_path = os.path.join(db_path, 'local')
  tmp_local_db_path = os.path.join(tmp_db_path, 'local')

  # Set up the temporary database path
  if not os.path.exists(tmp_db_path):
    os.makedirs(tmp_db_path)
    os.symlink(local_db_path, tmp_local_db_path)
  elif not os.path.islink(tmp_local_db_path):
    # Move instead of unlinking just in case.
    os.rename(tmp_local_db_path, tmp_local_db_path + '.old')
    os.symlink(local_db_path, tmp_local_db_path)


  # Redirect the stdout messages download messages to stderr.
  with open(os.devnull, 'w') as f:
    sys.stdout = f
    action_sync.main(('-b', tmp_db_path, '-y'))
    sys.stdout = sys.__stdout__

  installed = set(p for p in pyalpm.get_localdb().pkgcache)
  upgradable = OrderedDict()

  syncdbs = pyalpm.get_syncdbs()
  for db in syncdbs:
    # Without "list" the set cannot be altered with "remove" below.
    for pkg in list(installed):
      pkgname = pkg.name
      syncpkg = db.get_pkg(pkgname)
      if syncpkg:
        if pyalpm.vercmp(syncpkg.version, pkg.version) > 0:
          try:
            upgradable[db.name].add((pkg, syncpkg))
          except KeyError:
            upgradable[db.name] = set(((pkg, syncpkg),))
        installed.remove(pkg)

  foreign = dict([(p.name,p) for p in installed])

  try:
    aur = AUR.AUR(threads=10)
    aur_pkgs = aur.info(foreign.keys())
  except AUR.AURError as e:
    sys.stderr.write(str(e))
    sys.exit(1)

  upgradable_aur = list()
  for aur_pkg in aur_pkgs:
    installed_pkg = foreign[aur_pkg['Name']]
    if pyalpm.vercmp(aur_pkg['Version'], installed_pkg.version) > 0:
      upgradable_aur.append((installed_pkg, aur_pkg))
    installed.remove(installed_pkg)

  display(upgradable, upgradable_aur)



if __name__ == "__main__":
  if sys.argv[1:]:
    main(sys.argv[1])
  else:
    print("no temporary path given")
    sys.exit(1)

All files have the right permissions

Offline

Board footer

Powered by FluxBB