LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-23-2006, 03:06 AM   #1
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Rep: Reputation: 31
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.
 
Old 04-23-2006, 03:45 AM   #2
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,544
Blog Entries: 4

Rep: Reputation: 56
What about swaret or slapt-get? Just seems like you're reinventing the wheel here...
 
Old 04-23-2006, 04:59 AM   #3
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Original Poster
Rep: Reputation: 31
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.
 
Old 04-23-2006, 06:26 AM   #4
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,544
Blog Entries: 4

Rep: Reputation: 56
What about them? You asked about other tools...
Quote:
should I use different tools (which?) ?
 
Old 04-23-2006, 07:22 AM   #5
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Original Poster
Rep: Reputation: 31
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.)
 
Old 04-23-2006, 08:59 AM   #6
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,544
Blog Entries: 4

Rep: Reputation: 56
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:
Code:
check-updates.py
|
+-checkers/
| |
| +-valknut.py
| +-dclib.py
| +-tor.py
| +-privoxy.py
|
+-updates.txt
+-error.log
check-updates.py 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 check-updates.py 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 :/
 
Old 04-23-2006, 10:43 AM   #7
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Original Poster
Rep: Reputation: 31
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!
 
Old 04-23-2006, 12:01 PM   #8
introuble
Member
 
Registered: Apr 2004
Distribution: Debian -unstable
Posts: 700

Original Poster
Rep: Reputation: 31
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 !
 
Old 04-23-2006, 12:19 PM   #9
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 59
Quote:
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.
 
Old 04-23-2006, 06:10 PM   #10
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,544
Blog Entries: 4

Rep: Reputation: 56
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine software versions Wim Sturkenboom Linux - Software 5 01-27-2005 01:21 AM
checking versions of apps bigeeguy Linux - Newbie 4 04-08-2004 05:32 PM
Security Checking Software Wibble Linux - Security 1 04-08-2004 10:27 AM
Checking software versions cav Linux - General 2 06-09-2003 01:24 PM
Checking Software? AMDPwred Linux - General 5 01-20-2002 11:54 AM


All times are GMT -5. The time now is 02:43 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration