-   Programming (
-   -   Checking for new versions of software (

introuble 04-23-2006 03:06 AM

Checking for new versions of software
Hello !

I hava a number of software installed that my distribution (Slackware) doesn't officially support (i.e. doesn't provide packages for). So what I did is either grab RPMs (and rpm2tgz them) or the sources (./configure && make + checkinstall && installpkg).

To be more specific, this software I have installed are 4 plugins from XFCE-goodies; Valknut (Direct Connect client) + dclib (a dependency of valknut); TOR (the onion router) + tor dependencies; Privoxy.

Now, since Slackware doesn't provide official packages for these, it won't provide eventual patches either; thus the task of keeping this software updated must be taken care of by me.

One way out would be to simply check (i.e. manually, with a browser/ftp client etc.) for new versions of each piece of software mentioned above .. but that's pretty nasty .. so I was thinking of building a script to do it. (*note: BASH script .. but I'm opened to suggestions)

Here's the skinny on what the script should do:
[*] Each piece of software mentioned above has an associated function
(i.e. valknut () { ... } ; tor () { ... } ; etc.)
[*] Each function does the following: checks a pre-defined web-resource for new versions of the software. The web-resources are the "download" pages for each piece of software which usually contain links of the form: "<program-name>-<program-version>.tar.gz" (or .rpm etc.).

Here's what I was thinking of: fetch a copy of the current "download" pages, extract all "versions" from it (i.e. all "<program-name>-<program-version>.tar.gz" instances from it) and keep this information on the hard drive. When the script is called, it cycles through all functions (thus checking for updates for all pieces of software); in each function, it fetches a copy of the current piece of software's "download" page, extracts all instances of "<program-name>-<program-version>.tar.gz" and compares this information to the local copy. If there's a difference between the two .. then probably a new version is available.

I was thinking of doing this with: wget; grep; sed and diff.

My questions are: does anyone have any ideas for a better way to check for updates ? can the "algorythm" above be improved ? should I use different tools (which?) ?

Thank you for your attention.

cs-cam 04-23-2006 03:45 AM

What about swaret or slapt-get? Just seems like you're reinventing the wheel here...

introuble 04-23-2006 04:59 AM

What about them ? I don't want to use any un-official package managers. Not that I don't trust them but .. I don't trust them .. so I'd rather build my own script.

cs-cam 04-23-2006 06:26 AM

What about them? You asked about other tools...

should I use different tools (which?) ?

introuble 04-23-2006 07:22 AM

No .. I meant .. should the script use other tools instead of "wget; grep; sed and diff".

Sticking to the "home-written" script. Not using stuff made by other people. ("If you want something done right, you have to do it yourself" ? heh. kidding.)

cs-cam 04-23-2006 08:59 AM

So are you planning on writing your own package manager or just a notification-style thing that checks software versions and lets you know of a change? If you want a package manager don't write your own, that's silly. Install one of the many minimal ones that are already written and just roll your own packages to it. If it's the latter you're looking for here's how I'd do it, this theory would work with any scripted language:
| |
+-error.log would truncate updates.txt to zero length on every run, then it would loop through and run all the scripts in checkers/, dumping any output on stderr to error.log and any output on stdout to updates.txt. Each script inside checkers/ would do it's own individual thing, parse a RSS feed, download directory or as a last resort, the HTML of the download page of each application to get the current version and compare it to the local version. You could grab the output of $CMD --version to do this. If there is a difference in versions, print that to stdout which in turn would end up in updates.txt.

Then it's a simple matter of running on each boot/login and then printing updates.txt to your terminal via ~/.bashrc (or whatever shell you use) to alert you to the need to upgrade, you'd also need to periodically check error.log to make sure everything is running smoothly as a minor change in the HTML of a pacge could throw your regex out. Note I'm half asleep so sorry if something there doesn't make sense or that paragraph is just too long :/

introuble 04-23-2006 10:43 AM

The latter it is indeed. Thanks for your suggestions. Yes, it's basically what I was thinking too. The best would be to have RSS feeds for each program .. but in many cases I simply have to fetch the HTML of the download page .. I wish there'd be a simple way (i.e. not have to download the whole page) in order to check if it has been updated since <date> or whatnot. (something like "browser caching" would be interesting).

By the way: would you mind pasting some code from your scripts ? (I understand if you don't.)

Thanks again!

introuble 04-23-2006 12:01 PM

Ah .. wait .. I think you've just added a reply in one of my other threads that you've never used Slackware .. so those ".py" things might have been just examples (or using them on another distro? (arch)). In any case, thanks again !

rickh 04-23-2006 12:19 PM


Valknut (Direct Connect client) + dclib (a dependency of valknut)
Kind of an aside here ... Debian unstable has the real DC++ built from CVS. Much more satisfactory, generally speaking, than Valknut.

cs-cam 04-23-2006 06:10 PM

I haven't written those scripts, that was just a suggestion of how you could set it up. The .py signifies a Python script which I would probably use but if shell is your thing then go that way :)

All times are GMT -5. The time now is 05:29 AM.