diff options
Diffstat (limited to 'debian/ada')
-rw-r--r-- | debian/ada/check_ali_update.sh | 41 | ||||
-rw-r--r-- | debian/ada/confirm_debian_bugs.py | 94 | ||||
-rw-r--r-- | debian/ada/debian_packaging.mk | 48 |
3 files changed, 116 insertions, 67 deletions
diff --git a/debian/ada/check_ali_update.sh b/debian/ada/check_ali_update.sh new file mode 100644 index 0000000..4067341 --- /dev/null +++ b/debian/ada/check_ali_update.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# Helper for debian/rules2. + +# A modification of libgnat sources invalidates the .ali checksums in +# reverse dependencies as described in the Debian Policy for Ada. GCC +# cannot afford the recommended passage through NEW, but this check at +# least reports the issue before causing random FTBFS. + +set -Cefu +[$# = 2] +# Argument 1: old ALI dir +# Argument 2: new ALI dir + +# A missing $1 means that we build a new GCC Base Version, and that +# libgnatBV-dev package will be renamed anyway. +[-d "$1"] || exit 0 + +report () { + echo 'error: changes in Ada Library Information files.' + echo 'You are seeing this because' + echo ' * DEB_CHECK_ALI_UPDATE=1 in the environment.' + echo ' * build_type=build-native and with_libgnat=yes in debian/rules.defs.' + echo " * $1 exists, so libgnat is probably rebuilding itself with the same version." + echo " * checksums in former $1 and freshly built $2 differ." + echo 'This may break Ada packages, see https://people.debian.org/~lbrenta/debian-ada-policy.html.' + echo 'If you are uploading to Debian, please contact debian-ada@lists.debian.org.' + exit 1 +} + +for ali1 in `find "$1" -name "*.ali"`; do + unit=`basename "$ali1" .ali` + ali2="$2/$unit.ali" + + [-r "$ali2"] || report "$ali1" "$ali2" + + pattern="^D $unit\.ad" + lines1=`grep "$pattern" "$ali1"` + lines2=`grep "$pattern" "$ali2"` + ["$lines1" = "lines2"] || report "$ali1" "$ali2" +done diff --git a/debian/ada/confirm_debian_bugs.py b/debian/ada/confirm_debian_bugs.py index 7286382..c076730 100644 --- a/debian/ada/confirm_debian_bugs.py +++ b/debian/ada/confirm_debian_bugs.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python3 # Helper when migrating bugs from a gnat version to another. @@ -11,15 +11,14 @@ import tempfile os.environ ['LC_ALL'] = 'C' -# If == new_version, "reassign" -> "found" and "retitle" -> "fixed". -# Once the bug tracking system is informed, -# please update this number. -old_version = "5" +# If True, "reassign" -> "found" and "retitle" -> "fixed". +# Once the bug tracking system is informed, please update this boolean. +same_gcc_base_version = True # The current version. -new_version = "6" +new_version = "9" -for line in subprocess.check_output (("dpkg", "--status", "gnat-" + new_version)).split ("\n"): +for line in subprocess.check_output (("dpkg", "--status", "gnat-" + new_version)).decode ().split ("\n"): if line.startswith ("Version: "): deb_version = line [len ("Version: "):] break @@ -46,7 +45,7 @@ def attempt_to_reproduce (bug, make, sources): return tmp_dir, status, stderr def reassign_and_remove_dir (bug, tmp_dir): - if old_version == new_version: + if same_gcc_base_version: print ("found {} {}".format (bug, deb_version)) else: print ("reassign {} {} {}".format (bug, "gnat-" + new_version, deb_version)) @@ -59,7 +58,7 @@ def report (bug, message, output): def report_and_retitle (bug, message, output): report (bug, message, output) - if old_version == new_version: + if same_gcc_base_version: print ("fixed {} {}".format (bug, deb_version)) else: print ("retitle {} [Fixed in {}] <current title>".format (bug, new_version)) @@ -94,7 +93,7 @@ def check_produces_a_faulty_executable (bug, make, sources, regex, trigger): if status != 0: report (bug, "cannot compile the trigger anymore", stderr) else: - output = subprocess.check_output ((os.path.join (tmp_dir, trigger),), cwd=tmp_dir) + output = subprocess.check_output ((os.path.join (tmp_dir, trigger),), cwd=tmp_dir).decode () if re.search (regex, output): reassign_and_remove_dir (bug, tmp_dir) else: @@ -142,7 +141,7 @@ end pak5; check_reports_an_error_but_should_not ( bug = 246187, make = ("gnatmake", "test_43"), - regex = "Error detected at system.ads:156:5", + regex = "Error detected at test_43.ads:11:4", sources = ( ("test_43.ads", """package Test_43 is type T1 is private; @@ -660,7 +659,7 @@ end Test_128; check_reports_an_error_but_should_not ( bug = 279893, make = ("gnatmake", "test_129"), - regex = """^gcc-[0-9.]+ -c test_129\.ads + regex = """gcc-[0-9.]+ -c test_129\.ads test_129\.ads:1.:49: designated type of actual does not match that of formal "T2" test_129\.ads:1.:49: instantiation abandoned gnatmake: "test_129\.ads" compilation error$""", @@ -814,44 +813,6 @@ private end pak1; """),)) -# Once the bug box disappears, check the executable. -# check_produces_a_faulty_executable ( -check_reports_an_error_but_should_not ( - bug = 427108, - make = ("gnatmake", "test1"), -# regex = "FAILED", - regex = "Program_Error exp_disp.adb:7842 explicit raise", - sources = ( - ("test1.adb", """-- "For the execution of a call on an inherited subprogram, --- a call on the corresponding primitive subprogram of the --- parent or progenitor type is performed; the normal conversion --- of each actual parameter to the subtype of the corresponding --- formal parameter (see 6.4.1) performs any necessary type --- conversion as well." - -with Text_IO; use Text_IO; -procedure Test1 is - package Pak1 is - type T1 is tagged null record; - function Eq(X, Y: T1) return Boolean renames "="; - end Pak1; - - package Pak2 is - type T2 is new Pak1.T1 with record - F1: Integer; - end record; - end Pak2; - - Z1: Pak2.T2 := (F1 => 1); - Z2: Pak2.T2 := (F1 => 2); -begin - if Pak2.Eq(Z1, Z2) = Pak1.Eq(Pak1.T1(Z1), Pak1.T1(Z2)) - then Put_Line("PASSED"); - else Put_Line("FAILED"); - end if; -end Test1; -"""),)) - check_reports_an_error_but_should_not ( bug = 660698, make = ("gnatmake", "proc.adb"), @@ -962,6 +923,39 @@ begin end Test; """))) +check_produces_a_faulty_executable ( + bug = 864969, + make = ("gnatmake", "main"), + trigger = "main", + regex = "ZZund", + sources = ( + ("main.adb", """with Ada.Locales, Ada.Text_IO; +procedure Main is +begin + Ada.Text_IO.Put_Line (String (Ada.Locales.Country) + & String (Ada.Locales.Language)); +end Main; +"""),)) + +check_produces_a_faulty_executable ( + bug = 894225, + make = ("gnatmake", "main"), + trigger = "main", + sources = ( + ("main.adb", + """with Ada.Directories, Ada.Text_IO; +procedure Main is +begin + Ada.Text_IO.Put_Line (Ada.Directories.Containing_Directory ("/a/b/")); + Ada.Text_IO.Put_Line (Ada.Directories.Containing_Directory ("a/b/")); + Ada.Text_IO.Put_Line (Ada.Directories.Containing_Directory ("b/")); +end Main; +"""), + ), + regex = """^/a/b +a/b +b$""") + try: os.rmdir (workspace) except: diff --git a/debian/ada/debian_packaging.mk b/debian/ada/debian_packaging.mk index b0329b4..2680dc8 100644 --- a/debian/ada/debian_packaging.mk +++ b/debian/ada/debian_packaging.mk @@ -1,6 +1,6 @@ # Common settings for Ada Debian packaging. # -# Copyright (C) 2012-2014 Nicolas Boulenguez <nicolas@debian.org> +# Copyright (C) 2012-2019 Nicolas Boulenguez <nicolas@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 @@ -12,11 +12,19 @@ # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# dpkg-dev (>= 1.16.1) provides /usr/share/dpkg/default.mk (or the +# Typical use: +# +# gnat_version := $(shell gnatgcc -dumpversion) +# DEB_BUILD_MAINT_OPTIONS := hardening=+all +# DEB_LDFLAGS_MAINT_APPEND := -Wl,--no-undefined -Wl,--no-copy-dt-needed-entries -Wl,--no-allow-shlib-undefined +# DEB_ADAFLAGS_MAINT_APPEND := -gnatwa -Wall +# include /usr/share/dpkg/buildflags.mk +# include /usr/share/ada/debian_packaging-$(gnat_version).mk + +# dpkg-dev provides /usr/share/dpkg/default.mk (or the # more specific buildflags.mk) to set standard variables like -# DEB_HOST_MULTIARCH, CFLAGS, LDFLAGS...) according to the build +# DEB_HOST_MULTIARCH, CFLAGS, LDFLAGS... according to the build # environment (DEB_BUILD_OPTIONS...) and the policy (hardening # flags...). # You must include it before this file. @@ -30,20 +38,22 @@ endif # Format checking is meaningless for Ada sources. ADAFLAGS := $(filter-out -Wformat -Werror=format-security, $(CFLAGS)) -ifdef DPKG_EXPORT_BUILDFLAGS - export ADAFLAGS +ifdef DEB_ADAFLAGS_SET + ADAFLAGS := $(DEB_ADAFLAGS_SET) endif +ADAFLAGS := $(DEB_ADAFLAGS_PREPEND) \ + $(filter-out $(DEB_ADAFLAGS_STRIP),$(ADAFLAGS)) \ + $(DEB_ADAFLAGS_APPEND) -# Avoid dpkg-shlibdeps warning about depending on a library from which -# no symbol is used, see http://wiki.debian.org/ToolChain/DSOLinking. -# Gnatmake users must upgrade to >= 4.6.4-1 to circumvent #680292. -LDFLAGS += -Wl,--as-needed - -# Warn during build time if undefined symbols. -LDFLAGS += -Wl,-z,defs +ifdef DEB_ADAFLAGS_MAINT_SET + ADAFLAGS := $(DEB_ADAFLAGS_MAINT_SET) +endif +ADAFLAGS := $(DEB_ADAFLAGS_MAINT_PREPEND) \ + $(filter-out $(DEB_ADAFLAGS_MAINT_STRIP),$(ADAFLAGS)) \ + $(DEB_ADAFLAGS_MAINT_APPEND) ifdef DPKG_EXPORT_BUILDFLAGS - export LDFLAGS + export ADAFLAGS endif ###################################################################### @@ -51,8 +61,9 @@ endif # GCC binaries must be compatible with GNAT at the binary level, use # the same version. This setting is mandatory for every upstream C -# compilation ("export CC" is enough for dh_auto_configure with a -# normal ./configure). +# compilation. Typical use: +# override_dh_auto_configure: +# dh_auto_configure -- CC='$(CC)' CC := gnatgcc @@ -64,7 +75,8 @@ CC := gnatgcc # Use all processors unless parallel=n is set in DEB_BUILD_OPTIONS. # http://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules-options -BUILDER_JOBS := $(filter parallel=%,$(DEB_BUILD_OPTIONS)) +# The value may be useful elsewhere. Example: SPHINXOPTS=-j$(BUILDER_JOBS) +BUILDER_JOBS := $(filter parallel=%,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_MAINT_OPTIONS)) ifneq (,$(BUILDER_JOBS)) BUILDER_JOBS := $(subst parallel=,,$(BUILDER_JOBS)) else @@ -76,7 +88,9 @@ BUILDER_OPTIONS += -R # Avoid lintian warning about setting an explicit library runpath. # http://wiki.debian.org/RpathIssue +ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_MAINT_OPTIONS))) BUILDER_OPTIONS += -v +endif # Make exact command lines available for automatic log checkers. BUILDER_OPTIONS += -eS |