[Yum] yum-queue proof-of-concept script

Mihai Maties mihai at xcyb.org
Thu Mar 25 14:03:00 UTC 2004


I made a script (attached) based on Seth's idea about a queueing system addon 
to yum. The main difference is that I'm using another aproach on the queue: 
instead of queuing commands to be issued by yum I'm keeping lists of packages 
to be installed, removed, updated etc.

I didn't think that xml is best suited for this aproach therefore the script 
is written in bash and uses a file for saving the queue 
(default /var/cache/yum/yum.queue).

There are 5 queues INSTALL, REMOVE, UPDATE, GROUPINSTALL and GROUPUPDATE. 
Issuing the 'install' command adds the packages to the INSTALL queue, 
'update' to the UPDATE queue etc. The 'remove' command looks first if the 
packages are in the other queues and if it finds them it deletes them from 
there instead of adding them to the REMOVE queue. The same thing happens with 
the 'install'/'update' commands if the packages are queued to be removed: 
i.e. if package iptraf is in the REMOVE queue, issuing 'install iptraf' 
removes it from the queue instead of adding it to the INSTALL queue.

An output from the script that can make you better understand what it does 
follows:

( The help screen)
# ./yum-queue
yum-queue v0.1 - Mihai Maties <mihai at xcyb.org>

Usage: yum-queue <command>
  Valid commands:
    -h, --help, help            Guess what, this help screen
    s, sh, show                 Prints the current queue
    r, run                      Runs the queue (not implemented)
    +, install [package]...     Add the package(s) to the INSTALL queue
    -, rm, remove [package]...  Remove the package(s) from other queues or add
                                 them for removing from the system
    update [package]...         Add the package(s) to the UPDATE queue
    groupinstall [package]...   Add the package(s) to the GROUPINSTALL queue
    groupupdate [package]...    Add the package(s) to the GROUPUPDATE queue

(Showing the contents of the queue)
# ./yum-queue show
The queue is empty.

(Installing 3 packages)
# ./yum-queue install a1 a2 a3
Packages to REMOVE(0), INSTALL(3), UPDATE(0), GROUPINSTALL(0), GROUPUPDATE(0)

(Updating 3 packages)
# ./yum-queue update a3 b1 b2
Package a3 already in INSTALL queue, skipping.
Packages to REMOVE(0), INSTALL(3), UPDATE(2), GROUPINSTALL(0), GROUPUPDATE(0)

# ./yum-queue sh
The current contents of the queue follows:
Packages to be installed: a1 a2 a3
Packages to be updated: b1 b2

(Removing 3 packages; note that 'a1' was removed from the INSTALL queue 
instead of being added to the REMOVE queue)
# ./yum-queue remove a1 c1 c2 c3
Package a1 removed from INSTALL queue instead of being added to REMOVE queue.
Packages to REMOVE(3), INSTALL(2), UPDATE(2), GROUPINSTALL(0), GROUPUPDATE(0)

# ./yum-queue sh
The current contents of the queue follows:
Packages to be removed: c1 c2 c3
Packages to be installed: a2 a3
Packages to be updated: b1 b2

(Installing 2 more packages; note the warnings)
# ./yum-queue + c1 c2
Package c1 removed from REMOVE queue instead of being added to INSTALL queue.
Package c2 removed from REMOVE queue instead of being added to INSTALL queue.
Packages to REMOVE(1), INSTALL(2), UPDATE(2), GROUPINSTALL(0), GROUPUPDATE(0)

# ./yum-queue sh
The current contents of the queue follows:
Packages to be removed: c3
Packages to be installed: a2 a3
Packages to be updated: b1 b2


# ./yum-queue + c3
Package c3 removed from REMOVE queue instead of being added to INSTALL queue.
Packages to REMOVE(0), INSTALL(2), UPDATE(2), GROUPINSTALL(0), GROUPUPDATE(0)

# ./yum-queue sh
The current contents of the queue follows:
Packages to be installed: a2 a3
Packages to be updated: b1 b2

# ./yum-queue - a2 a3 b1 b2
Package a2 removed from INSTALL queue instead of being added to REMOVE queue.
Package a3 removed from INSTALL queue instead of being added to REMOVE queue.
Package b1 removed from UPDATE queue instead of being added to REMOVE queue.
Package b2 removed from UPDATE queue instead of being added to REMOVE queue.
Packages to REMOVE(0), INSTALL(0), UPDATE(0), GROUPINSTALL(0), GROUPUPDATE(0)

# ./yum-queue show
The queue is empty.

Comments/suggestions/bug-reports/improvements are of course welcomed.

The 'run' command is not implemented yet because I'm waiting for some feedback 
first. I didn't make up my mind about how exactly this will be implemented. 
yum -C would be the best aproach but...not always, so I'm still in the 
"evaluating side effects" process.


Mihai
-------------- next part --------------
A non-text attachment was scrubbed...
Name: yum-queue
Type: application/x-shellscript
Size: 11333 bytes
Desc: not available
Url : http://lists.baseurl.org/pipermail/yum/attachments/20040325/b9d6a8fd/attachment-0001.bin 


More information about the Yum mailing list