From e1710658999029bb7de1d8ad73800f6f0fe2cf40 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 17 Dec 2007 17:21:43 +0000 Subject: add some tests for %buildroot, %defaultbuildroot, BuildRoot --- t/data/SPECS/buildroot_BuildRoot.spec | 33 +++++++++++++++++++++++++++++++++ t/data/SPECS/buildroot_default.spec | 32 ++++++++++++++++++++++++++++++++ t/data/SPECS/buildroot_define.spec | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 t/data/SPECS/buildroot_BuildRoot.spec create mode 100644 t/data/SPECS/buildroot_default.spec create mode 100644 t/data/SPECS/buildroot_define.spec (limited to 't/data') diff --git a/t/data/SPECS/buildroot_BuildRoot.spec b/t/data/SPECS/buildroot_BuildRoot.spec new file mode 100644 index 00000000..2dce81c4 --- /dev/null +++ b/t/data/SPECS/buildroot_BuildRoot.spec @@ -0,0 +1,33 @@ +%define macro_using_buildroot $(echo %buildroot) + +Summary: x +Name: buildroot_BuildRoot +Version: 1 +Release: 1 +License: x +Group: x +Url: x +BuildRoot: %{_tmppath}/TESTING-%{version}-%{release} + +%description +x + +%package sub + +Summary: x +Group: x +Version: 2 +Release: 2 + +%description sub +x + +%install +wanted=$(echo %{_tmppath}/TESTING-1-1 | sed 's!//!/!') +[ "%buildroot" = $wanted ] || { echo "buildroot should be $wanted instead of %buildroot"; exit 1; } +[ "$RPM_BUILD_ROOT" = $wanted ] || { echo "RPM_BUILD_ROOT should be $wanted instead of $RPM_BUILD_ROOT"; exit 1; } +[ "%macro_using_buildroot" = $wanted ] || { echo "macro_using_buildroot should be $wanted instead of %buildroot"; exit 1; } + +install -d $RPM_BUILD_ROOT + +%files diff --git a/t/data/SPECS/buildroot_default.spec b/t/data/SPECS/buildroot_default.spec new file mode 100644 index 00000000..1924e847 --- /dev/null +++ b/t/data/SPECS/buildroot_default.spec @@ -0,0 +1,32 @@ +%define macro_using_buildroot $(echo %buildroot) + +Summary: x +Name: buildroot +Version: 1 +Release: 1 +License: x +Group: x +Url: x + +%description +x + +%package sub + +Summary: x +Group: x +Version: 2 +Release: 2 + +%description sub +x + +%install +wanted=%defaultbuildroot +[ "%buildroot" = $wanted ] || { echo "buildroot should be $wanted instead of %buildroot"; exit 1; } +[ "$RPM_BUILD_ROOT" = $wanted ] || { echo "RPM_BUILD_ROOT should be $wanted instead of $RPM_BUILD_ROOT"; exit 1; } +[ "%macro_using_buildroot" = $wanted ] || { echo "macro_using_buildroot should be $wanted instead of %buildroot"; exit 1; } + +install -d $RPM_BUILD_ROOT + +%files diff --git a/t/data/SPECS/buildroot_define.spec b/t/data/SPECS/buildroot_define.spec new file mode 100644 index 00000000..1b8cd33c --- /dev/null +++ b/t/data/SPECS/buildroot_define.spec @@ -0,0 +1,34 @@ +%define macro_using_buildroot $(echo %buildroot) + +%define buildroot %{_tmppath}/TESTING + +Summary: x +Name: buildroot_define +Version: 1 +Release: 1 +License: x +Group: x +Url: x + +%description +x + +%package sub + +Summary: x +Group: x +Version: 2 + +%description sub +x + + +%install +wanted=%{_tmppath}/TESTING +[ "%buildroot" = $wanted ] || { echo "buildroot should be $wanted instead of %buildroot"; exit 1; } +[ "$RPM_BUILD_ROOT" = $wanted ] || { echo "RPM_BUILD_ROOT should be $wanted instead of $RPM_BUILD_ROOT"; exit 1; } +[ "%macro_using_buildroot" = $wanted ] || { echo "macro_using_buildroot should be $wanted instead of %buildroot"; exit 1; } + +install -d $RPM_BUILD_ROOT + +%files -- cgit v1.2.1