slack-utils 0.7 → 0.7.1

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
@@ -26,17 +26,24 @@ or for each arg it will search the package names.
26
26
  <b>slo</b> - find files in /etc/, that have been orphaned and left behind
27
27
  by unistalled/upgraded packages
28
28
 
29
- <b>sli</b> - display the package information, for matching packages
29
+ <b>sli</b> - display the package information for matching packages
30
+
31
+ <b>slu</b> - display the upgrade history for matching packages
30
32
 
31
33
  <b>slfindlinked</b> - finds what is linked to your argument, and it's package
32
34
  expects 1 argument passed.
33
35
 
34
36
 
37
+ == Release Notes
38
+
39
+ See https://github.com/vbatts/slack-utils/wiki/Release-Notes
40
+
35
41
  == Installation
36
42
 
37
43
  === From git
38
44
 
39
45
  >> git clone git://github.com/vbatts/slack-utils.git
46
+ >> cd slack-utils
40
47
  >> make slackpkg
41
48
  >> sudo upgradepkg --install-new pkg/slack-utils-0.6.2-$ARCH-1_vb.tgz
42
49
 
@@ -47,9 +54,16 @@ expects 1 argument passed.
47
54
  >> ruby setup.rb config --prefix=/usr --mandir=/usr/man
48
55
  >> ruby setup.rb install
49
56
 
57
+ === From the rubygems repo
58
+
59
+ >> sudo gem install slack-utils
60
+
50
61
  === From the gem
51
62
 
52
- >> sudo gem install pkg/slack-utils-0.6.2.gem
63
+ >> git clone git://github.com/vbatts/slack-utils.git
64
+ >> cd slack-utils/src
65
+ >> rake gem
66
+ >> sudo gem install pkg/slack-utils-$VERSION.gem
53
67
 
54
68
 
55
69
  == Quick Start
data/bin/slu ADDED
@@ -0,0 +1,69 @@
1
+ #! /usr/bin/ruby
2
+ # Copyright 2010,2011,2012 Vincent Batts, Vienna, VA
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use of this source, with or without modification, is
6
+ # permitted provided that the following conditions are met:
7
+ #
8
+ # 1. Redistributions of this source must retain the above copyright
9
+ # notice, this list of conditions and the following disclaimer.
10
+ #
11
+ # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
12
+ # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13
+ # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
14
+ # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
17
+ # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18
+ # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
19
+ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
20
+ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21
+
22
+ $PROGRAM_NAME = File.basename(__FILE__)
23
+
24
+ require 'rubygems'
25
+ require 'slackware/log'
26
+ require 'slackware/utils'
27
+ require 'slackware/args'
28
+
29
+ option_banner = <<-EOS
30
+ List upgrades for specifed Slackware packages.
31
+ Usage:
32
+ #{$PROGRAM_NAME} [options] [search flags] [list of pkg names]
33
+
34
+ EOS
35
+ # This is all the flags we want to use, from Slackware::Args
36
+ option_flags = [:case_insensitive, :pkg_name, :debug, :pkg_tag, :force_all]
37
+
38
+ slog = Slackware::Log.instance
39
+ slog.level = Slackware::Log::WARN
40
+
41
+ options = Slackware::Args.parse(ARGV, option_flags, option_banner)
42
+
43
+ # update level if specified
44
+ slog.level = Slackware::Log::DEBUG if options[:debug]
45
+ slog.debug($PROGRAM_NAME) {"options: %s" % options}
46
+
47
+ if ((ARGV.count == 0) &&
48
+ (options[:pkg].nil?) &&
49
+ (options[:tag].nil?) &&
50
+ not(options[:force]) )
51
+ $stderr.write("WARNING: If you really want to see *ALL* files, use the --force flag\n")
52
+ exit(2)
53
+ end
54
+
55
+ if (ARGV.count > 0)
56
+ options[:all] = true
57
+ end
58
+
59
+ begin
60
+ print_upgrades(build_packages(options, ARGV))
61
+ rescue Interrupt
62
+ exit 0
63
+ rescue Exception => e
64
+ slog.warn($PROGRAM_NAME) { e.message }
65
+ slog.debug($PROGRAM_NAME) { e.class.to_s + "\n" + e.backtrace.join("\n") }
66
+ exit 1
67
+ end
68
+
69
+ # vim:sw=2:sts=2:et:
@@ -176,9 +176,15 @@ module Slackware
176
176
  while true
