[Xfce4-commits] <xfce-git-migration:master> add script to fix weird binary file end-of-line-issues

Brian J. Tarricone brian at tarricone.org
Wed Aug 12 03:40:02 CEST 2009


Updating branch refs/heads/master
         to d4db0e27b1b93b303898e8472fb3b520074a57c1 (commit)
       from be9a569a689724b757e7ea3e18d809c2dbbc6356 (commit)

commit d4db0e27b1b93b303898e8472fb3b520074a57c1
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Wed Aug 12 01:36:48 2009 +0000

    add script to fix weird binary file end-of-line-issues

 fixbins.pl |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/fixbins.pl b/fixbins.pl
new file mode 100755
index 0000000..863087b
--- /dev/null
+++ b/fixbins.pl
@@ -0,0 +1,57 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+my $svn_repo_root = 'file:///var/svn';
+
+my @repos = (
+    'xfce',
+    'goodies',
+    'xfce-archive',
+    'www',
+    'xfce3',
+);
+
+my %repo_map = ();
+my %repo_files = ();
+
+while(<>) {
+    next unless(/^Binary file/);
+
+    my ($svn_module,$path) = m|/tmp/(.*?)-svn/(\S+)|;
+    next unless(defined($svn_module) && defined($path));
+
+    print qq(fixing up "$path" from module "$svn_module"\n);
+
+    unless(defined($repo_map{$svn_module})) {
+        # this is somewhat lame
+        foreach my $r (@repos) {
+            my $op = `svn ls $svn_repo_root/$r/$svn_module 2>&1`;
+            if($op !~ /non-existent in that revision/) {
+                $repo_map{$svn_module} = $r;
+                last;
+            }
+        }
+    }
+    unless(defined($repo_map{$svn_module})) {
+        print STDERR "can't find repo for module $svn_module\n";
+        next;
+    }
+
+    $repo_files{$svn_module} = [] unless(defined($repo_files{$svn_module}));
+    push(@{$repo_files{$svn_module}}, $path);
+}
+
+foreach my $m (keys(%repo_map)) {
+    my $repo_uri = $svn_repo_root.'/'.$repo_map{$m}.'/'.$m;
+    system("svn co $repo_uri /tmp/$m-svnfix");
+    chdir("/tmp/$m-svnfix");
+    foreach my $d ((<branches/*>, <tags/*>, 'trunk')) {
+        foreach my $p (@{$repo_files{$m}}) {
+            system("svn propdel svn:eol-style $d/$p") if(-f "$d/$p");
+        }
+    }
+    system("svn ci -m 'remove svn:eol-style as it breaks binary files'");
+    chdir;
+    system("rm -rf /tmp/$m-svnfix");
+}



More information about the Xfce4-commits mailing list