You are not logged in.

#1 2008-05-11 20:54:51

Jessehk
Member
From: Toronto, Ontario, Canada
Registered: 2007-01-16
Posts: 152

Icepac -- A very thin layer over the ABS

For more information, see the project page here and Icepac is available on the AUR here.

A little while ago, I came upon Lua which is a light language intended to be extended and/or embedded in other applications.
Having a deep love of C, I quickly started experimenting and playing with Lua.

Those experiments quickly lead to what I'd like to think is a nice little utility.
Oftentimes Archers use the ABS (Arch Linux Build System) to customize packages. Those customizations include updating versions, specifying configure options, altering installation locations, and others.

While the ABS couldn't be easier to use, I hated having to run a series of Bash commands in order to manually locate a package I want,
having to manually make a directory for it in a location of my choosing, and then having to manually copy the files over.

Icepac has  two functions: searching for a package in ABS and copying files. Certainly, these functions could be performed with a bit of Bash, but not only do I feel Icepac excels at these tasks (and only these tasks: icepac is tries to follow the KISS philosophy), but writing the thing in C and extending Lua was half the fun wink. I've also learned a great deal about autotools stuff such as autoconf, and libtool in the process of writing it.

What follows are essentially the contents of the README and an example configuration file:

--USAGE--

Icepac has two fundamental options: searching and installing.
In the first mode, searching, icepac will search all the repositories
specified in ~/.icepac (more on that below) for matches to
a search pattern.

icepac -s abc

will print an ordered list of packages matching the pattern "abc".
For example,

1 : abcm2ps
2 : abcde

