This file is indexed.

/usr/share/cdbs/1/class/octave-pkg.mk is in octave-pkg-dev 1.1.3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
181
182
183
184
185
186
187
188
189
190
191
192
# -*- makefile -*-
# octave-pkg.mk: CDBS-based debian/rules scrap for building/installing
#                octave-forge pkg add-ons
# This file is part of the octave-pkg-dev Debian package

# Copyright (c) 2008  Olafur Jens Sigurðsson <ojsbug@gmail.com>
# Copyright (c) 2008, 2009, 2012  Rafael Laboissiere <rafael@laboissiere.net>
#
# 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 3 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.

include /usr/share/cdbs/1/rules/debhelper.mk

package = $(shell awk '/^Package:/ {print $$2; exit 0}' debian/control)
debpkg = debian/$(package)
shrpkg = /usr/share/octave/debian
# The directories below are versioned.  We only support the packages for the
# stable version of Octave
mpath = usr/share/octave/packages
bpath = usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)/octave/packages
hosttype = $(shell octave-config -p CANONICAL_HOST_TYPE)
version = $(shell octave-config -p VERSION | sed 's/-rc/~rc/')
apiversion = $(shell octave-config -p API_VERSION)
octave = /usr/bin/octave
octave_options = --no-history --silent --no-init-file --no-window-system
global_list = global-list
local_list = local-list

# The following variable can be overriden in debian/rules to alter the
# behavior of the tests.  Possible values are 'quiet', 'normal', and
# 'verbose'.  Users must set its value after inclusion of octave-pkg.mk.
OCTPKG_TEST_OPT =

# The following variable can be overriden in debian/rules to alter the the
# way the tests are run.  Its is value is prepended to the octave command.
# A sensible value for it would be 'xvfb-run', but environment variables
# can be also set.  Users must set its value after inclusion of
# octave-pkg.mk.
OCTPKG_TEST_ENV =

export OCTAVE_HISTFILE=/dev/null
# even with '--no-history', Octave creates an empty .octave_hist at startup,
# resulting in 'permission denied errors on the buildds

# Export buildflags to the environment, they will be picked up by mkoctfile.
# Link with --as-needed since that drastically reduces the number of linked
# libraries.
DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
# Oct-files ldflags are taken from the following variable
export OCT_LINK_OPTS=$(LDFLAGS)

install/$(package)::	\
	check-version	\
	create-dirs	\
	install-pkg	\
	clean-files	\
	install-docs	\
	check-pkg	\
	remove-dirs

.PHONY: check-version
check-version:
	@echo -n "Checking the Octave version... "
	@dep=$$(grep Depends DESCRIPTION				\
          | perl -ne 'if (/octave\s+\(>=\s*([.\d]+)\)/) {print $$1}') ;	\
	if [ "$$dep" != "" ] ; then					\
		dpkg --compare-versions $(version) ge $$dep		\
			|| (echo ;					\
			    echo "Octave version mismatch:"		\
				 "Needs >= $$dep, but version"		\
				 "$(version) is installed" 1>&2 ;	\
			    false) ;					\
	fi ;								\
	echo ok

.PHONY: create-dirs
create-dirs:
	mkdir -p $(CURDIR)/$(debpkg)/$(mpath)	\
		 $(CURDIR)/$(debpkg)/$(bpath)

.PHONY: install-pkgs
install-pkg:
	-[ -e PKG_ADD ] && mv PKG_ADD PKG_ADD.bak
	$(octave) $(octave_options) --eval				\
		 "pkg ('prefix', [pwd(),'/$(debpkg)/$(mpath)'],		\
		      [pwd(),'/$(debpkg)/$(bpath)']);			\
		 pkg ('local_list', [pwd(),'/$(local_list)']);		\
		 pkg ('global_list', [pwd(),'/$(global_list)']);	\
		 if (exist ('PKG_ADD.bak') == 2),			\
		     movefile ('PKG_ADD.bak', 'PKG_ADD');		\
		 endif;							\
		 pkg -verbose -nodeps install ."
	$(shrpkg)/dh/octave-pkg-helper
	dh_install --package=$(package)

.PHONY: clean-files
clean-files::
	( cd  $(shell find . -name packinfo) ; rm -f COPYING ChangeLog )

.PHONY: install-docs
install-docs:
	if [ -d doc ] ; then				\
		dh_installdocs -p$(package);		\
		rm -rf $(debpkg)/$(mpath)/*/doc ;	\
	fi

.PHONY: check-pkg
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
check-pkg:
	-[ -e PKG_ADD ] && mv PKG_ADD PKG_ADD.bak

	@echo Checking package...

# Extract tests from installed m files
	@echo Checking m files ...
	@tmp=$$(tempfile) ;					\
	echo "addpath (genpath ([pwd(),'/debian']));" > $$tmp ;	\
	find debian/ -name \*.m					\
		| grep -v /private/				\
		| xargs grep -l '^%!\(assert\|test\)'		\
		| perl -pe 's:[^@]*/(.*)\.m::;			\
		 print "disp (\"[$$1]\")\ntest $$1 $(OCTPKG_TEST_OPT)"'	\
		>> $$tmp ;					\
	$(OCTPKG_TEST_ENV) $(octave) $(octave_options) $$tmp ;	\
	rm -f $$tmp

# Extract tests from .cc files - these are not installed, but the
# compiled .oct files are.
# We search for the tests in the .cc files, but invoke the .oct files;
# this means we must add generate a loadpath starting at the current
# directory and source PKG_ADD files (they might add autoload()
# directives)

# We deactivate the warning about relative paths used for the PKG_ADD file.
	@echo Checking CC files ...
	@tmp=$$(tempfile) ;					\
	echo "addpath (genpath ([pwd()], '.pc'));" >> $$tmp ;	\
	echo "warning ('off', 'Octave:autoload-relative-file-name');" >> $$tmp ;	\
	if [ -f PKG_ADD ] ; then				\
		echo "source('PKG_ADD');" >> $$tmp ; 		\
	fi ;							\
	if [ -f PKG_ADD.bak ] ; then				\
		echo "source('PKG_ADD.bak');" >> $$tmp ;	\
	fi ;							\
	if [ -d src ] ; then					\
		find src/ -name \*.cc				\
			| xargs grep -l '^%!\(assert\|test\)'	\
			| perl -pe 's:.*/(.*)\.cc::;		\
				print "disp (\"[$$1]\")\ntest $$1 $(OCTPKG_TEST_OPT)"'	\
			>> $$tmp ;				\
	fi ;							\
	octave $(octave_options) $$tmp ;			\
	rm -f $$tmp

	@if [ -f debian/check.m ] ; then				\
		$(OCTPKG_TEST_ENV) $(octave) $(octave_options) --eval	\
			"addpath (genpath ([pwd(),'/debian']));		\
			 source ('debian/check.m');" ;			\
	fi

	-[ -e PKG_ADD.bak ] && mv PKG_ADD.bak PKG_ADD
else
check-pkg:
endif

.PHONY: remove-dirs
remove-dirs:
	rmdir --ignore-fail-on-non-empty -p	\
		 $(CURDIR)/$(debpkg)/$(mpath)	\
		 $(CURDIR)/$(debpkg)/$(bpath)


DEB_MAKE_CLEAN_TARGET = -C src clean

clean::
ifneq ($(DEB_MAKE_CLEAN_TARGET),)
	-$(MAKE) -k $(DEB_MAKE_CLEAN_TARGET)
endif
	rm -rf inst/$(hosttype)-$(apiversion) $(global_list) $(local_list)