slack-utils 0.6.2 → 0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -32,35 +32,24 @@ by unistalled/upgraded packages
32
32
  expects 1 argument passed.
33
33
 
34
34
 
35
- TODO:
36
- * 2010-08-20 09:16 <bailey> which is that I need to run a query to show
37
- me what packages I'm running are different than the slack-current
38
- versions, since I make local ones and forget about it
39
- * enable `slf` to a relative path, and it determine the absolute path
40
-
41
35
  == Installation
42
36
 
43
37
  === From git
44
38
 
45
- git clone git://github.com/vbatts/slack-utils.git
46
-
47
- make slackpkg
48
-
49
- sudo upgradepkg --install-new pkg/slack-utils-0.6.2-$ARCH-1_vb.tgz
39
+ >> git clone git://github.com/vbatts/slack-utils.git
40
+ >> make slackpkg
41
+ >> sudo upgradepkg --install-new pkg/slack-utils-0.6.2-$ARCH-1_vb.tgz
50
42
 
51
43
  === From tar ball
52
44
 
53
- tar xfz slack-utils-0.6.2.tar.gz
54
-
55
- cd slack-utils-0.6.2
56
-
57
- ruby setup.rb config --prefix=/usr --mandir=/usr/man
58
-
59
- ruby setup.rb install
45
+ >> tar xfz slack-utils-0.6.2.tar.gz
46
+ >> cd slack-utils-0.6.2
47
+ >> ruby setup.rb config --prefix=/usr --mandir=/usr/man
48
+ >> ruby setup.rb install
60
49
 
61
50
  === From the gem
62
51
 
63
- sudo gem install pkg/slack-utils-0.6.2.gem
52
+ >> sudo gem install pkg/slack-utils-0.6.2.gem
64
53
 
65
54
 
66
55
  == Quick Start
@@ -78,7 +67,7 @@ See the system manual page slack-utils(8)
78
67
  >> pkg.name = "hello-kitty"
79
68
  >> pkg.version = "1.0"
80
69
 
81
- or
70
+ or
82
71
  >> require 'rubygems'
83
72
  >> require 'slackware'
84
73
  >> tags = Slackware::System.tags_used
data/bin/slf CHANGED
@@ -1,5 +1,5 @@
1
1
  #! /usr/bin/ruby
2
- # Copyright 2010,2011 Vincent Batts, Vienna, VA
2
+ # Copyright 2010,2011,2012 Vincent Batts, Vienna, VA
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use of this source, with or without modification, is
@@ -22,34 +22,46 @@
22
22
  $PROGRAM_NAME = File.basename(__FILE__)
23
23
 
24
24
  require 'rubygems'
25
+ require 'slackware/log'
25
26
  require 'slackware/utils'
26
27
  require 'slackware/args'
27
28
 
28
29
  option_banner = <<-EOS
29
30
  Search for a file within installed Slackware package's FILE LIST.
30
31
  Usage:
31
- #{File.basename(__FILE__)} [options] [pkg search flags] <one or more files>
32
-
33
- one or more files must be list
34
- if no search flags, only names, then those only those matching entries are listed
32
+ #{$PROGRAM_NAME} [options] [pkg search flags] <one or more files>
33
+
34
+ one or more files must be list
35
+ if no search flags, only names, then those only those matching entries are listed
35
36
  EOS
36
37
  # This is all the flags we want to use, from Slackware::Args
37
38
  option_flags = [:color, :case_insensitive, :pkg_name, :pkg_version,
38
- :pkg_arch, :pkg_build, :pkg_tag]
39
+ :debug, :pkg_arch, :pkg_build, :pkg_tag]
40
+
41
+ slog = Slackware::Log.instance
42
+ slog.level = Slackware::Log::WARN
39
43
 
40
44
  options = Slackware::Args.parse(ARGV, option_flags, option_banner)
41
45
 
46
+ # update level if specified
47
+ slog.level = Slackware::Log::DEBUG if options[:debug]
48
+ slog.debug($PROGRAM_NAME) {"options: %s" % options}
42
49
 
43
50
  if (ARGV.count > 0)
44
- options[:all] = true
51
+ options[:all] = true
52
+ elsif (ARGV.count == 0)
53
+ slog.warn($PROGRAM_NAME) { "no files provided" }
54
+ exit 1
45
55
  end
46
56
 
47
57
  begin
48
- print_package_searched_files(build_packages(options, []), ARGV)
58
+ print_package_searched_files(build_packages(options, []), ARGV)
49
59
  rescue Interrupt
50
- exit 0
60
+ exit 0
51
61
  rescue Exception => e
52
- puts "ERROR: #{e.message}"
53
- exit 1
62
+ slog.warn($PROGRAM_NAME) { e.message }
63
+ slog.debug($PROGRAM_NAME) { e.class.to_s + "\n" + e.backtrace.join("\n") }
64
+ exit 1
54
65
  end
55
66
 
67
+ # vim:sw=2:sts=2:et:
data/bin/slfindlinked CHANGED
@@ -28,7 +28,7 @@ require 'slackware/args'
28
28
  option_banner = <<-EOS
29
29
  Attempt to find the files
30
30
  Usage:
31
- #{File.basename(__FILE__)} [libname or path]
31
+ #{$PROGRAM_NAME} [libname or path]
32
32
  EOS
33
33
  options = Slackware::Args.parse(ARGV, [], option_banner)
34
34
 
data/bin/sli CHANGED
@@ -1,5 +1,5 @@
1
1
  #! /usr/bin/ruby
2
- # Copyright 2010,2011 Vincent Batts, Vienna, VA
2
+ # Copyright 2010,2011,2012 Vincent Batts, Vienna, VA
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use of this source, with or without modification, is
@@ -22,32 +22,44 @@
22
22
  $PROGRAM_NAME = File.basename(__FILE__)
23
23
 
24
24
  require 'rubygems'
25
+ require 'slackware/log'
25
26
  require 'slackware/utils'
26
27
  require 'slackware/args'
27
28
 
28
29
  option_banner = <<-EOS
29
30
  List installed Slackware package's information.
30
31
  Usage:
31
- #{File.basename(__FILE__)} [options] [search flags] [list of names]
32
-
33
- if no flags are used, then all entries are listed
34
- if no search flags, only names, then those only those matching entries are listed
32
+ #{$PROGRAM_NAME} [options] [search flags] [list of names]
33
+
34
+ if no flags are used, then all entries are listed
35
+ if no search flags, only names, then those only those matching entries are listed
35
36
 
36
37
  EOS
37
38
  # This is all the flags we want to use, from Slackware::Args
38
39
  option_flags = [:color, :case_insensitive, :pkg_name, :pkg_version,
39
- :pkg_arch, :pkg_build, :pkg_tag]
40
+ :debug, :pkg_arch, :pkg_build, :pkg_tag]
41
+
42
+ slog = Slackware::Log.instance
43
+ slog.level = Slackware::Log::WARN
40
44
 
41
45
  options = Slackware::Args.parse(ARGV, option_flags, option_banner)
42
46
 
47
+ # update level if specified
48
+ slog.level = Slackware::Log::DEBUG if options[:debug]
49
+ slog.debug($PROGRAM_NAME) {"options: %s" % options}
50
+
43
51
  if (ARGV.count > 0)
44
- options[:all] = true
52
+ options[:all] = true
45
53
  end
46
54
 
47
55
  begin
48
- print_packages_description(build_packages(options, ARGV))
56
+ print_packages_description(build_packages(options, ARGV))
49
57
  rescue Interrupt
50
- exit 0
58
+ exit 0
59
+ rescue Exception => e
60
+ slog.warn($PROGRAM_NAME) { e.message }
61
+ slog.debug($PROGRAM_NAME) { e.class.to_s + "\n" + e.backtrace.join("\n") }
62
+ exit 1
51
63
  end
