[Abtlinux-svn] SF.net SVN: abtlinux: [156] src/trunk/abt.rb
Status: Alpha
Brought to you by:
eschabell
From: <esc...@us...> - 2006-10-15 12:02:33
|
Revision: 156 http://svn.sourceforge.net/abtlinux/?rev=156&view=rev Author: eschabell Date: 2006-10-15 05:02:27 -0700 (Sun, 15 Oct 2006) Log Message: ----------- Added the last scenarios options. Overview of available options: Usage: abt.rb [options] packages: -i, install [package] Install given package. -ri, reinstall [package] Reinstall given package. -r, remove [package] Remove given package. -dg, downgrade [version] [package] Downgrade given package to given version. -f, freeze [package] Holds given package at current version, prevents upgrades. queries: -s, search [string | regexp ] Search package descriptions for given input. show-details [package] Show give package details. show-build [package] Show build log of given package. show-depends [package] Show the dependency tree of given package. show-files [package] Show all installed files from given package. show-owner [file] Show the package owning given file. show-installed Show list of all installed packages. show-frozen Show list of all frozen packages. show-untracked Show all files on system not tracked by AbTLinux. show-journal Show the system journal. show-iqueue Show the contents of the install queue. show-patches Show the current available patches for installed package tree. generation: show-updates Show a package listing with available update versions. html Generate HTML page from installed packages: (package name with hyperlink to package website and version installed) downloads: -d, download [package] Retrieve given package sources. -u, update [package]|[tree] Update given package or tree from AbTLinux repository. -n, news Displays newsfeed from AbTLinux website. fix: purge-src Remove source caches for packages no longer installed. purge-logs Remove log files for packages no longer installed. verify-files [package] Installed files are verified for given package. verify-symlinks [package] Symlinks verified for given package. verify-deps [package] Dependency tree is verified for given package. verify-integrity [package] Verify integrity of installed files for given package. fix [package] Given package is verified and fixed if needed. maintenance: build-location [host] Sets global location (default: localhost) for retrieving cached package builds. package-repo [add|remove|list] [URI] add - add package repository to list. remove - remove a package repository from list. list - display current repository list. Modified Paths: -------------- src/trunk/abt.rb Modified: src/trunk/abt.rb =================================================================== --- src/trunk/abt.rb 2006-10-14 17:50:31 UTC (rev 155) +++ src/trunk/abt.rb 2006-10-15 12:02:27 UTC (rev 156) @@ -73,90 +73,97 @@ puts " verify-deps [package]\t\tDependency tree is verified for given package." puts " verify-integrity [package]\t\tVerify integrity of installed files for given package." puts " fix [package]\t\tGiven package is verified and fixed if needed." + puts + puts "maintenance:" + puts " build-location [host]\t\tSets global location (default: localhost) for retrieving cached package builds." + puts " package-repo [add|remove|list] [URI]" + puts " add - add package repository to list." + puts " remove - remove a package repository from list." + puts " list - display current repository list." end end - ## - # Parsing our options. - ## - options = Hash.new() - show = AbtUsage.new(); +## +# Parsing our options. +## +options = Hash.new() +show = AbtUsage.new(); + +if ( ARGV.length == 0 ) + show.usage +end + +case ARGV[0] - if ( ARGV.length == 0 ) +when "install", "-i" + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Installing package : " + options['package'] + else show.usage + exit end - case ARGV[0] - - when "install", "-i" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Installing package : " + options['package'] + +when "reinstall", "-ri" + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Reinstalling package : " + options['package'] + else + show.usage + exit + end + +when "remove", "-r" + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Removing package : " + options['package'] + else + show.usage + exit + end + +when "downgrade", "-dg" + if ( ARGV.length == 3 ) + options['version'] = ARGV[1] + options['package'] = ARGV[2] + puts "Downgradinging package : " + options['package'] + " to version : " + options['version'] + else + show.usage + exit + end + +when "freeze", "-f" + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Holdinging package : " + options['package'] + " at the current version." + else + show.usage + exit + end + +when "search", "-s" + if ( ARGV.length == 2 ) + options['searchString'] = ARGV[1] + puts "Searching package descriptions for : " + options['searchString'] else show.usage exit end - - - when "reinstall", "-ri" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Reinstalling package : " + options['package'] - else - show.usage - exit - end - - when "remove", "-r" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Removing package : " + options['package'] - else - show.usage - exit - end - - when "downgrade", "-dg" - if ( ARGV.length == 3 ) - options['version'] = ARGV[1] - options['package'] = ARGV[2] - puts "Downgradinging package : " + options['package'] + " to version : " + options['version'] - else - show.usage - exit - end - - when "freeze", "-f" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Holdinging package : " + options['package'] + " at the current version." - else - show.usage - exit - end - - when "search", "-s" - if ( ARGV.length == 2 ) - options['searchString'] = ARGV[1] - puts "Searching package descriptions for : " + options['searchString'] - else - show.usage - exit - end when "show-details" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Display details for package : " + options['package'] + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Display details for package : " + options['package'] else show.usage exit end when "show-build" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Display build log for package : " + options['package'] + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Display build log for package : " + options['package'] else show.usage exit @@ -164,134 +171,176 @@ when "show-depends" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Display dependency tree for package : " + options['package'] + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Display dependency tree for package : " + options['package'] else show.usage exit end when "show-files" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Display installed files from package : " + options['package'] + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Display installed files from package : " + options['package'] else show.usage exit end when "show-owner" - if ( ARGV.length == 2 ) - options['fileName'] = ARGV[1] - puts "Display owning package for file : " + options['fileName'] + if ( ARGV.length == 2 ) + options['fileName'] = ARGV[1] + puts "Display owning package for file : " + options['fileName'] else show.usage exit end when "show-installed" - puts "Display all installed packages." + puts "Display all installed packages." when "show-frozen" - puts "Display all packages frozen at current version." + puts "Display all packages frozen at current version." when "show-untracked" - puts "Display all files on system not tracked by AbTLinux." + puts "Display all files on system not tracked by AbTLinux." when "show-journal" - puts "Display system log with AbTLinux activity." + puts "Display system log with AbTLinux activity." when "show-iqueue" - puts "Display contents of install queue." + puts "Display contents of install queue." when "show-patches" - puts "Display currently available patches for installed package tree." + puts "Display currently available patches for installed package tree." when "show-updates" - puts "Display package listing with available update versions." + puts "Display package listing with available update versions." when "html" - puts "Generate HTML page from installed packages:" - puts " (package name with hyperlink to package website and version installed)" + puts "Generate HTML page from installed packages:" + puts " (package name with hyperlink to package website and version installed)" when "news", "-n" - puts "Display AbTLinux website newsfeed." - - when "download", "-d" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Retrieve sources for package : " + options['package'] + puts "Display AbTLinux website newsfeed." + +when "download", "-d" + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Retrieve sources for package : " + options['package'] + else + show.usage + exit + end + +when "update", "-u" + if ( ARGV.length == 2 ) + options['updateItem'] = ARGV[1] + puts "Updating this item (either package or a package tree : " + options['updateItem'] else show.usage exit end - - when "update", "-u" - if ( ARGV.length == 2 ) - options['updateItem'] = ARGV[1] - puts "Updating this item (either package or a package tree : " + options['updateItem'] - else - show.usage - exit - end when "purge-src" - puts "Remove source caches for packages no longer installed." + puts "Remove source caches for packages no longer installed." when "purge-logs" - puts "Remove log files for packages no longer installed." + puts "Remove log files for packages no longer installed." when "verify-files" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Installed files verified for package : " + options['package'] + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Installed files verified for package : " + options['package'] else show.usage exit end when "verify-symlinks" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Symlinks verified for package : " + options['package'] + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Symlinks verified for package : " + options['package'] else show.usage exit end when "verify-deps" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Symlinks verified for package : " + options['package'] + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Symlinks verified for package : " + options['package'] + else + show.usage + exit + end + +when "verify-integrity" + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Verifiy the integrity of installed files for package : " + options['package'] else show.usage exit end - - when "verify-integrity" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Verifiy the integrity of installed files for package : " + options['package'] + + when "fix" + if ( ARGV.length == 2 ) + options['package'] = ARGV[1] + puts "Package : " + options['package'] + " is verified and checked if needed." else show.usage exit end - when "fix" - if ( ARGV.length == 2 ) - options['package'] = ARGV[1] - puts "Package : " + options['package'] + " is verified and checked if needed." + when "build-location" + if ( ARGV.length == 2 ) + options['buildHost'] = ARGV[1] + puts "Sets global location for retrieving cached build packages to : " + options['buildHost'] else show.usage exit end - end # case + + when "package-repo" + + # sort out that we have enough args. + case ARGV.length + + # add or remove called. + when 3 + options['repoAction'] = ARGV[1] + options['repoUri'] = ARGV[2] + + # list called. + when 2 + if ( ARGV[1] == "list" ) + options['repoAction'] = ARGV[1] + else + show.usage + exit + end + + else + show.usage + exit + end - #puts 'DEBUG: options are -' - #puts 'package => ' + options['package'] - #puts 'DEBUG: argv is -' - #puts ARGV[0] - #puts ARGV[1] - #puts 'DEBUG: number of args are -' - #puts ARGV.length \ No newline at end of file + # hook location based on action. + case options['repoAction'] + + when "add" + puts "Adding package repository : " + options['repoUri'] + + when "remove" + puts "Remove package repository : " + options['repoUri'] + + when "list" + puts "Display listing of package repositories." + + else + show.usage + exit + end +end # case \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |