File: newruby

package info (click to toggle)
ruby-defaults 1:2.3.3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 128 kB
  • ctags: 6
  • sloc: sh: 70; ruby: 55; makefile: 20
file content (25 lines) | stat: -rwxr-xr-x 636 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

if [ $# -ne 1 ]; then
  echo "usage: $0 VERSION"
  exit 1
fi

new_version="$1"

if ! grep -q "ruby$new_version" ruby_debian_dev.rb; then
  echo "Please add an entry for Ruby $new_version to ruby_debian_dev.rb"
  exit 2
fi

old_version=$(grep-dctrl -F Package -X ruby debian/control -n -s Depends | cut -d , -f 1 | sed -e s/ruby//)

files_to_change=$(grep -rl "$old_version" debian/ | grep -v 'changelog\|NEWS')

if [ -n "$files_to_change" ]; then
  sed -i -e "s/${old_version}/${new_version}/g" $files_to_change
else
  echo "No files to change!"
fi

dch --newversion "1:${new_version}" "Make Ruby ${new_version} the default"