52
64
 
53
-
65
+ # vim:sw=2:sts=2:et:
data/bin/sll CHANGED
@@ -1,5 +1,5 @@
1
1
  #! /usr/bin/ruby
2
- # Copyright 2010,2011 Vincent Batts, Vienna, VA
2
+ # Copyright 2010,2011,2012 Vincent Batts, Vienna, VA
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use of this source, with or without modification, is
@@ -22,23 +22,31 @@
22
22
  $PROGRAM_NAME = File.basename(__FILE__)
23
23
 
24
24
  require 'rubygems'
25
+ require 'slackware/log'
25
26
  require 'slackware/utils'
26
27
  require 'slackware/args'
27
28
 
28
29
  option_banner = <<-EOS
29
30
  List owned for files for a given Slackware package.
30
31
  Usage:
31
- #{File.basename(__FILE__)} [search flags] [list of names]
32
-
33
- if no search flags, only names, then those only those matching entries are listed
32
+ #{$PROGRAM_NAME} [search flags] [list of names]
33
+
34
+ if no search flags, only names, then those only those matching entries are listed
34
35
 
35
36
  EOS
36
37
  # This is all the flags we want to use, from Slackware::Args
37
38
  option_flags = [:force_all, :case_insensitive, :pkg_name, :pkg_version,
38
- :pkg_arch, :pkg_build, :pkg_tag]
39
+ :debug, :pkg_arch, :pkg_build, :pkg_tag]
40
+
41
+ slog = Slackware::Log.instance
42
+ slog.level = Slackware::Log::WARN
39
43
 
40
44
  options = Slackware::Args.parse(ARGV, option_flags, option_banner)
41
45
 
