~ubuntu-branches/debian/sid/scala/sid

« back to all changes in this revision

Viewing changes to tools/test-renamer

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg, Mehdi Dogguy, Lucas Satabin, Frank S. Thomas, Emmanuel Bourg
  • Date: 2015-06-05 23:52:59 UTC
  • mfrom: (1.2.11)
  • Revision ID: package-import@ubuntu.com-20150605235259-wk00vgk83dh8o19g
Tags: 2.10.5-1
* Team upload.

[ Mehdi Dogguy ]
* New upstream release (Closes: #744278).

[ Lucas Satabin ]
* Update patches
* Update the clean target
* Update paths of elements to install
* Update watch file

[ Frank S. Thomas ]
* Remove myself from Uploaders.

[ Emmanuel Bourg ]
* The package has been adopted by the Java Team (Closes: #754935)
* Patched the build to avoid downloading libraries from the Internet
* Replaced the minified JavaScript files with unobfuscated ones
* No longer build scala-partest.jar until diffutils is packaged or replaced
* debian/watch: Fixed the versions matched (x.y.z instead of x.y.z..z)
* debian/rules:
  - Added the missing get-orig-source target (Closes: #724704)
  - Improved the clean target
* debian/control:
  - Build depend on scala (>= 2.10) and bnd
  - Use canonical URLs for the Vcs-* fields
  - Standards-Version updated to 3.9.6 (no changes)
* Switch to debhelper level 9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env bash
 
2
#
 
3
# Despite its shameful hackiness, checked in for posterity.
 
4
# It'll live on forever in the git history; then I can remove it.
 
5
 
 
6
# set -e
 
7
shopt -s nullglob
 
8
 
 
9
cd $(dirname $0)/../test
 
10
 
 
11
rename_pattern='^.*/bug[0-9]+.*?(\.scala)?$'
 
12
 
 
13
targets ()
 
14
{
 
15
  ls -d pending/*/* disabled/*/* | egrep "$rename_pattern"
 
16
}
 
17
 
 
18
showRun ()
 
19
{
 
20
  echo "$@"
 
21
  "$@"
 
22
}
 
23
 
 
24
for path in $(targets); do
 
25
  if [[ -f "$path" ]]; then
 
26
    # echo "$path"
 
27
    dir=$(dirname "$path")
 
28
    file=$(basename "$path")
 
29
    base=${file%%.scala}
 
30
    num=${base##bug}
 
31
 
 
32
    (cd "$dir" && 
 
33
      for file in ${base}.*; do
 
34
        ext=${file##*.}
 
35
        newname="t${num}.${ext}"
 
36
        
 
37
        if [[ -e "$newname" ]]; then
 
38
          echo "Hey, $newname already exists."
 
39
        else
 
40
          showRun perl -pi -e "'s/bug$num\b/t$num/g;'" "$file"
 
41
          showRun mv "$file" "$newname"
 
42
        fi
 
43
      done
 
44
    )
 
45
  fi
 
46
  
 
47
  if [[ -d "$path" ]]; then
 
48
    dir=$(dirname "$path")
 
49
    file=$(basename "$path")
 
50
    base="$file"
 
51
    num=${base##bug}
 
52
    
 
53
    (cd "$dir" &&
 
54
      for file in $file ${file}.*; do
 
55
        ext=${file##*.}
 
56
        if [[ "$ext" != "$file" ]]; then
 
57
          newname="t${num}.${ext}"
 
58
        else
 
59
          newname="t${num}"
 
60
          for file0 in ${file}/*; do
 
61
            showRun perl -pi -e "'s/bug$num\b/t$num/g;'" "$file0"
 
62
          done
 
63
        fi
 
64
        
 
65
        if [[ -e "$newname" ]]; then
 
66
          echo "Hey, $newname already exists."
 
67
        else
 
68
          if [[ -f "$file" ]]; then
 
69
            showRun perl -pi -e "'s/bug$num\b/t$num/g;'" "$file"
 
70
          fi
 
71
          showRun mv "$file" "$newname"
 
72
        fi
 
73
      done
 
74
    )
 
75
    
 
76
  fi
 
77
 
 
78
done
 
79
 
80
# for d in files/*/*; do
 
81
#   [[ -d "$d" ]] && do_dir "$d"
 
82
# done