From: Adam Heath Date: Fri, 19 Sep 2003 17:29:08 +0000 (+0000) Subject: * scripts/{controllib,dpkg-{source,checkbuilddeps,control}}.pl: X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5803df202a865da6c36124692cc1acd20c263b8;p=dpkg * scripts/{controllib,dpkg-{source,checkbuilddeps,control}}.pl: * Rewrote the parsedep stuff, so that it wasn't done during control file parsing. Scripts that need the internal parsed format should call parsedep on the field's value. * Split the substvars parsing into a separate function. * No longer validate dependency fields when reading the control file. Some fields may have vars in them, which breaks the validation. * dpkg-gencontrol calls substvars after parsing the control file, and then validates the substituted depends lines. Originally, substitution occured only during writing of the final output file. * Andreas Barth : Fix bad regex that didn't allow spaces in dependency field parsing. It now directly matches what the c code expects. It previously was allowing all of \S, which matched on '('. Closes: #211660. * debian/control: Remove stale debug that would have broken installation on s390. * debian/rules: We were calling our own local copy of dpkg-gencontrol, but the system-installed copy of dpkg-shlibdeps. Now, both are called from the build directory. --- diff --git a/ChangeLog b/ChangeLog index 95ec278e..2c8dcf6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +Fri Sep 19 12:26:54 CDT 2003 Adam Heath + + * scripts/{controllib,dpkg-{source,checkbuilddeps,control}}.pl: + * Rewrote the parsedep stuff, so that it wasn't done during control + file parsing. Scripts that need the internal parsed format should + call parsedep on the field's value. + * Split the substvars parsing into a separate function. + * No longer validate dependency fields when reading the control file. + Some fields may have vars in them, which breaks the validation. + * dpkg-gencontrol calls substvars after parsing the control file, and + then validates the substituted depends lines. Originally, + substitution occured only during writing of the final output file. + * Andreas Barth : + Fix bad regex that didn't allow spaces in dependency field parsing. + It now directly matches what the c code expects. It previously was + allowing all of \S, which matched on '('. + Closes: #211660. + * debian/control: Remove stale debug that would have broken installation + on s390. + * debian/rules: We were calling our own local copy of dpkg-gencontrol, + but the system-installed copy of dpkg-shlibdeps. Now, both are called + from the build directory. + Wed Sep 17 13:26:14 CDT 2003 Adam Heath * debian/changelog, version-nr: Updated to 1.10.13. diff --git a/debian/changelog b/debian/changelog index 00b16618..caebcf11 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,28 @@ +dpkg (1.10.14) unstable; urgency=low + + * controllib.pl: + * Rewrote the parsedep stuff, so that it wasn't done during control + file parsing. Scripts that need the internal parsed format should + call parsedep on the field's value. + * Split the substvars parsing into a separate function. + * No longer validate dependency fields when reading the control file. + Some fields may have vars in them, which breaks the validation. + * dpkg-gencontrol calls substvars after parsing the control file, and + then validates the substituted depends lines. Originally, + substitution occured only during writing of the final output file. + * Andreas Barth : + Fix bad regex that didn't allow spaces in dependency field parsing. + It now directly matches what the c code expects. It previously was + allowing all of \S, which matched on '('. + Closes: #211660. + * Remove stale debug in debian/control that would have broken + installation on s390. + * We were calling our own local copy of dpkg-gencontrol, but the + system-installed copy of dpkg-shlibdeps. Now, both are called from + the build directory. + + -- Adam Heath UNRELEASED + dpkg (1.10.13) unstable; urgency=low * Fix parsing of deps when both () and [] are specified. diff --git a/debian/control b/debian/control index a1cec329..1ac9e19d 100644 --- a/debian/control +++ b/debian/control @@ -13,7 +13,7 @@ Package: dpkg Architecture: any Essential: yes Pre-Depends: dselect, ${shlibs:Pre-Depends} -Conflicts: sysvinit (<< 2.82-1), dpkg-iasearch (<< 0.11), dpkg-static, dpkg-dev (<< 1.9), foo [s390] +Conflicts: sysvinit (<< 2.82-1), dpkg-iasearch (<< 0.11), dpkg-static, dpkg-dev (<< 1.9) Replaces: dpkg-doc-ja, dpkg-static, manpages-de (<= 0.4-3) Description: Package maintenance system for Debian This package contains the programs which handle the installation and diff --git a/debian/rules b/debian/rules index c732c5c2..03de9cc1 100755 --- a/debian/rules +++ b/debian/rules @@ -15,7 +15,8 @@ DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE 2> /dev/nul DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE 2> /dev/null || true) arch := $(shell dpkg-architecture -qDEB_HOST_ARCH) -GENCONTROL := perl -I $(CURDIR)/scripts scripts/dpkg-gencontrol.pl -isp +GENCONTROL := perl -I $(CURDIR)/scripts $(BUILD)/scripts/dpkg-gencontrol -isp +SHLIBDEPS := perl -I $(CURDIR)/scripts $(BUILD)/scripts/dpkg-shlibdeps ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) config_arg := --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) @@ -172,7 +173,7 @@ binary-dpkg-most binary-dpkg-static-most: binary-dpkg%-most: stamp-binary% install -p -m 755 -o root -g root debian/dpkg.postinst $(TMP_DPKG)/DEBIAN/postinst install -p -m 755 -o root -g root debian/dpkg.postrm $(TMP_DPKG)/DEBIAN/postrm - dpkg-shlibdeps -dPre-Depends -Tdebian/dpkg$(static).substvars \ + $(SHLIBDEPS) -dPre-Depends -Tdebian/dpkg$(static).substvars \ $(TMP_DPKG)/sbin/start-stop-daemon \ `test -z "$(static)" && echo $(TMP_DPKG)/usr/bin/dpkg $(TMP_DPKG)/usr/bin/md5sum $(TMP_DPKG)/usr/bin/dpkg-deb` @@ -280,7 +281,7 @@ binary-dselect: stamp-binary install -d -m 755 -o root -g root $(TMP_DSELECT)/DEBIAN install -p -m 644 -o root -g root debian/dselect.conffiles $(TMP_DSELECT)/DEBIAN/conffiles - dpkg-shlibdeps -Tdebian/dselect.substvars \ + $(SHLIBDEPS) -Tdebian/dselect.substvars \ $(TMP_DSELECT)/usr/bin/dselect $(GENCONTROL) -Tdebian/dselect.substvars -pdselect -P$(TMP_DSELECT) dpkg --build $(TMP_DSELECT) .. diff --git a/scripts/controllib.pl b/scripts/controllib.pl index f7ade049..d5c11b75 100755 --- a/scripts/controllib.pl +++ b/scripts/controllib.pl @@ -105,22 +105,7 @@ sub substvars { sub outputclose { my ($dosubstvars) = @_; for $f (keys %f) { $substvar{"F:$f"}= $f{$f}; } - if (length($varlistfile) and $dosubstvars) { - $varlistfile="./$varlistfile" if $varlistfile =~ m/\s/; - if (open(SV,"< $varlistfile")) { - binmode(SV); - while () { - next if m/^\#/ || !m/\S/; - s/\s*\n$//; - m/^(\w[-:0-9A-Za-z]*)\=/ || - &error("bad line in substvars file $varlistfile at line $."); - $substvar{$1}= $'; - } - close(SV); - } elsif ($! != ENOENT ) { - &error("unable to open substvars file $varlistfile: $!"); - } - } + &parsesubstvars if ($dosubstvars); for $f (sort { $fieldimps{$b} <=> $fieldimps{$a} } keys %f) { $v= $f{$f}; if ($dosubstvars) { @@ -154,20 +139,31 @@ sub parsecontrolfile { defined($fi{"C$i Package"}) || &error("per-package paragraph $i in control info file is ". "missing Package line"); - foreach my $dep_field (@pkg_dep_fields) { - if (defined($fi{"C$i $dep_field"})) { - ($fi{"C$i $dep_field"} = parsedep($fi{"C$i $dep_field"}, 1, 1)) || - &error("per-package paragraph $i in control info file ". - "invalid dependency field \`$dep_field'"); - } - } } - foreach my $dep_field (@src_dep_fields) { - if (defined($fi{"C $dep_field"})) { - ($fi{"C $dep_field"} = parsedep($fi{"C $dep_field"}, 1, 1)) || - &error("source paragraph in control info file ". - "invalid dependency field \`$dep_field'"); + defined($fi{"C Source"}) || + &error("source paragraph in control info file is ". + "missing Source line"); + +} + +my $substvarsparsed = 0; +sub parsesubstvars { + if (length($varlistfile) && !$substvarsparsed) { + $varlistfile="./$varlistfile" if $varlistfile =~ m/\s/; + if (open(SV,"< $varlistfile")) { + binmode(SV); + while () { + next if m/^\#/ || !m/\S/; + s/\s*\n$//; + m/^(\w[-:0-9A-Za-z]*)\=/ || + &error("bad line in substvars file $varlistfile at line $."); + $substvar{$1}= $'; + } + close(SV); + } elsif ($! != ENOENT ) { + &error("unable to open substvars file $varlistfile: $!"); } + $substvarsparsed = 1; } } @@ -183,7 +179,7 @@ sub parsedep { ALTERNATE: foreach my $dep_or (split(/\s*\|\s*/m, $dep_and)) { my ($package, $relation, $version); - $package = $1 if ($dep_or =~ s/^(\S+)\s*//m); + $package = $1 if ($dep_or =~ s/^([a-zA-Z0-9][a-zA-Z0-9+._-]*)\s*//m); ($relation, $version) = ($1, $2) if ($dep_or =~ s/^\((=|<=|>=|<>?)\s*([^)]+).*\)\s*//m); my @arches = split(/\s+/m, $1) if ($use_arch && $dep_or =~ s/^\[([^]]+)\]\s*//m); if ($reduce_arch && @arches) { diff --git a/scripts/dpkg-checkbuilddeps.pl b/scripts/dpkg-checkbuilddeps.pl index d7d3d846..e881f484 100755 --- a/scripts/dpkg-checkbuilddeps.pl +++ b/scripts/dpkg-checkbuilddeps.pl @@ -41,16 +41,16 @@ local $/=''; my $dep_regex=qr/[ \t]*(([^\n]+|\n[ \t])*)\s/; # allow multi-line if (defined($fi{"C Build-Depends"})) { - push @unmet, build_depends($fi{"C Build-Depends"}, @status); + push @unmet, build_depends(parsedep($fi{"C Build-Depends"}), @status); } if (defined($fi{"C Build-Conflicts"})) { - push @unmet, build_conflicts($fi{"C Build-Conflicts"}, @status); + push @unmet, build_conflicts(parsedep($fi{"C Build-Conflicts"}), @status); } if (! $binary_only && defined($fi{"C Build-Depends-Indep"})) { - push @unmet, build_depends($fi{"C Build-Depends-Indep"}, @status); + push @unmet, build_depends(parsedep($fi{"C Build-Depends-Indep"}), @status); } if (! $binary_only && defined($fi{"C Build-Conflicts-Indep"})) { - push @unmet, build_conflicts($fi{"C Build-Conflicts-Indep"}, @status); + push @unmet, build_conflicts(parsedep($fi{"C Build-Conflicts-Indep"}), @status); } if (@unmet) { diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl index da7099d3..b455a0e0 100755 --- a/scripts/dpkg-gencontrol.pl +++ b/scripts/dpkg-gencontrol.pl @@ -98,6 +98,7 @@ while (@ARGV) { &findarch; &parsechangelog; +&parsesubstvars; &parsecontrolfile; if (length($oppackage)) { @@ -129,7 +130,7 @@ for $_ (keys %fi) { if (m/^(Package|Description|Essential|Optional)$/) { $f{$_}= $v; } elsif (exists($pkg_dep_fields{$_})) { - $f{$_}= showdep($v, 0); + $f{$_}= showdep(parsedep(substvars($v)), 0); } elsif (m/^Section$|^Priority$/) { $spvalue{$_}= $v; } elsif (m/^Architecture$/) { diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl index 789e04bb..f5dfdd74 100755 --- a/scripts/dpkg-source.pl +++ b/scripts/dpkg-source.pl @@ -155,7 +155,7 @@ if ($opmode eq 'build') { if (s/^C //) { if (m/^Source$/i) { &setsourcepackage; } elsif (m/^(Standards-Version|Origin|Maintainer|Uploaders)$/i) { $f{$_}= $v; } - elsif (m/^Build-(Depends|Conflicts)(-Indep)?$/i) { $f{$_}= showdep($v, 0); } + elsif (m/^Build-(Depends|Conflicts)(-Indep)?$/i) { $f{$_}= $v; } elsif (s/^X[BC]*S[BC]*-//i) { $f{$_}= $v; } elsif (m/^(Section|Priority|Files|Bugs)$/i || m/^X[BC]+-/i) { } else { &unknown('general section of control info file'); }