You are not logged in.

#26 2005-04-03 17:50:39

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

I put up a screenie of my prototype,

but the point with libpypac/libpysrc is that you should code your own frontend,  8)


arch + gentoo + initng + python = enlisy

Offline

#27 2005-04-04 06:07:10

kcy29581
Member
From: CA
Registered: 2004-12-23
Posts: 231

Re: Lazy-Pac

nice stuff xerxes2. Any links to screenshots will be appreciated! Shame that only one person in this thread doesn't seem to agree with you. User contributions are great (one day I'll do something...sniff)


There is no spoon in Arch...

Offline

#28 2005-04-04 06:08:12

kcy29581
Member
From: CA
Registered: 2004-12-23
Posts: 231

Re: Lazy-Pac

I put up a screenie of my prototype,

but the point with libpypac/libpysrc is that you should code your own frontend, Cool

True, but seeing other peoples results is still nice! smile


There is no spoon in Arch...

Offline

#29 2005-04-04 20:30:00

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

there is a link to a screenie in thr first post if that's what you're looking for,


arch + gentoo + initng + python = enlisy

Offline

#30 2005-04-04 20:34:26

kcy29581
Member
From: CA
Registered: 2004-12-23
Posts: 231

Re: Lazy-Pac

right! completely missed out *stupid*


There is no spoon in Arch...

Offline

#31 2005-04-04 20:38:25

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

well, it was stupidly placed by me, I move it to the top instead,


arch + gentoo + initng + python = enlisy

Offline

#32 2005-07-04 20:08:05

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

i got inspired by team arch over at linuxtag so i fixed a few things in libpypac and added a few functions,

i also wrote a console frontend(lazy-pac-cli) which will also work as a much better manual for libpypac than the gui frontend which is cluttered by gtk code,

special thanks to iphitus for giving me a simple sollution for a nasty problem, smile


arch + gentoo + initng + python = enlisy

Offline

#33 2005-07-05 01:26:46

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Lazy-Pac

No problem, I need to use libpypac for the gtk frontend dibble requested. I'll be thanking you!

iphitus

Offline

#34 2005-07-05 03:35:39

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: Lazy-Pac

and added a few functions

I updated my install have I haven't had a chance to check out these new functions yet wink Thanks for the work but big_smile

Offline

#35 2005-07-06 15:14:21

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

i think of putting that database-optimize function in libpypac,

i'm so bloody lazy so i ask first if someone else could do it, tongue
it can't be more than 10 lines of code ...


arch + gentoo + initng + python = enlisy

Offline

#36 2005-07-06 19:28:39

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

i don't know exactly how the filesystem works,
something like this maybe:

# Optimize packagedatabase
def opt_packdb():
  tar = tarfile.open(root_dir + "packdb.tar", "w")
  tar.add(root_dir)
  tar.close()

  tar = tarfile.open(root_dir + "packdb.tar", "r")
  for i in tar:
    tar.extract(i, "/")

  tar.close()

arch + gentoo + initng + python = enlisy

Offline

#37 2005-07-06 23:51:19

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Lazy-Pac

Take a look at shutil.

http://docs.python.org/lib/module-shutil.html

iphitus

Offline

#38 2005-07-09 18:02:45

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

i don't know how to use that anyway iphitus,

all i do in the other function is to tar it down and then tar it up again,
is that enough or should there be more things done?


arch + gentoo + initng + python = enlisy

Offline

#39 2005-07-10 02:24:04

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Lazy-Pac

Shutil is just coping and moving functions.

All you really need to do is,

import shutil

shutil.copytree(src, destination)

shutil.rmtree(src)

shutil.copytree(destination,src)

mind you.... there's no error checking whatsoever in that, but thats what you'd have to do.

iphitus

Offline

#40 2005-07-10 15:06:16

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

just copy the files like that won't copy them physicly,
isn't that just a change in the filesystems journals?


arch + gentoo + initng + python = enlisy

Offline

#41 2005-07-23 09:58:31

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,750

Re: Lazy-Pac

Please can we have your PKGBUILDs in Aur

I'm sure many Archers would love to try them ;-)


Mr Green

Offline

#42 2005-07-23 20:36:01

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

they can be found on my site,
there are pkgbuilds for everything,
it's better so people don't think it's 'official' software,
the packages uses distutils now so they compiles to bytecode when you install them,  big_smile

lazy-edit is a must for all l33t editing,


arch + gentoo + initng + python = enlisy

Offline

#43 2005-07-24 07:48:02

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,750

Re: Lazy-Pac

lazy-edit should be in community ;-)


Mr Green

Offline

#44 2005-07-24 17:48:09

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Lazy-Pac

putting stuff in AUR doesn't make it official, it just makes it easier to find. :-P

Offline

#45 2005-07-24 18:32:02

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,750

Re: Lazy-Pac

you put it AUR every Arch user will vote for it .....

oops mentioned voting  :oops:


Mr Green

Offline

#46 2005-07-25 17:17:08

