[23696] users/jberry/mpwa
source_changes at macosforge.org
source_changes at macosforge.org
Fri Apr 6 17:14:46 PDT 2007
Revision: 23696
http://trac.macosforge.org/projects/macports/changeset/23696
Author: jberry at macports.org
Date: 2007-04-06 17:14:45 -0700 (Fri, 06 Apr 2007)
Log Message:
-----------
A bit of cleanup to once again sync up the mpwa submit with the design doc.
Modified Paths:
--------------
users/jberry/mpwa/app/controllers/application.rb
users/jberry/mpwa/app/controllers/ports_controller.rb
users/jberry/mpwa/app/views/ports/submit.rhtml
users/jberry/mpwa/doc/design.txt
Modified: users/jberry/mpwa/app/controllers/application.rb
===================================================================
--- users/jberry/mpwa/app/controllers/application.rb 2007-04-06 22:31:31 UTC (rev 23695)
+++ users/jberry/mpwa/app/controllers/application.rb 2007-04-07 00:14:45 UTC (rev 23696)
@@ -2,18 +2,19 @@
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
- attr_reader :svn, :tar, :mtree
- attr_reader :repo_url, :repo_root, :repo_port, :repo_port_url
+ attr_reader :svn, :tar, :xar, :mtree
+ attr_reader :repo_url, :repo_root, :repo_portpkgs, :repo_portpkgs_url
def initialize
@svn = "/opt/local/bin/svn"
+ @xar = "/opt/local/bin/xar"
@tar = "/usr/bin/tar"
@mtree = "/usr/sbin/mtree"
@repo_url = "file:///Users/jberry/Projects/macports/users/jberry/mpwa/testrepo/repo"
@repo_root = "/Users/jberry/Projects/macports/users/jberry/mpwa/testrepo/root"
- @repo_port = "#{@repo_root}/port"
- @repo_port_url = "#{@repo_url}/port"
+ @repo_portpkgs = "#{@repo_root}/portpkgs"
+ @repo_portpkgs_url = "#{@repo_url}/portpkgs"
end
end
\ No newline at end of file
Modified: users/jberry/mpwa/app/controllers/ports_controller.rb
===================================================================
--- users/jberry/mpwa/app/controllers/ports_controller.rb 2007-04-06 22:31:31 UTC (rev 23695)
+++ users/jberry/mpwa/app/controllers/ports_controller.rb 2007-04-07 00:14:45 UTC (rev 23696)
@@ -20,6 +20,7 @@
end
def subversionCommand(args)
+ puts "subversion: #{svn} #{args}"
`#{svn} #{args}`
end
@@ -38,6 +39,21 @@
end
end
+ def buildPortPkgDirPrefixPath(pkgId)
+ # Two Level Cache
+ # First level is low 6 bits of pkgId
+ # Second level is next 6 bits of pkgId
+
+ lev1 = pkgId & 0x3f
+ lev2 = pkgId >> 6 & 0x3f
+ path = format('%02x/%02x', lev1, lev2)
+ end
+
+ def buildPortPkgDirPath(pkgId)
+ prefix = buildPortPkgDirPrefixPath(pkgId)
+ path = format('%s/%016x', prefix, pkgId)
+ end
+
def submit
# TODO:
# => Move some of this into the model
@@ -52,7 +68,7 @@
raise "bad package" if @portpkg.nil?
tempDir = makeTempDir
- portpkg = "#{tempDir}/portpkg.tgz"
+ portpkg = "#{tempDir}/portpkg.xar"
pkgdir = "#{tempDir}/portpkg"
common = "#{tempDir}/common"
target = "#{tempDir}/target"
@@ -62,15 +78,18 @@
commonPartial = "common/#{firstChar}/#{@portName}"
# Look for, and create if not found, the common directory for the port
- ensureRepositoryPath(repo_port, commonPartial)
+ ensureRepositoryPath(repo_portpkgs, commonPartial)
# Unpack the submitted portdir into a temporary directory
- File.open(portpkg, "w") { |f| f.write(@portpkg.read) }
- system("#{tar} -C #{tempDir} -zf #{portpkg} -x portpkg")
+ File.open(portpkg, "w") { |f| f.write(@portpkg.read) }
+ # Note: a bug in xar presently prevents us from limiting the extraction to the portpkg directory,
+ # => which we'd like to do for the sake of cleanliness. Hopefully this will become fixed soon.
+ system("cd #{tempDir}; #{xar} -xf #{portpkg}")
+
# Check out a private temporary copy of the common directory
# so that we don't get into concurrency issues by multi-modifying the directory
- subversionCommand("co #{repo_port_url}/#{commonPartial} #{common}")
+ subversionCommand("co #{repo_portpkgs_url}/#{commonPartial} #{common}")
# Sync the submission into the common directory by parsing the results of mtree
changeCnt = 0
@@ -127,31 +146,33 @@
puts "Creating new submission from #{common}"
# Commit changes to the common directory
- commitOutput = subversionCommand("commit -m 'New submission of #{@portName}' #{common}")
+ commitOutput = subversionCommand("commit -m 'New portpkg of #{@portName}' #{common}")
commitRevision = /^Committed revision (\d+)./.match(commitOutput)[1]
# Form the portid from the committed revision number
- portid = commitRevision
+ pkgId = commitRevision.to_i
+ portPkgDirPrefix = buildPortPkgDirPrefixPath(pkgId)
+ portPkgDir = buildPortPkgDirPath(pkgId);
- return
- puts "Creating new submission #{commitRevision} at #{repo_port}/#{commitRevision}"
+ puts "Creating new portpkg #{pkgId} at #{repo_portpkgs}/#{portPkgDir}"
- # Make the target directory structure
- subversionCommand("mkdir -m 'Create new submission #{commitRevision} of port #{@portName}' #{submission_url}/#{commitRevision}")
-
- # Check out the submission directory
- subversionCommand("co #{submission_url}/#{commitRevision} #{target}")
-
+ # Make sure there's a path to the repository location for the portPkg
+ ensureRepositoryPath(repo_portpkgs, portPkgDirPrefix)
+
+ # Make the portPkg directory
+ FileUtils.mkdir("#{repo_portpkgs}/#{portPkgDir}")
+ subversionCommand("add #{repo_portpkgs}/#{portPkgDir}")
+
# Add original package and meta directory
- FileUtils.cp(package, "#{target}/port.tgz")
- FileUtils.mkdir("#{target}/meta")
- subversionCommand("add #{target}/port.tgz #{target}/meta")
+ FileUtils.cp(portpkg, "#{repo_portpkgs}/#{portPkgDir}/portpkg.xar")
+ FileUtils.mkdir("#{repo_portpkgs}/#{portPkgDir}/meta")
+ subversionCommand("add #{repo_portpkgs}/#{portPkgDir}/portpkg.xar #{repo_portpkgs}/#{portPkgDir}/meta")
- # Copy over the common directory into unpacked
- subversionCommand("cp #{common} #{target}/unpacked")
+ # Copy the common directory into unpacked
+ subversionCommand("cp #{common} #{repo_portpkgs}/#{portPkgDir}/unpacked")
- # Commit the submission directory
- subversionCommand("commit -m 'Complete submission #{commitRevision} of port #{@portName}' #{target}")
+ # Commit the portpkg directory
+ subversionCommand("commit -m 'Complete portpkg #{pkgId} of port #{@portName}' #{repo_portpkgs}/#{portPkgDir}")
end
end
Modified: users/jberry/mpwa/app/views/ports/submit.rhtml
===================================================================
--- users/jberry/mpwa/app/views/ports/submit.rhtml 2007-04-06 22:31:31 UTC (rev 23695)
+++ users/jberry/mpwa/app/views/ports/submit.rhtml 2007-04-07 00:14:45 UTC (rev 23696)
@@ -2,7 +2,7 @@
<p>Find me in app/views/ports/submit.rhtml</p>
<p>repo_root: <%= @controller.repo_root %></p>
-<p>repo_port: <%= @controller.repo_port %></p>
+<p>repo_portpkgs: <%= @controller.repo_portpkgs %></p>
<p>category: <%= @category %></p>
<p>portname: <%= @portname %></p>
\ No newline at end of file
Modified: users/jberry/mpwa/doc/design.txt
===================================================================
--- users/jberry/mpwa/doc/design.txt 2007-04-06 22:31:31 UTC (rev 23695)
+++ users/jberry/mpwa/doc/design.txt 2007-04-07 00:14:45 UTC (rev 23696)
@@ -84,10 +84,10 @@
Storage layout within the macports subversion repository:
- /port/common (revisioned/shared between instances of a port)
- /first-letter-of-portname
- /portname/<directory tree> (the unbundled/uncompressed portpkg)
- /port/portpkgs
+ /portpkgs
+ /common (revisioned/shared between instances of a port)
+ /first-letter-of-portname
+ /portname/<directory tree> (the unbundled/uncompressed portpkg)
/5-low-bits-pkgid-2char-hex
/5-next-bits-pkgid-2char-hex
/pkgid-zero-padded-dec
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070406/1ad9b516/attachment.html
More information about the macports-changes
mailing list