diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:42:30 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:42:30 +0000 |
commit | 75808db17caf8b960b351e3408e74142f4c85aac (patch) | |
tree | 7989e9c09a4240248bf4658a22208a0a52d991c4 /t/recipes/checks/libraries/shared/relocation | |
parent | Initial commit. (diff) | |
download | lintian-75808db17caf8b960b351e3408e74142f4c85aac.tar.xz lintian-75808db17caf8b960b351e3408e74142f4c85aac.zip |
Adding upstream version 2.117.0.upstream/2.117.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/recipes/checks/libraries/shared/relocation')
10 files changed, 178 insertions, 0 deletions
diff --git a/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/Makefile.in b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/Makefile.in new file mode 100644 index 0000000..372897d --- /dev/null +++ b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/Makefile.in @@ -0,0 +1,110 @@ +# this makefile was adapted from the standard template to do just one thing: +# to ensure that no building takes place on architectures other than i386. +# +# dpkg-buildpackage croaks not only on build errors but also if there simply +# is nothing to do. source packages are nowadays permitted to create +# undeclared build artifacts. there is no way to tell when a build should +# or should not proceed (although the buildds use a heuristic based on the +# dsc). +# +# this makefile also touches the build product to make sure it exists. for +# historical reasons, the test runner check that (although perhaps it should +# not). +# +# more information may be available at Bug#949066. + +ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) + +package = [% $source %] +upstream_version = [% $upstream_version %] +type = [% $type %] + +packagedir = $(package)-$(upstream_version) + +origdata = $(ROOT_DIR)/orig +origtargz = $(package)_$(upstream_version).orig.tar.gz + +debiandata = $(ROOT_DIR)/debian +formatfile = $(debiandata)/source/format + +diffdata = $(ROOT_DIR)/diff + +private_key = $(ROOT_DIR)/upstream/private-key.asc + +pre_build = $(ROOT_DIR)/pre-build +post_build = $(ROOT_DIR)/post-build +pre_upstream = $(ROOT_DIR)/pre-upstream + +product = [% $build_product %] +upload_type = [% $upload_type %] + +ifeq ($(upload_type),source) +extraflags = -S +else +extraflags = +endif + +.DEFAULT_GOAL := $(product) + +ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH),i386) +$(product): $(origtargz) + if [ -r $(origtargz) -a -r $(private_key) ] ; then \ + tmpdir=$(shell mktemp -d) ; \ + gpg --homedir "$$tmpdir" --import $(private_key) ; \ + gpg --homedir "$$tmpdir" --batch --yes --armor --output $(origtargz).asc \ + --detach-sign $(origtargz) ; \ + gpg-connect-agent --homedir "$$tmpdir" KILLAGENT /bye ; \ + rm -rf "$$tmpdir" ; \ + fi + if [ -d $(diffdata)/. ] ; then \ + cp -rp $(diffdata)/. $(packagedir) ; \ + fi + if [ -d $(debiandata)/. ] ; then \ + cp -rp $(debiandata)/. $(packagedir)/debian ; \ + fi + + if [ -x $(pre_build) ] ; then \ + $(pre_build) $(shell realpath $(packagedir)) ; \ + fi + + cd $(packagedir) && dpkg-buildpackage -rfakeroot $(extraflags) -us -uc -d \ + -iNEVER_MATCH_ANYTHING -INEVER_MATCH_ANYTHING --source-option=--auto-commit + + if [ -x $(post_build) ] ; then \ + $(post_build) $(shell realpath $(packagedir)) ; \ + fi +else +$(product): + touch $(product) +endif + +ifeq ($(type),native) +$(origtargz): + -mkdir $(packagedir) + if [ -d $(origdata)/. ] ; then \ + cp -rp $(origdata)/. $(packagedir) ; \ + fi +else +$(origtargz): + -mkdir $(packagedir) + if [ -d $(origdata)/. ] ; then \ + cp -rp $(origdata)/. $(packagedir) ; \ + fi + + if [ -x $(pre_upstream) ] ; then \ + $(pre_upstream) $(shell realpath $(packagedir)) ; \ + fi + + tar czf $(origtargz) $(packagedir) + + if [ -f $(formatfile) ] && grep --quiet "^3\.. (quilt)$$" $(formatfile) ; then \ + rm -rf $(packagedir)/debian ; \ + fi +endif + +.PHONY: clean +clean: + rm -rf $(packagedir) + if [ "$(type)" = "native" ] ; then \ + rm -f $(origtargz) ; \ + fi diff --git a/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/debian/compat.in b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/debian/compat.in new file mode 100644 index 0000000..640a566 --- /dev/null +++ b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/debian/compat.in @@ -0,0 +1 @@ +[% $dh_compat_level %] diff --git a/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/debian/control.in b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/debian/control.in new file mode 100644 index 0000000..47c51c7 --- /dev/null +++ b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/debian/control.in @@ -0,0 +1,16 @@ +Source: [% $source %] +Priority: optional +Section: libs +Maintainer: [% $author %] +Standards-Version: [% $standards_version %] +Build-Depends: [% $build_depends %] +Rules-Requires-Root: no + +Package: libbaz3-1 +Architecture: [% $package_architecture %] +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: [% $description %] + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. + diff --git a/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/debian/symbols b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/debian/symbols new file mode 100644 index 0000000..63ba04d --- /dev/null +++ b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/debian/symbols @@ -0,0 +1,3 @@ +libbaz3.so libbaz3-1 #MINVER# + pw@Base 1.0 + stackprotfix@Base 1.0 diff --git a/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/fill-values b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/fill-values new file mode 100644 index 0000000..cb0b316 --- /dev/null +++ b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/fill-values @@ -0,0 +1,6 @@ +Skeleton: upload-native +Testname: shared-libs-non-pic-i386 +Package-Architecture: i386 +Default-Build-Depends: debhelper (>= 9.20151004~) +Dh-Compat-Level: 9 +Description: Test checks related to non-pic code diff --git a/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/orig/Makefile b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/orig/Makefile new file mode 100644 index 0000000..c5ec48c --- /dev/null +++ b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/orig/Makefile @@ -0,0 +1,26 @@ +CC=gcc + +NOPICOBJS=non-pic.o +SONAME:=libbaz3.so.1 + +NOPIC_CFLAGS = $(CFLAGS) -fno-PIE +NOPIC_LDFLAGS = $(LDFLAGS) -fno-PIE -fno-pie + +all: libbaz3.so.1.0.3b + +# Non-PIC. We can't test this on all architectures +libbaz3.so.1.0.3b: $(NOPICOBJS) + $(CC) $(NOPIC_LDFLAGS) -o $@ -shared -Wl,-soname,$(SONAME) $^ -lc + +%.o: %.c + $(CC) $(NOPIC_CFLAGS) $(CPPFLAGS) -o $@ -c $< + +clean: + rm -f *.a *.o *.so* *.sho + +install: all + install -m 0755 -d $(DESTDIR)/usr/lib + install -m 0644 *.so* $(DESTDIR)/usr/lib + ln -s libbaz3.so.1.0.3b $(DESTDIR)/usr/lib/$(SONAME) + +.PHONY: install clean diff --git a/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/orig/non-pic.c b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/orig/non-pic.c new file mode 100644 index 0000000..f0fa719 --- /dev/null +++ b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/build-spec/orig/non-pic.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <string.h> + +double pw(double p){ + return exp(p); +} + +void stackprotfix(void (*f)(char *, size_t)) { + char buffer[10]; + f(buffer, sizeof(buffer)); +} diff --git a/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/eval/desc b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/eval/desc new file mode 100644 index 0000000..a84565c --- /dev/null +++ b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/eval/desc @@ -0,0 +1,3 @@ +Testname: shared-libs-non-pic-i386 +Test-Architectures: i386 +Check: libraries/shared/relocation diff --git a/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/eval/hints b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/eval/hints new file mode 100644 index 0000000..dbd4fe7 --- /dev/null +++ b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/eval/hints @@ -0,0 +1 @@ +libbaz3-1 (binary): specific-address-in-shared-library [usr/lib/libbaz3.so.1.0.3b] diff --git a/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/eval/post-test b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/eval/post-test new file mode 100755 index 0000000..11ad2c8 --- /dev/null +++ b/t/recipes/checks/libraries/shared/relocation/shared-libs-non-pic-i386/eval/post-test @@ -0,0 +1 @@ +/: hardening-.*/ d |