octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

automatic download of forge packages


From: Jaroslav Hajek
Subject: automatic download of forge packages
Date: Mon, 7 Jun 2010 10:00:58 +0200

hi all,

I was feeling playful today, so I tinkered a bit with pkg and
OctaveForge. The result is upstream:
http://hg.savannah.gnu.org/hgweb/octave/rev/76aba4305f1f

Summary:
pkg now accepts a -forge switch, only allowed with the "install" action.

octave:1> pkg list
Package Name    | Version | Installation directory
----------------+---------+-----------------------
       general *|   1.2.1 | /home/hajek/octave/general-1.2.1
 generate_html  |   0.1.3 | /home/hajek/octave/generate_html-0.1.3
linear-algebra *|   2.0.0 | /home/hajek/octave/linear-algebra-2.0.0
       nlwing2  |   1.2.0 | /home/hajek/octave/nlwing2-1.2.0
        octgpr  |   1.2.0 | /home/hajek/octave/octgpr-1.2.0

octave:2> pkg install -forge image

octave:3> pkg list
Package Name    | Version | Installation directory
----------------+---------+-----------------------
       general *|   1.2.1 | /home/hajek/octave/general-1.2.1
 generate_html  |   0.1.3 | /home/hajek/octave/generate_html-0.1.3
         image *|  1.0.13 | /home/hajek/octave/image-1.0.13
linear-algebra *|   2.0.0 | /home/hajek/octave/linear-algebra-2.0.0
       nlwing2  |   1.2.0 | /home/hajek/octave/nlwing2-1.2.0
        octgpr  |   1.2.0 | /home/hajek/octave/octgpr-1.2.0

Retrieving the current version as well as a download URL from the web
is handled by a separate function get_forge_pkg. It attempts to query
the package's index page, then greps for the proper info. it errors
out if unsuccessful, possibly suggesting correction of misspelled
package name.


octave:4> pkg install -forge miscelaneous
error: get_forge_pkg: package not found: "miscelaneous". Maybe you
meant "miscellaneous?"
error: called from:
error:   /home/hajek/devel/octave/main/scripts/pkg/get_forge_pkg.m at
line 71, column 9
error:   /home/hajek/devel/octave/main/scripts/pkg/pkg.m at line 2329, column 15
error:   /home/hajek/devel/octave/main/scripts/pkg/pkg.m at line 300, column 32


octave:4> pkg install -forge '~/hhome/general-1.2.1.tar.gz'
error: get_forge_pkg: invalid package name: ~/hhome/general-1.2.1.tar.gz
error: called from:
error:   /home/hajek/devel/octave/main/scripts/pkg/get_forge_pkg.m at
line 32, column 5
error:   /home/hajek/devel/octave/main/scripts/pkg/pkg.m at line 2329, column 15
error:   /home/hajek/devel/octave/main/scripts/pkg/pkg.m at line 300, column 32

octave:4> system ("sudo /sbin/ifdown eth0")
hajek's password:
    eth0      device: Realtek Semiconductor Co., Ltd. RTL8111/8168B
PCI Express Gigabit Ethernet controller (rev 01)
ans = 0

octave:5> pkg install -forge miscellaneous
error: get_forge_pkg: could not read URL, please verify internet connection
error: called from:
error:   /home/hajek/devel/octave/main/scripts/pkg/get_forge_pkg.m at
line 74, column 7
error:   /home/hajek/devel/octave/main/scripts/pkg/pkg.m at line 2329, column 15
error:   /home/hajek/devel/octave/main/scripts/pkg/pkg.m at line 300, column 32

open questions:
1. Maybe there should be some indicator that the web is being
accessed, although the user has explicitly asked for it?
2. get_forge_pkg is quite simplistic and will easily be fooled by
major OctaveForge web interface changes. Is it worth trying
to implement something more generic? Or can we simply say that we'll
change this function as needed, should such changes
ever occur again?
3. Obviously, I'll be glad if others can check my code and possibly improve it.

-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]