Character classes and basic regex-like elements are available for use in patterns.
The patterns accepted are identical to those specified in the
Lua manual (http://www.lua.org/manual/5.1/manual.html#5.4.1 as of this writing) since
Lua functions are used to perform the matching.

For example,

icepac -s ^.%d

will search for packages that have a digit (0-9) in the second letter of their name.

The second mode of Icepac will attempt to find an exact match for
a specified package. If found, it will make a directory for that package
and copy all the package files to the new directory. The location
of the directory is specified by the user in ~/.icepac.

For example, if the package directory is /home/joe/abs then

icepac python

will move /var/abs/extra/python/* to /home/joe/abs/python.

--CONFIGURATION FILE FORMAT--

All configuration options for Icepac are stored in ~/.icepac, which is
a simple text file. Since Lua is used as the configuration file format,
the full Lua language is available. The following variables MUST be set (though
the way in which they are set is entirely optional):

====================
ABS_ROOT -- string
====================
ABS_ROOT is a string that points to the
directory where the root of the ABS tree resides.
On most systems, this is /var/abs.

For example,

ABS_ROOT = "/var/abs"

====================
LOCAL_DIR -- string
====================
LOCAL_DIR refers to the location where package files
from the ABS tree are copied to.

For example,

LOCAL_DIR = "/home/joe/pkg"

Means that a call such as 

icepac firefox

will copy all the firefox package files to /home/joe/pkg/firefox.

====================
REPOS -- table
====================
REPOS is a list of strings that
indicate which repositories will be searched for packages.

For example,

REPOS = {
    "core",
    "extra",
}

means that only packages present in the "core" and "extra" repositories
would be visible to Icepac.

Example ~/.icepac

-- A list of repositories in the ABS tree
-- which will be included when searching for
-- packages.
REPOS = {
    "core",
    "extra",
    "community",
}

-- The path to the root of the ABS tree.
ABS_ROOT = "/var/abs"

-- The path to the directory where you wish to
-- store your packages.
LOCAL_DIR = "/home/joe/abs"

Let me know what you all think (good, or bad)!

Last edited by Jessehk (2008-05-11 21:34:23)

Offline

#2 2008-05-11 22:30:31

aRcHaTe
Member
Registered: 2006-10-24
Posts: 646

Re: Icepac -- A very thin layer over the ABS

looks cool but inst the same as srcpac offers?....soooo...what this one as as a diference?....
keep up the good work wink


Its a sick world we live in....

Offline

#3 2008-05-11 22:36:12

Jessehk
Member
From: Toronto, Ontario, Canada
Registered: 2007-01-16
Posts: 152

Re: Icepac -- A very thin layer over the ABS

AFAIK, srcpac is sort-of an extension of pacman that enables it to compile packages form source. It is a somewhat complex tool.
Icepac is intended to be a simple tool with a simple function: it doesn't automatically prompt you to edit PKGBUILD or build the package.

It will simply search a specified list of repositories in the ABS tree and copy specific package files to a user-specific location.
For example, say I want to customize a python library package.

$ icepac -s ^python
1 : python-pyx
2 : python-pyxmpp
3 : python-mechanize
4 : python-lxml
5 : python-eagle
6 : python-psycopg1
7 : python-ldap
8 : python-clientform
9 : python-constraint
10: python-celementtree
11: python-geotypes
12: python-m2crypto
13: python-pymedia
14: python-telepathy
15: python-pypdf
16: python-psycopg2
17: python-numpy
18: python-pigment
19: python-vorbissimple
20: python-dateutil
21: python-reportlab
22: python-urwid
23: python-notify
24: python-pyserial
25: python-mpdclient2
26: python-boto
27: python-pexpect
28: python-sqlalchemy
29: python-pyparallel
30: python-gammu
31: python-matplotlib
32: python-galago-gtk
33: python-pychm
34: python-pytz
35: python-scipy
36: python-distutils-extra
37: python-fuse
38: python-pychart
39: python-numarray
40: python-dnspython
41: python-flup
42: python-chardet
43: python-galago
44: python-geotypes-svn
45: python-gnupginterface
46: python-musicbrainz2
47: python-bsddb
48: python-paramiko
49: python-pybluez
50: python-pygresql
51: python-docs
52: python-xlib
53: python-sqlobject
54: python-elementtree
55: python-gtkglext
56: python24
57: python-gdata
58: python-numeric
59: python-mpdclient
60: python-pysqlite
61: python
62: python-geoip
63: python-formencode
64: python-vpython
65: python-feedparser
66: python-qscintilla
67: python-logilab-common
68: python-pygame
69: python-opengl
70: python-pyspi
71: python-logilab-astng
72: python-pysqlite-legacy
73: python-mpd
74: python-cheetah
75: python-egenix-mx-base
76: python-eyed3
$ icepac python-pygame
Copy python-pygame to local directory? [y/N] y
python-pygame copied from /var/abs/extra/python-pygame to /home/jesse/abs/python-pygame

It is more of a convenience that anything. Rather than hide tedium, it simply automates it.

Last edited by Jessehk (2008-05-11 22:37:38)

Offline

#4 2008-05-11 22:40:49

aRcHaTe
Member
Registered: 2006-10-24
Posts: 646

Re: Icepac -- A very thin layer over the ABS

hoooo right...ok i can see its usefull..right on dude ill give it a try..it ay come in handy wink


Its a sick world we live in....

Offline

#5 2008-05-13 16:42:11

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Icepac -- A very thin layer over the ABS

srcpac is also floundering. Updates haven't been made in ages.

Offline

#6 2008-05-22 02:01:36

louipc
Member
Registered: 2006-10-09
Posts: 85

Re: Icepac -- A very thin layer over the ABS

Neat stuff man.
I would recommend finding ABS_ROOT from /etc/abs.conf.
If there's nothing there default to /var/abs, but also use
icepac config to override it at the user's option.

Also reading makepkg.conf for things like SRC_DIR and such
wouldn't hurt.

I'm working on a python tool (aurbuild) to do similar things
(and more). It still needs a lot of work though.

Offline

#7 2008-05-22 02:08:51

Jessehk
Member
From: Toronto, Ontario, Canada
Registered: 2007-01-16
Posts: 152

Re: Icepac -- A very thin layer over the ABS

Thanks for the tips louipc. smile

Initially, I looked at reading ABS_ROOT from /etc/abs.conf but as far as I understand it, ABS_ROOT has to be exported in order to be readable as an environmental variable. I guess I could read /etc/abs.conf from the C source, but I wouldn't know how. sad

Since I've posted this thread, I've both improved the existing code considerably and also made a few changes to ease use.
There is now a --noconfirm option, and Icepac will automatically create ~/.icepac (with a note) when it doesn't exist.
The last thing I want to add for now is the option of listing multiple packages to be installed instead of just allowing one.

The changes will be committed soon, I'll do some testing, and I'll eventually bump the version and update the AUR package. Thansk to all of you for your continued support and especially criticism. smile

EDIT: I should revise this. icepac doesn't yet create the ~/.icepac file if it doesn't exist.

Last edited by Jessehk (2008-06-08 21:44:45)

Offline

#8 2008-05-23 00:27:21

SpookyET
Member
Registered: 2008-01-27
Posts: 410

Re: Icepac -- A very thin layer over the ABS

Sweet. I'll try it.

Here's how I do it:
1) find /var/abs -iname "python*"
2) Look at the results
3) cp -R $(find /var/abs -iname "python*") /home/sorin/Packages/abs/

Offline

#9 2008-05-30 14:30:31

Jessehk
Member
From: Toronto, Ontario, Canada
Registered: 2007-01-16
Posts: 152

Re: Icepac -- A very thin layer over the ABS

With icepac 0.3.0 I've significantly improved the code and made a few usability improvements.

There are now --noconfirm and --quiet options as well as the ability to list multiple packages to install.
Speed has been improved too.

Enjoy (!), and don't be afraid to criticize or make suggestions.

icepac is still available on the AUR here and its googlecode homepage is here.

Last edited by Jessehk (2008-05-30 14:31:28)

Offline

#10 2008-05-30 14:56:55

xdeusx
Member
Registered: 2007-10-15
Posts: 168

Re: Icepac -- A very thin layer over the ABS

awesome tool big_smile
thanks

edit:
It would be great if this program would jump right into the copied folder...
Or provides a switch to do so...

Last edited by xdeusx (2008-05-30 15:07:17)

Offline

#11 2008-05-30 15:47:51

Jessehk
Member
From: Toronto, Ontario, Canada
Registered: 2007-01-16
Posts: 152

Re: Icepac -- A very thin layer over the ABS

xdeusx wrote:

awesome tool big_smile
thanks

edit:
It would be great if this program would jump right into the copied folder...
Or provides a switch to do so...

Thanks for the praise!

I like your idea; It shouldn't be too hard to add. smile

Offline

#12 2008-06-07 16:13:58

Jessehk
Member
From: Toronto, Ontario, Canada
Registered: 2007-01-16
Posts: 152

Re: Icepac -- A very thin layer over the ABS

This is in response to xdeusx:

On second thought, I think that feature conflicts with the ability to list multiple packages to be installed. Would icepac just take you to the directory of the last package you moved over to the local directory?

ie, given a command like

$ icepac -w perl python ruby

where -w is some sort of flag to indicate a directory switch, icepac would take you to $LOCAL_DIR/ruby following its execution? It seems awkward to me.

Would a switch to move to $LOCAL_DIR (where all the packages are stored) be a good compromise?

Last edited by Jessehk (2008-06-07 16:14:30)

Offline

#13 2008-06-08 10:06:43

xdeusx
Member
Registered: 2007-10-15
Posts: 168

Re: Icepac -- A very thin layer over the ABS

I didn't think about the problem with multiple packages, but a cd to $LOCAL_DIR would be just as great.

Offline

#14 2008-06-08 17:58:27

Jessehk
Member
From: Toronto, Ontario, Canada
Registered: 2007-01-16
Posts: 152

Re: Icepac -- A very thin layer over the ABS

After a bit of investigation, I don't think such a thing is possible. The reason being that when you run a program (such as icepac, in this case) it runs in its own process. I can change the current working directory of icepac during the course of its executation, but not the current working directory of the parent process (Bash, in this case).

Sorry. sad

Last edited by Jessehk (2008-06-08 21:42:51)

Offline

#15 2008-06-08 18:53:18

kevin89
Arch Linux f@h Team Member
From: Netherlands
Registered: 2007-03-14
Posts: 218

Re: Icepac -- A very thin layer over the ABS

Wow, this tool really really rocks.
Does only that what I want and nothing more.

Sweet! Thanks Jessehk! smile

Offline

#16 2008-06-08 20:03:45

xdeusx
Member
Registered: 2007-10-15
Posts: 168

Re: Icepac -- A very thin layer over the ABS

Jessehk wrote:

After a bit of investigation, I don't think such a thing is possible. The reason being that when you run a program (such as icepac, in this case) it runs in its own process. I can change the current working directory of the icepac during the course of its executation, but not the current working directory of the parent process (Bash, in this case).

Sorry. sad

A simple bash script does this now for me.
The trick is running this script with a dot in front of it so it gets executed in the current shell.
Maybe this helps, maybe not. It works for me though smile

#!/bin/bash
icepac "$@"
cd /var/abs/local/"$@"
[deus@laptop /]$ . ~/test.sh kernel26
Copy kernel26 to local directory? [y/N] y
kernel26 copied from /var/abs/core/kernel26 to /var/abs/local/kernel26
[deus@laptop kernel26]$

Offline

#17 2008-06-09 00:20:53

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: Icepac -- A very thin layer over the ABS

xdeusx wrote:

A simple bash script does this now for me.
The trick is running this script with a dot in front of it so it gets executed in the current shell.

or write it as a function in your shell:

This is what I use to prepare building from abs

absbuild () {
        export PKGBUILDPATH=$(find /var/abs -type d -name $1)
        mkdir ~/.abs/$1
        cp -R $PKGBUILDPATH/* ~/.abs/$1
        cd ~/.abs/$1
        unset PKGBUILDPATH
}

Maybe he could add a function to bashrc to source his program which will call "source cd ~/.abs/$1"
Or he could start building from inside the program (asking the user if he wants to review the PKGBUILD and the install file)
Even if a too much streamlined process, would be a pain probably...

Offline

#18 2008-06-17 16:15:50

Jessehk
Member
From: Toronto, Ontario, Canada
Registered: 2007-01-16
Posts: 152

Re: Icepac -- A very thin layer over the ABS

I've made some very minor changes to the code and bumped the version to 0.3.1.

I'm at a loss of what to add/change at this point -- icepac basically does what I want it to do. Any suggestions for features or bugs can be posted here.

Offline

Board footer

Powered by FluxBB