port_upgrade 0.0.4 → 0.0.5
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/History.txt +11 -1
- data/Rakefile +1 -0
- data/bin/port_upgrade +1 -0
- data/lib/port_upgrade/version.rb +24 -11
- data/lib/port_upgrade.rb +15 -5
- data/test/test_version.rb +13 -0
- metadata +4 -4
data/History.txt
CHANGED
@@ -1,8 +1,18 @@
|
|
1
|
-
== 0.
|
1
|
+
== 0.0.5 2009-01-06
|
2
|
+
* Bugs
|
3
|
+
* port install needs -x to actually give useful return codes
|
4
|
+
* Fixed issue with database inserts when there are more than one version of something to uninstall
|
5
|
+
* Added summary to Rakefile so it will show up on gem search
|
6
|
+
* Yet another rewrite of version compare routine. Handles version string that differ in length now
|
7
|
+
* Better debugging output
|
8
|
+
* Added new config file action final_install. For items that need to happen after a port is installed, but is best at the very end of all the installs.
|
9
|
+
|
10
|
+
== 0.0.4 2009-01-02
|
2
11
|
* Add flag to call port outdated instead of using internal routine
|
3
12
|
* Complete rewrite of version comparison routine
|
4
13
|
* Bugs
|
5
14
|
* Fix computing depth of receipts when using a custom path
|
15
|
+
|
6
16
|
== 0.0.3 2008-12-23
|
7
17
|
|
8
18
|
* Bug Fix Release:
|
data/Rakefile
CHANGED
@@ -6,6 +6,7 @@ GEM_DIR = File.join(GEM_HOME,RbConfig::CONFIG["ruby_version"],"gems")
|
|
6
6
|
$hoe = Hoe.new('port_upgrade',Ports::VERSION) do |p|
|
7
7
|
p.developer('Tony Doan', 'tdoan@tdoan.com')
|
8
8
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
|
+
p.summary = "Cleanly upgrade your MacPorts."
|
9
10
|
p.post_install_message = %Q{
|
10
11
|
|
11
12
|
A sample config file can be found in:
|
data/bin/port_upgrade
CHANGED
data/lib/port_upgrade/version.rb
CHANGED
@@ -7,19 +7,32 @@ module Ports
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def <=>(other)
|
10
|
+
$stderr.puts("self: #{@parts.inspect}") if $DEBUG
|
11
|
+
$stderr.puts("other: #{other.parts.inspect}") if $DEBUG
|
10
12
|
cmp = 0
|
11
|
-
@parts.
|
12
|
-
|
13
|
-
p.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
numparts = @parts.size>other.parts.size ? @parts.size : other.parts.size
|
14
|
+
0.upto(numparts-1) do |i|
|
15
|
+
p = i>=@parts.size ? ["-1"] : @parts[i]
|
16
|
+
q = i>=other.parts.size ? ["-1"] : other.parts[i]
|
17
|
+
numsubparts = p.size>q.size ? p.size : q.size
|
18
|
+
0.upto(numsubparts-1) do |j|
|
19
|
+
r = j>=p.size ? "-1" : p[j]
|
20
|
+
s = j>=q.size ? "-1" : q[j]
|
21
|
+
|
22
|
+
$stderr.puts("p of #{j}: #{r}") if $DEBUG
|
23
|
+
$stderr.puts("q of #{j}: #{s}") if $DEBUG
|
24
|
+
a = r =~ /^-?[0-9]+$/ ? r.to_i : r
|
25
|
+
b = s =~ /^-?[0-9]+$/ ? s.to_i : s
|
26
|
+
$stderr.puts "#{a.inspect} <=> #{b.inspect}" if $DEBUG
|
27
|
+
if a.instance_of?(b.class)
|
28
|
+
cmp = a <=> b
|
29
|
+
else
|
30
|
+
$stderr.puts "Can't compare different classes #{a.class.to_s} <=> #{b.class.to_s}" if $DEBUG
|
31
|
+
cmp = 0
|
32
|
+
end
|
33
|
+
return cmp if cmp != 0
|
21
34
|
end
|
22
|
-
|
35
|
+
return cmp if cmp != 0
|
23
36
|
end
|
24
37
|
cmp
|
25
38
|
end
|
data/lib/port_upgrade.rb
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
$:.unshift(File.dirname(__FILE__)) unless
|
16
16
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
17
17
|
|
18
|
+
require 'yaml'
|
18
19
|
require 'bz2'
|
19
20
|
require 'find'
|
20
21
|
require 'sqlite3'
|
@@ -26,7 +27,7 @@ class String
|
|
26
27
|
end
|
27
28
|
|
28
29
|
module Ports
|
29
|
-
VERSION = '0.0.
|
30
|
+
VERSION = '0.0.5'
|
30
31
|
RECEIPT_PATH = '/opt/local/var/macports/receipts'
|
31
32
|
MACPORTS_DB='/opt/local/var/macports/sources/rsync.macports.org/release/ports'
|
32
33
|
CONFIG_FILE = 'port_upgrade.conf'
|
@@ -118,7 +119,7 @@ module Ports
|
|
118
119
|
rescue SQLite3::SQLException => exp
|
119
120
|
$stderr.puts "Dup insert into remports: #{exp}}" if $DEBUG
|
120
121
|
end
|
121
|
-
@pdb.db.execute("insert into remports values(\"#{a}\",\"\")")
|
122
|
+
@pdb.db.execute("insert or ignore into remports values(\"#{a}\",\"\")")
|
122
123
|
end
|
123
124
|
@pdb.db.execute('delete from remports where port="gimp-app" and dep="gimp"')
|
124
125
|
#File.open("remtree.dot",'w') do |f|
|
@@ -314,7 +315,7 @@ module Ports
|
|
314
315
|
if File.exist?(portfile_path)
|
315
316
|
curver = Portfile.new(portfile_path).version
|
316
317
|
#puts "%-32s%s < %s" %[port,version.split('+').first,curver] if Ports::Utilities.cmp_vers(version.split('+').first,curver) < 0
|
317
|
-
$stderr.puts("#{port}: #{version.split('+').first}, #{curver}") if $
|
318
|
+
$stderr.puts("#{port}: #{version.split('+').first}, #{curver}") if $DEBUG
|
318
319
|
cmp = Ports::Utilities.cmp_vers(version.split('+').first,curver)
|
319
320
|
if cmp.nil?
|
320
321
|
$stderr.puts "Unable to compare versions: #{[port]}"
|
@@ -332,6 +333,7 @@ module Ports
|
|
332
333
|
end
|
333
334
|
|
334
335
|
def upgrade(path='port_upgrade.sh')
|
336
|
+
final = []
|
335
337
|
@pt.setup_remports(outdated) if @to_remove.nil?
|
336
338
|
remports = []
|
337
339
|
remvariants = Hash.new {|h,k| h[k] = Array.new}
|
@@ -369,11 +371,15 @@ module Ports
|
|
369
371
|
end
|
370
372
|
bi = get_before_install(port)
|
371
373
|
dotsh.puts(bi) unless bi.nil?
|
372
|
-
dotsh.puts("port #{get_force(port)} install #{port} #{remvariants[port][variantindex]} || exit -1")
|
374
|
+
dotsh.puts("port #{get_force(port)} -x install #{port} #{remvariants[port][variantindex]} || exit -1")
|
373
375
|
ai = get_after_install(port)
|
376
|
+
fi = get_final_install(port)
|
377
|
+
final << fi unless fi.nil?
|
374
378
|
dotsh.puts(ai) unless ai.nil?
|
375
379
|
end
|
376
380
|
stmt.close
|
381
|
+
final.each{|l| dotsh.puts(l)}
|
382
|
+
dotsh.close
|
377
383
|
true
|
378
384
|
end
|
379
385
|
|
@@ -402,6 +408,10 @@ module Ports
|
|
402
408
|
get_port_action(portname,:after_install)
|
403
409
|
end
|
404
410
|
|
411
|
+
def get_final_install(portname)
|
412
|
+
get_port_action(portname,:final_install)
|
413
|
+
end
|
414
|
+
|
405
415
|
private
|
406
416
|
|
407
417
|
def get_port_action(portname,type)
|
@@ -475,7 +485,7 @@ module Ports
|
|
475
485
|
v = $2 || $3 if v.nil?
|
476
486
|
break
|
477
487
|
when /(\S+)\s+([^$]+)$/
|
478
|
-
vars[$1] = $2
|
488
|
+
vars[$1] = $2.strip
|
479
489
|
end
|
480
490
|
end
|
481
491
|
rev = "0" if rev.nil?
|
data/test/test_version.rb
CHANGED
@@ -6,6 +6,7 @@ class TestVersion < Test::Unit::TestCase
|
|
6
6
|
def setup
|
7
7
|
raw_tests = %q{ImageMagick 6.4.6-7_0 < 6.4.8-1_0
|
8
8
|
binutils 2.17_0 < 2.19_0
|
9
|
+
bison 2.4_1 < 2.4.1_0
|
9
10
|
boost 1.35.0_2 < 1.37.0_0
|
10
11
|
cairo 1.8.4_0 < 1.8.6_1
|
11
12
|
dbus 1.2.4_2 < 1.2.10_0
|
@@ -53,6 +54,18 @@ class TestVersion < Test::Unit::TestCase
|
|
53
54
|
assert_equal(v1 <=> v2, 1)
|
54
55
|
end
|
55
56
|
|
57
|
+
def test_4
|
58
|
+
v1 = Version.new("2.24a.1")
|
59
|
+
v2 = Version.new("2.24b.1")
|
60
|
+
assert_equal(v1 <=> v2, -1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_5
|
64
|
+
v1 = Version.new("5.820_0")
|
65
|
+
v2 = Version.new("5.820 LWP_0")
|
66
|
+
assert_equal(v1 <=> v2, 0)
|
67
|
+
end
|
68
|
+
|
56
69
|
def test_current
|
57
70
|
@tests.each do |test|
|
58
71
|
v1 = Version.new(test[0])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: port_upgrade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Doan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-07 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.2.
|
53
|
+
version: 1.2.3
|
54
54
|
version:
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: hoe
|
@@ -89,7 +89,7 @@ post_install_message: |+
|
|
89
89
|
|
90
90
|
|
91
91
|
A sample config file can be found in:
|
92
|
-
/opt/local/lib/ruby/gems/1.8/gems/port_upgrade-0.0.
|
92
|
+
/opt/local/lib/ruby/gems/1.8/gems/port_upgrade-0.0.5/etc
|
93
93
|
To install copy it to ~/.port_upgrade.conf
|
94
94
|
|
95
95
|
|