File: check-upstream-versus-debian

package info (click to toggle)
ruby-gnome2 3.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 28,872 kB
  • sloc: ansic: 96,386; ruby: 70,722; xml: 350; sh: 105; cpp: 45; makefile: 34
file content (73 lines) | stat: -rwxr-xr-x 1,959 bytes parent folder | download | duplicates (3)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash

set -e

get_deps() {
  pkg="$1"
  sed "1,/^Package: $pkg$/ d" debian/control  | sed '/^$/,$ d; /^Depends: /!d; s/Depends: //; s/\s*,\s*/\n/g' | sed '/^\$/d; s/\s.*//'
}

ruby_gnome2_deps=$(get_deps ruby-gnome2)
while true; do

  old_deps="$ruby_gnome2_deps"
  new_deps=$(for dep in $ruby_gnome2_deps; do get_deps $dep; done | sort | uniq)
  ruby_gnome2_deps=$(for dep in $ruby_gnome2_deps $new_deps; do echo $dep; done | sort | uniq)

  if test "$ruby_gnome2_deps" = "$old_deps" ; then
    break
  fi

done

failed=false
fail() {
  echo "E: $@"
  failed=true
}

for upstream_pkg in $(ls -1 */extconf.rb | xargs -n 1 dirname); do

  if test "$upstream_pkg" = 'gtkmozembed'; then
    continue
  fi

  pkg=ruby-${upstream_pkg/_/-}

  if ! grep -q "^Package: $pkg$" debian/control; then
    fail "$pkg not found in debian/control!"
  fi
  if ! test -e debian/$pkg.install; then
    fail "debian/$pkg.install not found!"
  fi
  if test -e $upstream_pkg/sample && ! test -e debian/$pkg.examples; then
    fail "debian/$pkg.examples not found, but $upstream_pkg/sample exists!"
  fi

  if test -e debian/$pkg.examples; then
    for sampledir in $(sed -e 's/\*//' debian/$pkg.examples); do
      if ! test -d "$sampledir"; then
        fail "debian/$pkg.examples lists $sampledir, but it does not exist!"
      fi
    done
  fi

  if ! (echo "$ruby_gnome2_deps" | grep -q $pkg); then
    fail "ruby-gnome2 does NOT depend on $pkg!"
  fi

done

for pkg in $(ls -1 debian/*.{install,examples} | sed 's/debian\/\(.*\)\..*/\1/g' | sort | uniq); do
  if ! grep -q "^Package: $pkg$" debian/control; then
    fail "debian/$pkg.{examples,install} found, but package $pkg is not in debian/control"
  fi
done

for pkg in $ruby_gnome2_deps; do
  if test "$pkg" != 'ruby' && test "$pkg" != 'ruby-cairo' && ! grep -q "^Package: $pkg$" debian/control; then
    fail "ruby-gnome2 depends on $pkg, but it does not on debian/control!"
  fi
done

test "$failed" = 'false'