46
+ # update level if specified
47
+ slog.level = Slackware::Log::DEBUG if options[:debug]
48
+ slog.debug($PROGRAM_NAME) {"options: %s" % options}
49
+
42
50
  if ((ARGV.count == 0) &&
43
51
  (options[:pkg].nil?) &&
44
52
  (options[:version].nil?) &&
@@ -46,8 +54,8 @@ if ((ARGV.count == 0) &&
46
54
  (options[:build].nil?) &&
47
55
  (options[:tag].nil?) &&
48
56
  not(options[:force]) )
49
- $stderr.write("WARNING: If you really want to see *ALL* files, use the --force flag\n")
50
- exit(2)
57
+ $stderr.write("WARNING: If you really want to see *ALL* files, use the --force flag\n")
58
+ exit(2)
51
59
  end
52
60
 
53
61
  if (ARGV.count > 0)
@@ -55,8 +63,13 @@ if (ARGV.count > 0)
55
63
  end
56
64
 
57
65
  begin
58
- print_package_file_list(build_packages(options, ARGV))
66
+ print_package_file_list(build_packages(options, ARGV))
59
67
  rescue Interrupt
60
- exit 0
68
+ exit 0
69
+ rescue Exception => e
70
+ slog.warn($PROGRAM_NAME) { e.message }
71
+ slog.debug($PROGRAM_NAME) { e.class.to_s + "\n" + e.backtrace.join("\n") }
72
+ exit 1
61
73
  end
62
74
 
75
+ # vim:sw=2:sts=2:et:
data/bin/slo CHANGED
@@ -1,5 +1,5 @@
1
1
  #! /usr/bin/ruby
2
- # Copyright 2010,2011 Vincent Batts, Vienna, VA
2
+ # Copyright 2010,2011,2012 Vincent Batts, Vienna, VA
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use of this source, with or without modification, is
@@ -22,15 +22,27 @@
22
22
  $PROGRAM_NAME = File.basename(__FILE__)
23
23
 
24
24
  require 'rubygems'
25
+ require 'slackware/log'
25
26
  require 'slackware/utils'
26
27
 
28
+ slog = Slackware::Log.instance
29
+ slog.level = Slackware::Log::WARN
30
+
31
+ options = Slackware::Args.parse(ARGV, [:debug])
32
+ Slackware::Log.debug("options: %s" % options)
33
+
34
+ # update level if specified
35
+ slog.level = Slackware::Log::DEBUG if options[:debug]
36
+ slog.debug($PROGRAM_NAME) {"options: %s" % options}
27
37
 
28
38
  begin
29
- print_orphaned_files(find_orphaned_config_files())
39
+ print_orphaned_files(find_orphaned_config_files())
30
40
  rescue Interrupt
31
- exit 0
41
+ exit 0
32
42
  rescue Exception => e
33
- puts "ERROR: #{e.message}"
34
- exit 1
43
+ slog.warn($PROGRAM_NAME) { e.message }
44
+ slog.debug($PROGRAM_NAME) { e.class.to_s + "\n" + e.backtrace.join("\n") }
45
+ exit 1
35
46
  end
36
47
 
48
+ # vim:sw=2:sts=2:et:
data/bin/slp CHANGED
@@ -1,5 +1,5 @@
1
1
  #! /usr/bin/ruby
2
- # Copyright 2010,2011 Vincent Batts, Vienna, VA
2
+ # Copyright 2010,2011,2012 Vincent Batts, Vienna, VA
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use of this source, with or without modification, is
@@ -22,32 +22,44 @@
22
22
  $PROGRAM_NAME = File.basename(__FILE__)
23
23
 
24
24
  require 'rubygems'
25
+ require 'slackware/log'
25
26
  require 'slackware/utils'
26
27
  require 'slackware/args'
27
28
 
28
29
  option_banner = <<-EOS
29
30
  List installed Slackware packages.
30
31
  Usage:
31
- #{File.basename(__FILE__)} [options] [search flags] [list of names]
32
-
33
- if no flags are used, then all entries are listed
34
- if no search flags, only names, then those only those matching entries are listed
32
+ #{$PROGRAM_NAME} [options] [search flags] [list of names]
33
+
34
+ if no flags are used, then all entries are listed
35
+ if no search flags, only names, then those only those matching entries are listed
35
36
 
36
37
  EOS
37
38
  # This is all the flags we want to use, from Slackware::Args
38
39
  option_flags = [:color, :case_insensitive, :pkg_name,
39
- :pkg_version, :pkg_arch, :pkg_build, :pkg_tag]
40
+ :debug, :pkg_version, :pkg_arch, :pkg_build, :pkg_tag]
41
+
42
+ slog = Slackware::Log.instance
43
+ slog.level = Slackware::Log::WARN
40
44
 
41
45
  options = Slackware::Args.parse(ARGV, option_flags, option_banner)
42
46
 
47
+ # update level if specified
48
+ slog.level = Slackware::Log::DEBUG if options[:debug]
49
+ slog.debug($PROGRAM_NAME) {"options: %s" % options}
50
+
43
51
  if (ARGV.count > 0)
44
- options[:all] = true
52
+ options[:all] = true
45
53
  end
46
54
 
47
55
  begin
48
- print_packages(build_packages(options, ARGV))
56
+ print_packages(build_packages(options, ARGV))
49
57
  rescue Interrupt
50
- exit 0
58
+ exit 0
59
+ rescue Exception => e
60
+ slog.warn($PROGRAM_NAME) { e.message }
61
+ slog.debug($PROGRAM_NAME) { e.class.to_s + "\n" + e.backtrace.join("\n") }
62
+ exit 1
51
63
  end
52
64
 
53
-
65
+ # vim:sw=2:sts=2:et:
data/bin/slt CHANGED
@@ -1,5 +1,5 @@
1
1
  #! /usr/bin/ruby
2
- # Copyright 2010,2011 Vincent Batts, Vienna, VA
2
+ # Copyright 2010,2011,2012 Vincent Batts, Vienna, VA
3
3
  # All rights reserved.
4
4
  #
