File: extract-release-date-from-doap-file

package info (click to toggle)
gst-plugins-bad1.0 1.0.8-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 36,832 kB
  • sloc: ansic: 297,908; cpp: 22,677; sh: 13,303; xml: 6,362; makefile: 4,867; perl: 1,435; objc: 1,273; python: 362; sed: 16
file content (32 lines) | stat: -rwxr-xr-x 727 bytes parent folder | download | duplicates (24)
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
#!/bin/sh
# Shell script to extract the date given a release version and a .doap file

if test "x$1" = "x" -o "x$2" = "x" -o ! -s "$2"; then
  echo "Usage: $0 RELEASE-VERSION-NUMBER DOAP-FILE" >&2;
  exit 1
fi

if ! grep '<Project' "$2" >/dev/null ; then
  echo "$2 does not look lika a .doap file" >&2;
  exit 1
fi

if ! grep "$1" "$2" >/dev/null ; then
  echo "$2 contains no reference to a version $1" >&2;
  exit 1
fi

awk 'BEGIN {x=0}
{
if ($0~"<release>") {x=1; chunk=""}
if (x==1) {
  if ($0~"<revision>") { chunk = chunk $0 }
  if ($0~"<created>") { chunk = chunk $0 }
}
if ($0~"</release>") {x=0; print chunk}
}' < "$2" | \
\
grep '<revision>'"$1"'</revision>' | \
\
sed -e 's/^.*<created>//' -e 's/<\/created>.*$//'