177
177
  break if f.eof?
178
178
  line = f.readline()
179
- if line.force_encoding("US-ASCII") =~ RE_FILE_LIST # FIXME ArgumentError: invalid byte sequence in US-ASCII
180
- f.seek(2, IO::SEEK_CUR)
181
- break
179
+ begin
180
+ if line.force_encoding("US-ASCII") =~ RE_FILE_LIST
181
+ f.seek(2, IO::SEEK_CUR)
182
+ break
183
+ end
184
+ rescue ArgumentError
185
+ # ArgumentError: invalid byte sequence in US-ASCII
186
+ # so dumb, i wish i could determine a better solution for this
187
+ true
182
188
  end
183
189
  end
184
190
  begin
@@ -101,7 +101,7 @@ module Slackware
101
101
  # Slackware::System.upgrades("fart")
102
102
  # => []
103
103
  def self::upgrades(pkg)
104
- find_removed(pkg).select {|p| (p.name == pkg) }
104
+ find_removed(pkg).select {|p| (p.name == pkg) }.sort {|a,b| a.upgrade_time <=> b.upgrade_time }
105
105
  end
106
106
 
107
107
  # Return an Array of packages, that were installed after provided +time+
@@ -144,6 +144,34 @@ def build_packages(opts = {}, args = [])
144
144
  return pkgs
145
145
  end
146
146
 
147
+ def print_upgrades(pkgs)
148
+ count = 1
149
+ p_count = pkgs.count
150
+ pkgs.each do |pkg|
151
+ if (Slackware::System.is_upgraded?(pkg.name))
152
+ puts '"%s" (current version %s build %s%s) has been upgraded before' % [pkg.name,
153
+ pkg.version,
154
+ pkg.build,
155
+ pkg.tag]
156
+ Slackware::System.upgrades(pkg.name).each do |up|
157
+ puts " %s build %s%s upgraded on %s" % [up.version,
158
+ up.build,
159
+ up.tag,
160
+ up.upgrade_time]
161
+ end
162
+ else
163
+ puts '"%s" (current version %s build %s%s) has not been upgraded' % [pkg.name,
164
+ pkg.version,
165
+ pkg.build,
166
+ pkg.tag]
167
+ end
168
+ if count < p_count
169
+ puts
170
+ end
171
+ count += 1
172
+ end
173
+ end
174
+
147
175
  def print_packages(pkgs)
148
176
  if (pkgs.count > 0 && pkgs.first.class == Slackware::Package)
149
177
  pkgs.each {|pkg|
@@ -28,7 +28,7 @@ module Slackware
28
28
  rescue
29
29
  nil
30
30
  end
31
- UTILS_VERSION = "0.7"
31
+ UTILS_VERSION = "0.7.1"
32
32
  end
33
33
 
34
34
  # vim : set sw=2 sts=2 et :
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.7'
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Vincent Batts
9
- autorequire: slack-utils
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-01-31 00:00:00.000000000 Z
@@ -21,6 +21,7 @@ executables:
21
21
  - sll
22
22
  - slp
23
23
  - slt
24
+ - slu
24
25
  - slfindlinked
25
26
  extensions: []
26
27
  extra_rdoc_files:
@@ -33,6 +34,7 @@ files:
33
34
  - bin/slo
34
35
  - bin/sll
35
36
  - bin/sli
37
+ - bin/slu
36
38
  - bin/slfindlinked
37
39
  - examples/list_packages.rb
38
40
  - examples/repo_difference.rb
@@ -57,7 +59,7 @@ rdoc_options:
57
59
  - --main=README.rdoc
58
60
  - --line-numbers
59
61
  - --inline-source
60
- - --title=Slackware utils (slack-utils) 0.7 Documentation
62
+ - --title=Slackware utils (slack-utils) 0.7.1 Documentation
61
63
  require_paths:
62
64
  - lib
63
65
  required_ruby_version: !ruby/object:Gem::Requirement