5
5
  # Redistribution and use of this source, with or without modification, is
@@ -22,37 +22,47 @@
22
22
  $PROGRAM_NAME = File.basename(__FILE__)
23
23
 
24
24
  require 'rubygems'
25
+ require 'slackware/log'
25
26
  require 'slackware/utils'
26
27
  require 'slackware/args'
27
28
 
28
29
  option_banner = <<-EOS
29
30
  List (and search) installed Slackware package's times.
30
31
  Usage:
31
- #{File.basename(__FILE__)} [pkg search flags] [list of names]
32
-
33
- if no flags are used, then all entries are listed
34
- if no search flags, only names, then those only those matching entries are listed
32
+ #{$PROGRAM_NAME} [pkg search flags] [list of names]
33
+
34
+ if no flags are used, then all entries are listed
35
+ if no search flags, only names, then those only those matching entries are listed
35
36
 
36
37
  EOS
37
38
  # This is all the flags we want to use, from Slackware::Args
38
39
  option_flags = [:color, :epoch, :case_insensitive, :pkg_name, :pkg_version,
39
- :pkg_arch, :pkg_build, :pkg_tag]
40
+ :debug, :pkg_arch, :pkg_build, :pkg_tag]
41
+
42
+ slog = Slackware::Log.instance
43
+ slog.level = Slackware::Log::WARN
40
44
 
41
45
  options = Slackware::Args.parse(ARGV, option_flags, option_banner)
42
46
 
47
+ # update level if specified
48
+ slog.level = Slackware::Log::DEBUG if options[:debug]
49
+ slog.debug($PROGRAM_NAME) {"options: %s" % options}
50
+
43
51
  # handing through that we are gathering times
44
52
  options[:time] = true
45
53
 
46
54
  if (ARGV.count > 0)
47
- options[:all] = true
55
+ options[:all] = true
48
56
  end
49
57
 
50
58
  begin
51
- print_packages_times(build_packages(options, ARGV), options[:epoch])
59
+ print_packages_times(build_packages(options, ARGV), options[:epoch])
52
60
  rescue Interrupt
53
- exit 0
61
+ exit 0
54
62
  rescue Exception => e
55
- puts "ERROR: #{e.message}"
56
- exit 1
63
+ slog.warn($PROGRAM_NAME) { e.message }
64
+ slog.debug($PROGRAM_NAME) { e.class.to_s + "\n" + e.backtrace.join("\n") }
65
+ exit 1
57
66
  end
58
67
 
68
+ # vim:sw=2:sts=2:et:
@@ -9,3 +9,4 @@ t = Time.now - 10000877
9
9
  s = Slackware::System.installed_before(t)
10
10
 
11
11
  puts "#{s.count} packages installed before #{t}"
12
+ # vim : set sw=2 sts=2 et :
@@ -9,9 +9,10 @@ puts "tags used are: " + Slackware::System.tags_used.to_s
9
9
 
10
10
  pkg = "kernel-modules"
11
11
  if (Slackware::System.is_upgraded?(pkg))
12
- puts pkg + " has been upgraded before"
13
- Slackware::System.upgrades(pkg).each {|up| printf("%s upgraded from version %s\n", up.upgrade_time, up.version) }
12
+ puts pkg + " has been upgraded before"
13
+ Slackware::System.upgrades(pkg).each {|up| printf("%s upgraded from version %s\n", up.upgrade_time, up.version) }
14
14
  else
15
- puts pkg + " apparently has not ever been upgraded before"
15
+ puts pkg + " apparently has not ever been upgraded before"
16
16
  end
17
17
 
18
+ # vim : set sw=2 sts=2 et :
data/examples/repo.rb CHANGED
@@ -12,3 +12,4 @@ sr.set_packages
12
12
 
13
13
  printf("%d packages in the slackware%s-%s repo\n", sr.packages.count, sr.arch, sr.version)
14
14
 
15
+ # vim : set sw=2 sts=2 et :