File: x-vendor-substvars

package info (click to toggle)
ltsp 5.5.4-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,440 kB
  • ctags: 359
  • sloc: sh: 5,106; ansic: 1,590; perl: 280; python: 197; makefile: 171; lex: 152; yacc: 59
file content (40 lines) | stat: -rwxr-xr-x 1,762 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

# Copyright (c) 2012 Vagrant Cascadian <vagrant@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA

# Placing X-Debian-Depends in a package control stanza will add 
# ${vendor:Depends} to PACKAGE.substvars if built on Debian.
# Adding Depends: ${vendor:Depends} will be sustituted into the packages
# control file at build time. Arbitrary fields or distributions may be used.
# so: X-Ubuntu-Recommends, X-Debian-Suggests, X-Debian-Description, etc. are
# all valid.
# Thanks go to Alkis Georgopoulos for the idea!

vendor=$1
test -z "$vendor" && exit 1
packages=$(grep-dctrl --show-field Package . debian/control --no-field-names)
for package in $packages ; do
    fields=$(grep-dctrl -F Package -X ${package} debian/control | awk -F : "/^X-${vendor}-.*:/"'{print $1}')
    for field in $fields ; do
	x=$(grep-dctrl -F Package -X ${package} --show-field ${field} --no-field-names debian/control)
        if [ -n "$x" ]; then
		real_field=$(echo $field | sed -e "s,^X-${vendor}-,,g")
		echo "vendor:${real_field}=$(echo "$x" | tr '\n' ' ')" >> debian/$package.substvars
	fi
    done
done