File: screensavers-desktop-qa.sh

package info (click to toggle)
xscreensaver 6.09%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 63,852 kB
  • sloc: ansic: 503,539; xml: 10,207; makefile: 10,016; perl: 7,146; sh: 4,316; asm: 3,513; objc: 3,359
file content (180 lines) | stat: -rwxr-xr-x 3,713 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/bin/sh
# Checks our desktop files and compare them to upstream xml files.
# Or, provided an xml file as argument, generates a desktop file.
# 2008-2020 Tormod Volden

# Some xml files are for external programs or hacks that are not built.
# We do not ship desktop files for those.
EXTERNALS="\
 cosmos \
 dnalogo \
 electricsheep \
 fireflies \
 goban \
 xaos \
 xdaliclock \
 xmountains \
 xplanet \
 xsnow \
 xteevee \
"
RETIRED="\
 ant \
 bubbles \
 critical \
 flag \
 forest \
 glforestfire \
 hyperball \
 hypercube \
 juggle \
 lmorph \
 laser \
 lightning \
 lisa \
 lissie \
 mismunch \
 rotor \
 sphere \
 spiral \
 t3d \
 thornbird \
 testx11 \
 vines \
 whirlygig \
 worm \
"
SKIPPED="\
 co____9 \
 popsquared \
"

# Poor man's xml parser
get_xml_option () {
	file=$1
	tag=$2
	option=$3

	< $file sed -n '/\<'$tag' /s@.* '$option'="\([^"]*\)".*@\1@p'
}

get_xml_entity () {
	file=$1
	tag=$2

	< $file sed -e ':a; /<'$tag'/N;s/\n/ /; ta' |
		sed -ne 's/.*<'$tag'> *\(.*\)<\/'$tag'>.*/\1/p'
}

extract_entries () {
  XML=$1

  XMLNAME=`get_xml_option $XML screensaver name`
  XMLARG=`get_xml_option $XML command arg | sed ':a; N; s/\n/ /; ta'` 
  XMLEXE="$XMLNAME $XMLARG"

  XMLLABEL=`get_xml_option $XML screensaver _label`
  XMLGL=`get_xml_option $XML screensaver gl`

  # delete trailing spaces and years
  XMLDES=`get_xml_entity $XML _description |
	sed 's/   */ /g; s/[;,.] [0-9;,. ]*$/./'`

  # Only get first part of first paragraph
  SHORTDES=`echo $XMLDES | sed 's/[.:!(].*/./'`
}


# If called with an argument, create desktop file contents from given xml file
if [ -n "$1" ]; then
	
	extract_entries $1
	cat <<- EODESKTOP

		[Desktop Entry]
		Name=$XMLLABEL
		Exec=/usr/libexec/xscreensaver/$XMLEXE
		TryExec=/usr/libexec/xscreensaver/$XMLNAME
		Comment=$XMLDES
	EODESKTOP
	exit 0
fi



for XML in hacks/config/*.xml; do
  NAME=`basename $XML .xml`
  DSK=debian/screensavers-desktop-files/${NAME}.desktop

  if echo $EXTERNALS $RETIRED $SKIPPED | grep -wq $NAME; then
	if [ -f $DSK ]; then
		echo " external/retired $NAME has a desktop file"
	fi
	continue
  fi

  if [ ! -f hacks/${NAME}.c  ] &&
     [ ! -f hacks/glx/${NAME}.c ] &&
     [ ! -f hacks/${NAME} ]
  then
	echo " no c source or script file for $NAME"
  fi

  if [ ! -f hacks/${NAME}.man  ] &&
     [ ! -f hacks/glx/${NAME}.man ]
  then
	echo " no man page for $NAME"
  fi

  if [ ! -f $DSK ]; then
	echo " missing $DSK file"
	continue
  fi

  extract_entries $XML

  DSKEXE=`sed -n '/^Exec=/s@Exec=@@p' < $DSK`
  DSKEXE=${DSKEXE#/usr/libexec/xscreensaver/}
  if [ x"$XMLEXE" = x ] ||
     [ x"$DSKEXE" = x ] ||
     [ x"$XMLEXE" != x"$DSKEXE" ]; then
	echo " exec not matching: $XMLEXE and $DSKEXE"
  fi

  DSKNAME=`sed -n '/^Name=/s@Name=@@p' < $DSK`
  if [ x"$XMLLABEL" = x ] ||
     [ x"$DSKNAME" = x ] ||
     [ x"$XMLLABEL" != x"$DSKNAME" ]; then
	echo " name not matching: $XMLLABEL and $DSKNAME"
  fi

  DSKTRY=`sed -n '/^TryExec=/s@TryExec=@@p' < $DSK`
  DSKTRY=${DSKTRY#/usr/libexec/xscreensaver/}
  if [ x"$XMLNAME" = x ] ||
     [ x"$DSKTRY" = x ] ||
     [ x"$XMLNAME" != x"$DSKTRY" ]; then
	echo " tryexec name not matching: $XMLNAME and $DSKTRY"
  fi

  DSKDES=`sed -n '/^Comment=/s@Comment=@@p' < $DSK |
		sed 's/[;,.] [0-9;,. ]*$/./'`

#  if [ x"$XMLDES" = x ] ||
#     [ x"$DSKDES" = x ] ||
#     [ x"$XMLDES" != x"$DSKDES" ]; then
#	echo " description not matching on $NAME"
  if [ x"$XMLDES" = x ] || [ x"$DSKDES" = x ]; then
	echo " description missing on $NAME"
  fi

  if grep -q "^$NAME	[a-z-]*-gl" debian/split-hacks.config ; then
	if [ -z "$XMLGL" ]; then
		echo "non-GL saver $NAME in -gl package?"
	fi
  else
	if [ x"$XMLGL" = xyes ]; then
		echo "GL saver $NAME not in gl package?"
	fi
  fi

done