lunke
Member
From: Sweden
Registered: 2005-05-21
Posts: 86

Re: Lazy-Pac

Some things I think should be added to libpypac:

Ability to list packages in a group. This could sortof be done with checking the deps, but then you might get other deps as well.

Ability to check if a package is in a group.

Better error handling in pack_info(), I get exceptions on some packages because of poorly detailed packages. This is not really a problem with libpypac but still. This is the exception I get from user repos

Traceback (most recent call last):
  File "./paku-gui.py", line 175, in on_TreePkgsIn_select
    desc, deps = pac.pkginfo(model.get_value(iter,0), pac.repos)
  File "/home/lunke/Projekt/paku/paku_base.py", line 94, in pkginfo
    ret = libpypac.pack_info(pkgname, repos)
  File "/usr/lib/python2.4/site-packages/libpypac.py", line 1599, in pack_info
    index_next = package_desc_list.index("%CSIZE%")
ValueError: list.index(x): x not in list

Abillity to list packages that are not installed. I use this function for my frontend, but I guess it could do a bit pollishing. Use whatever you wish.

    def pkglist(self, repos):
        dir_local = "/var/lib/pacman/"
        installedpkgs = self.listinstalled()
        pkgname, pkgver, pkgrel, pkgrepo = [], [], [], []
        for i in range(0,len(repos)):
            repos[i] = repos[i].lstrip("[")
            repos[i] = repos[i].rstrip("]")
            list = os.listdir(dir_local + repos[i])
            list.sort(lambda x,y : cmp (x.lower(), y.lower()))
            for dir in list:
                if dir in installedpkgs: continue
                _item = dir.split("-")
                version = _item[len(_item)-2]
                release = _item[len(_item)-1]
                _item = _item[:-2]
                name = ""
                for n in range(0,len(_item)):
                    name += "-" + _item[n]
                name = name.lstrip("-")
                if release == ".lastupdate": continue
                pkgname.append(name)
                pkgver.append(version)
                pkgrel.append(release)
                pkgrepo.append(repos[i])
        return pkgname, pkgver, pkgrel, pkgrepo

Offline

#47 2005-07-25 22:02:56

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

hello lunke,
i've put the stuff in pack_info inside try statements to avoid errors, hope it works,

and for listing not installed packages i modified your function to fit into libpypac,

# List not installed packages (idea and initial code submitted by lunke)
def list_not_installed(server_list):
  localpkg_list = os.listdir(root_dir + "local")
  localpkg_list.sort(lambda x,y : cmp (x.lower(), y.lower()))
  name_list, ver_list, rel_list, repo_list = [], [], [], []
  
  for k in server_list:
    h = k.lstrip("[").rstrip("]")
    h_list = os.listdir(root_dir + h)
    h_list.sort(lambda x,y : cmp (x.lower(), y.lower()))
    try:
      h_list.remove(".lastupdate")
    except:
      pass
    for g in h_list:
      mode = "0"
      g_name, g_ver, g_rel = get_name(g)
      for i in localpkg_list:
        if i.startswith(g_name):
          i_name, i_ver , i_rel = get_name(i)
          if g_name == i_name:
            mode = "1"
  # This line doesn't work if packages exist on different servers(e.g if you use testing)
            localpkg_list.remove(i)
            break
      
      if mode == "0":
        name_list.append(g_name)
        ver_list.append(g_ver)
        rel_list.append(g_rel)
        repo_list.append(h)

  return name_list, ver_list, rel_list, repo_list

you can find a new version of libpypac at my site, if you want to change something just submit some code and i throw it in there, big_smile


arch + gentoo + initng + python = enlisy

Offline

#48 2005-07-26 13:04:19

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

Ability to list packages in a group. This could sortof be done with checking the deps, but then you might get other deps as well.

done, just check lazy-pac-cli for info,

Ability to check if a package is in a group.

on the todo list, i also went over the whole libpypac and cleaned it up a bit, it's 1656 lines now so it's nice if there is not so much crap in there,


arch + gentoo + initng + python = enlisy

Offline

#49 2005-07-27 23:57:11

lunke
Member
From: Sweden
Registered: 2005-05-21
Posts: 86

Re: Lazy-Pac

Found a bug in the download function, atleast I think so.

  for s in conf_list_new:
    if s.startswith("["):
      if s != "[" + repo + "]":
        break

should be:

  for s in conf_list_new:
    if s.startswith("["):
      if s != "[" + repo + "]":
        continue

Otherwise you won't be able to download from servers other then the one that is first in conf_list_new.

Offline

#50 2005-07-28 08:21:55

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: Lazy-Pac

i can't see that bug lunke, i just tried it with broken serverstrings and it worked,
those lines are for handling multiple listings of the same server,

conf_list_new =[ '[current]' '[current]', 'Server = ftp://******', ..., '[extra]', ...]

this is/was pacmans default layout, one in pacman.conf and one in the serverfile,


arch + gentoo + initng + python = enlisy

Offline

Board footer

Powered by FluxBB