Revision: 16608
          http://gar.svn.sourceforge.net/gar/?rev=16608&view=rev
Author:   bdwalton
Date:     2011-12-28 18:53:31 +0000 (Wed, 28 Dec 2011)
Log Message:
-----------
cswcommon/trunk: replace old (partial) map2dirlist script with a new script 
that can generate shell script to create the dir/symlink entries in the pkgmap

Added Paths:
-----------
    csw/mgar/pkg/cswcommon/trunk/files/map2dirstructure

Removed Paths:
-------------
    csw/mgar/pkg/cswcommon/trunk/files/map2dirlist

Deleted: csw/mgar/pkg/cswcommon/trunk/files/map2dirlist
===================================================================
--- csw/mgar/pkg/cswcommon/trunk/files/map2dirlist      2011-12-28 18:16:10 UTC 
(rev 16607)
+++ csw/mgar/pkg/cswcommon/trunk/files/map2dirlist      2011-12-28 18:53:31 UTC 
(rev 16608)
@@ -1,8 +0,0 @@
-#!/usr/bin/perl
-
-open F, "pkgmap";
-while( <F> ) {
-  chomp;
-  my @l = split /\s+/;
-
-}

Added: csw/mgar/pkg/cswcommon/trunk/files/map2dirstructure
===================================================================
--- csw/mgar/pkg/cswcommon/trunk/files/map2dirstructure                         
(rev 0)
+++ csw/mgar/pkg/cswcommon/trunk/files/map2dirstructure 2011-12-28 18:53:31 UTC 
(rev 16608)
@@ -0,0 +1,35 @@
+#!/opt/csw/bin/ruby
+
+puts "set -x"
+puts "set -e"
+
+puts "gmkdir CSWcommon"
+puts "cd CSWcommon"
+
+File.open('pkgmap') do |pkgmap|
+  pkgmap.each_line do |line|
+    parts = line.split(/\s+/)
+    # skip over administrative entries
+    next unless %w(d s f).include?(parts[1])
+
+    case parts[1]
+    when 'd'
+      reldir = parts[3].sub(/^\//, '')
+      puts "[ -d \"#{reldir}\" ] || gmkdir -m 0755 -p #{reldir}"
+    when 's'
+      # we make the assumption that all symlinks in CSWcommon are to
+      # (relative) directories
+      (link, target) = parts[3].split(/=/)
+      link.sub!(/^\//, '')
+      parent = File.dirname(link)
+      linkname = File.basename(link)
+      puts "[ -d \"#{parent}\" ] || gmkdir -m 0755 -p #{parent}"
+      puts "pushd #{parent}"
+      puts "[ -d \"#{target}\" ] || gmkdir -m 0755 -p #{target}"
+      puts "gln -s #{target} #{linkname}"
+      puts "popd"
+    else
+      puts "echo \"Skipping #{parts[3]} (type: #{parts[1]}).\""
+    end
+  end
+end


Property changes on: csw/mgar/pkg/cswcommon/trunk/files/map2dirstructure
___________________________________________________________________
Added: svn:executable
   + *

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

_______________________________________________
devel mailing list
[email protected]
https://lists.opencsw.org/mailman/listinfo/devel

Reply via email to