1 # Copyright © 2012 Guillem Jover <guillem@debian.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 package Dpkg::Build::Env;
21 our $VERSION = '0.01';
23 my %env_modified = ();
24 my %env_accessed = ();
30 Dpkg::Build::Env - track build environment
34 The Dpkg::Build::Env module is used by dpkg-buildflags to track the build
35 environment variables being used and modified.
41 =item $bf->set($varname, $value)
43 Update the build environment variable $varname with value $value. Record
44 it as being accessed and modified.
49 my ($varname, $value) = @_;
50 $env_modified{$varname} = 1;
51 $env_accessed{$varname} = 1;
52 $ENV{$varname} = $value;
55 =item $bf->get($varname)
57 Get the build environment variable $varname value. Record it as being
64 $env_accessed{$varname} = 1;
65 return $ENV{$varname};
68 =item $bf->has($varname)
70 Return a boolean indicating whether the environment variable exists.
71 Record it as being accessed.
77 $env_accessed{$varname} = 1;
78 return exists $ENV{$varname};
81 =item @list = $bf->list_accessed()
83 Returns a list of all environment variables that have been accessed.
88 my @list = sort keys %env_accessed;
92 =item @list = $bf->list_modified()
94 Returns a list of all environment variables that have been modified.
99 my @list = sort keys %env_modified;
109 This is a private module.