Compare commits

...

No commits in common. "c8s" and "c9-beta" have entirely different histories.
c8s ... c9-beta

13 changed files with 72 additions and 546 deletions

1
.gdbm.metadata Normal file
View File

@ -0,0 +1 @@
50ba1b1d45ce33fd44e4fdaaf3b55a9d8f3dc418 SOURCES/gdbm-1.23.tar.gz

6
.gitignore vendored
View File

@ -1,5 +1 @@
/gdbm-1.14.tar.gz SOURCES/gdbm-1.23.tar.gz
/gdbm-1.14.1.tar.gz
/gdbm-1.16.tar.gz
/gdbm-1.17.tar.gz
/gdbm-1.18.tar.gz

View File

@ -2,22 +2,23 @@
Summary: A GNU set of database routines which use extensible hashing Summary: A GNU set of database routines which use extensible hashing
Name: gdbm Name: gdbm
Version: 1.18 Version: 1.23
Release: 2%{?dist} Release: 1%{?dist}
Epoch: 1 Epoch: 1
License: GPLv3+ License: GPLv3+
URL: http://www.gnu.org/software/gdbm/ URL: http://www.gnu.org/software/gdbm/
Source: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz Source: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz
Patch1: gdbm-1.17-coverity-fixes.patch
# Backport of upstream commit: 00ba17479ff31c6825f0e6f28b965f11525e83f6
Patch2: gdbm-1.18-backward-compatibility.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: libtool BuildRequires: libtool
BuildRequires: gettext BuildRequires: gettext
BuildRequires: readline-devel BuildRequires: readline-devel
BuildRequires: make
# when -libs subpkg was introduced
Obsoletes: gdbm < 1:1.14.1-4
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
%description %description
@ -33,6 +34,8 @@ install gdbm-devel.
%package libs %package libs
Summary: Libraries files for gdbm Summary: Libraries files for gdbm
# when -libs subpkg was introduced
Obsoletes: gdbm < 1:1.14.1-4
%description libs %description libs
Libraries for the Gdbm GNU database indexing library Libraries for the Gdbm GNU database indexing library
@ -53,8 +56,6 @@ gdbm database library. You'll also need to install the gdbm package.
%prep %prep
%setup -q %setup -q
%patch1 -p1
%patch2 -p1
%build %build
%configure \ %configure \
@ -69,15 +70,15 @@ gdbm database library. You'll also need to install the gdbm package.
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make %{?_smp_mflags} %make_build
%install %install
make DESTDIR=$RPM_BUILD_ROOT install %make_install
%find_lang %{name} %find_lang %{name}
# create symlinks for compatibility # create symlinks for compatibility
mkdir -p $RPM_BUILD_ROOT/%{_includedir}/gdbm mkdir -p $RPM_BUILD_ROOT/%{_includedir}/gdbm
ln -sf ../gdbm.h $RPM_BUILD_ROOT/%{_includedir}/gdbm/gdbm.h ln -sf ../gdbm.h $RPM_BUILD_ROOT/%{_includedir}/gdbm/gdbm.h
ln -sf ../ndbm.h $RPM_BUILD_ROOT/%{_includedir}/gdbm/ndbm.h ln -sf ../ndbm.h $RPM_BUILD_ROOT/%{_includedir}/gdbm/ndbm.h
ln -sf ../dbm.h $RPM_BUILD_ROOT/%{_includedir}/gdbm/dbm.h ln -sf ../dbm.h $RPM_BUILD_ROOT/%{_includedir}/gdbm/dbm.h
@ -93,16 +94,6 @@ make check
%ldconfig_scriptlets libs %ldconfig_scriptlets libs
%post devel
/sbin/install-info %{_infodir}/gdbm.info.gz %{_infodir}/dir \
--entry="* gdbm: (gdbm). The GNU Database." || :
%preun devel
if [ $1 = 0 ]; then
/sbin/install-info --delete %{_infodir}/gdbm.info.gz %{_infodir}/dir \
--entry="* gdbm: (gdbm). The GNU Database." || :
fi
%files -f %{name}.lang %files -f %{name}.lang
%doc NEWS README THANKS AUTHORS NOTE-WARNING %doc NEWS README THANKS AUTHORS NOTE-WARNING
%{_bindir}/gdbm* %{_bindir}/gdbm*
@ -118,22 +109,73 @@ fi
%{_libdir}/libgdbm_compat.so %{_libdir}/libgdbm_compat.so
%{_includedir}/* %{_includedir}/*
%{_infodir}/*.info* %{_infodir}/*.info*
%{_mandir}/man3/* %{_mandir}/man3/*
%changelog %changelog
* Fri Jul 01 2022 <fjanus@redhat.com> - 1.18-2 * Wed Apr 03 2024 Filip Janus <fjanus@redhat.com> - 1:1.23-1
- Add backward compatibility patch - Update to 1.23
- Resolves: #2097704
- Backport from upstream commit: 00ba17479ff31c6825f0e6f28b965f11525e83f6
* Mon Sep 03 2018 mskalick@redhat.com - 1:1.18-1 * Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1:1.19-4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 1:1.19-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.19-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jan 5 2021 Filip Januš <fjanus@redhat.com> - 1.19-1
- Rebase to latest release 1.19
- Remove gdbm_gcc_10.patch no more necessary
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.18.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 1:1.18.1-4
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Fri Feb 7 2020 Filip Januš <fjanus@redhat.com> - 1.18.1-3
- Resolves: #1799391
- After upgrade GCC to version gcc version 10.0.1 build fails
- Patch gdbm_gcc_10.patch was added
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.18.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sun Oct 13 2019 Christian Stadelmann <genodeftest@fedoraproject.org>
- Remove outdated comments from spec file
* Mon Sep 23 2019 Filip Janus <fjanus@redhat.com> - 1.18.1-1
- Upstream released 1.18.1 bug(#1706639)
- Remove old patches
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.18-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1:1.18-4
- Rebuild for readline 8.0
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.18-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Oct 01 2018 Rex Dieter <rdieter@fedoraproject.org> - 1.18-2
- Add Obsoletes to better handle upgrade path from before -libs was introduced
* Tue Sep 25 2018 mskalick@redhat.com
- Rebase to latest release 1.18 - Rebase to latest release 1.18
- Fix issues found by coverity - Fix issues found by coverity
Resolves: RHBZ#1606956
* Tue Aug 21 2018 mskalick@redhat.com - 1:1.17-2
- Fix directory entry validation - fails qsf test suite
* Tue Aug 07 2018 mskalick@redhat.com - 1:1.17-1 * Tue Aug 07 2018 mskalick@redhat.com - 1:1.17-1
- Rebase to upstream release 1.17 - Rebase to upstream release 1.17
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.16-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jun 28 2018 mskalick@redhat.com - 1:1.16-1 * Thu Jun 28 2018 mskalick@redhat.com - 1:1.16-1
- Rebase to latest release 1.16 - Rebase to latest release 1.16

View File

@ -1,11 +0,0 @@
# awful hack to prevent running aclocal ... FIXME
(cd $SRC/gdbm-*/m4 && [ -f libtool.m4.orig ] && rm -f libtool.m4 && mv libtool.m4.orig libtool.m4) || echo ""
mcd $BUILDDIR/gdbm
echo "Current in: $PWD"
$SRC/gdbm-*/configure $TCONFIGARGS
make $J
make $J install

View File

@ -1,7 +0,0 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

View File

@ -1,14 +0,0 @@
diff -up gdbm-1.10/NOTE-WARNING.fedora gdbm-1.10/NOTE-WARNING
--- gdbm-1.10/NOTE-WARNING.fedora 2011-11-14 17:43:41.267566501 +0100
+++ gdbm-1.10/NOTE-WARNING 2011-11-14 17:47:53.312549265 +0100
@@ -12,8 +12,8 @@ systems where it is not the default. `L
when a system uses 64bit file offsets. Gdbm has, of course, supported `large
files' on systems where it was the default for a very long time.
-On some systems, such as Solaris, this functionality is not enabled by
-default. Gdbm will now enable it. THIS MEANS THAT GDBM 1.9 MAY NOT BE
+On some systems this functionality is not enabled by default. To enable it,
+build rpm with option --with=largefile. THIS MEANS THAT GDBM 1.9 MAY NOT BE
ABLE TO ACCESS DATABASES CREATED BY PREVIOUS VERIONS ON THE SAME SYSTEM.
Running the `configure' script with the `--disable-largefile' flag should

View File

@ -1,298 +0,0 @@
From 2ff4ae9c745d4b9e6ee36468c81554027f66c35b Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Fri, 31 Aug 2018 08:26:31 +0000
Subject: Various bugfixes.
* compat/dbmopen.c (ndbm_open_dir_file0): Ignore ENOENT.
* src/falloc.c (push_avail_block): Free temporary storage no matter
what return status.
* src/gdbm.h.in (GDBM_FILE_TRUNCATE_ERROR): New error code.
* src/gdbmdump.c (_gdbm_dump_ascii): Initialize rc.
* src/gdbmerrno.c: Handle new error.code
* src/gdbmload.c (gdbm_load_bdb_dump): Initialize rc
* src/gdbmopen.c (_gdbm_ftruncate): New function.
(gdbm_fd_open): Use _gdbm_ftruncate. Check its return.
* src/gdbmseq.c (gdbm_firstkey): Initialize dsize
* src/gdbmtool.c (command_generator): Check if cmd is NULL.
(shouldn't happen, but anyways).
* src/mmap.c (_gdbm_mapped_lseek): Check for vailidity of the 'whence'
parameter.
* src/systems.h (TRUNCATE): Remove macro.
* src/util.c (vgetyn): Remove unnecessary assignment.
---
diff --git a/compat/dbmopen.c b/compat/dbmopen.c
index b9e7518..0538992 100644
--- a/compat/dbmopen.c
+++ b/compat/dbmopen.c
@@ -87,7 +87,7 @@ ndbm_open_dir_file0 (const char *file_name, int pagfd, int mode)
if ((mode & GDBM_OPENMASK) == GDBM_READER)
/* Ok, try to cope with it. */
return pagfd;
- else
+ else if (errno != ENOENT)
{
gdbm_set_errno (NULL, GDBM_FILE_OPEN_ERROR, TRUE);
return -1;
diff --git a/src/falloc.c b/src/falloc.c
index 09b40d4..7a94afb 100644
--- a/src/falloc.c
+++ b/src/falloc.c
@@ -313,33 +313,43 @@ push_avail_block (GDBM_FILE dbf)
/* Update the header avail count to previous size divided by 2. */
dbf->header->avail.count >>= 1;
- /* Free the unneeded space. */
- new_loc.av_adr += av_size;
- new_loc.av_size -= av_size;
- _gdbm_free (dbf, new_loc.av_adr, new_loc.av_size);
-
- /* Update the disk. */
- file_pos = gdbm_file_seek (dbf, av_adr, SEEK_SET);
- if (file_pos != av_adr)
+ rc = 0;
+ do
{
- GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
- _gdbm_fatal (dbf, _("lseek error"));
- return -1;
- }
+ /* Free the unneeded space. */
+ new_loc.av_adr += av_size;
+ new_loc.av_size -= av_size;
+ if (_gdbm_free (dbf, new_loc.av_adr, new_loc.av_size))
+ {
+ rc = -1;
+ break;
+ }
+
+ /* Update the disk. */
+ file_pos = gdbm_file_seek (dbf, av_adr, SEEK_SET);
+ if (file_pos != av_adr)
+ {
+ GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
+ _gdbm_fatal (dbf, _("lseek error"));
+ rc = -1;
+ break;
+ }
- rc = _gdbm_full_write (dbf, temp, av_size);
- if (rc)
- {
- GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
- "%s: error writing avail data: %s",
- dbf->name, gdbm_db_strerror (dbf));
- _gdbm_fatal (dbf, gdbm_db_strerror (dbf));
- return -1;
+ rc = _gdbm_full_write (dbf, temp, av_size);
+ if (rc)
+ {
+ GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
+ "%s: error writing avail data: %s",
+ dbf->name, gdbm_db_strerror (dbf));
+ _gdbm_fatal (dbf, gdbm_db_strerror (dbf));
+ rc = -1;
+ }
}
-
+ while (0);
+
free (temp);
- return 0;
+ return rc;
}
/* AV_TABLE contains COUNT entries sorted by AV_SIZE in ascending order.
diff --git a/src/gdbm.h.in b/src/gdbm.h.in
index 6318ad8..f5eadc5 100644
--- a/src/gdbm.h.in
+++ b/src/gdbm.h.in
@@ -227,9 +227,10 @@ extern int gdbm_copy_meta (GDBM_FILE dst, GDBM_FILE src);
# define GDBM_BAD_DIR_ENTRY 36
# define GDBM_FILE_CLOSE_ERROR 37
# define GDBM_FILE_SYNC_ERROR 38
+# define GDBM_FILE_TRUNCATE_ERROR 39
# define _GDBM_MIN_ERRNO 0
-# define _GDBM_MAX_ERRNO GDBM_FILE_SYNC_ERROR
+# define _GDBM_MAX_ERRNO GDBM_FILE_TRUNCATE_ERROR
/* This one was never used and will be removed in the future */
# define GDBM_UNKNOWN_UPDATE GDBM_UNKNOWN_ERROR
diff --git a/src/gdbmdump.c b/src/gdbmdump.c
index 2e6f5b0..a8c4ec5 100644
--- a/src/gdbmdump.c
+++ b/src/gdbmdump.c
@@ -62,7 +62,7 @@ _gdbm_dump_ascii (GDBM_FILE dbf, FILE *fp)
size_t count = 0;
unsigned char *buffer = NULL;
size_t bufsize = 0;
- int rc;
+ int rc = 0;
fd = gdbm_fdesc (dbf);
if (fstat (fd, &st))
diff --git a/src/gdbmerrno.c b/src/gdbmerrno.c
index 4ce7f9d..6758272 100644
--- a/src/gdbmerrno.c
+++ b/src/gdbmerrno.c
@@ -138,7 +138,8 @@ const char * const gdbm_errlist[_GDBM_MAX_ERRNO+1] = {
[GDBM_BAD_HASH_TABLE] = N_("Malformed hash table"),
[GDBM_BAD_DIR_ENTRY] = N_("Invalid directory entry"),
[GDBM_FILE_CLOSE_ERROR] = N_("Error closing file"),
- [GDBM_FILE_SYNC_ERROR] = N_("Error synchronizing file")
+ [GDBM_FILE_SYNC_ERROR] = N_("Error synchronizing file"),
+ [GDBM_FILE_TRUNCATE_ERROR] = N_("Error truncating file")
};
const char *
@@ -182,7 +183,8 @@ int const gdbm_syserr[_GDBM_MAX_ERRNO+1] = {
[GDBM_FILE_STAT_ERROR] = 1,
[GDBM_BACKUP_FAILED] = 1,
[GDBM_FILE_CLOSE_ERROR] = 1,
- [GDBM_FILE_SYNC_ERROR] = 1
+ [GDBM_FILE_SYNC_ERROR] = 1,
+ [GDBM_FILE_TRUNCATE_ERROR] = 1
};
/* Returns true if system errno value is meaningful for GDBM error
diff --git a/src/gdbmload.c b/src/gdbmload.c
index 008bcb9..f5b7869 100644
--- a/src/gdbmload.c
+++ b/src/gdbmload.c
@@ -542,6 +542,7 @@ gdbm_load_bdb_dump (struct dump_file *file, GDBM_FILE dbf, int replace)
memset (&xd, 0, sizeof (xd));
xs[0] = xs[1] = 0;
i = 0;
+ rc = 0;
while ((c = fgetc (file->fp)) == ' ')
{
rc = xdatum_read (file->fp, &xd[i], &xs[i]);
diff --git a/src/gdbmopen.c b/src/gdbmopen.c
index 908887c..7ec57e7 100644
--- a/src/gdbmopen.c
+++ b/src/gdbmopen.c
@@ -199,6 +199,21 @@ validate_header (gdbm_file_header const *hdr, struct stat const *st)
return 0;
}
+/* Do we have ftruncate? */
+static inline int
+_gdbm_ftruncate (GDBM_FILE dbf)
+{
+#if HAVE_FTRUNCATE
+ return ftruncate (dbf->desc, 0);
+#else
+ int fd;
+ fd = open (dbf->name, O_RDWR|O_TRUNC, mode);
+ if (fd == -1)
+ return -1;
+ return close (fd);
+#endif
+}
+
GDBM_FILE
gdbm_fd_open (int fd, const char *file_name, int block_size,
int flags, void (*fatal_func) (const char *))
@@ -320,14 +335,22 @@ gdbm_fd_open (int fd, const char *file_name, int block_size,
now time to truncate the file. */
if ((flags & GDBM_OPENMASK) == GDBM_NEWDB && file_stat.st_size != 0)
{
- TRUNCATE (dbf);
- if (fstat (dbf->desc, &file_stat))
+ if (_gdbm_ftruncate (dbf))
+ {
+ GDBM_SET_ERRNO2 (dbf, GDBM_FILE_TRUNCATE_ERROR, FALSE,
+ GDBM_DEBUG_OPEN);
+ }
+ else if (fstat (dbf->desc, &file_stat))
+ {
+ GDBM_SET_ERRNO2 (dbf, GDBM_FILE_STAT_ERROR, FALSE, GDBM_DEBUG_OPEN);
+ }
+
+ if (gdbm_last_errno (dbf))
{
if (flags & GDBM_CLOERROR)
close (dbf->desc);
free (dbf->name);
free (dbf);
- GDBM_SET_ERRNO2 (NULL, GDBM_FILE_STAT_ERROR, FALSE, GDBM_DEBUG_OPEN);
return NULL;
}
}
diff --git a/src/gdbmseq.c b/src/gdbmseq.c
index e74d78d..ee7ebf3 100644
--- a/src/gdbmseq.c
+++ b/src/gdbmseq.c
@@ -101,6 +101,7 @@ gdbm_firstkey (GDBM_FILE dbf)
/* Set the default return value for not finding a first entry. */
return_val.dptr = NULL;
+ return_val.dsize = 0;
GDBM_DEBUG (GDBM_DEBUG_READ, "%s: getting first key", dbf->name);
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index 454465e..8c97e1e 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -1435,7 +1435,7 @@ command_generator (const char *text, int state)
len = strlen (text);
}
- if (!cmd->name)
+ if (!cmd || !cmd->name)
return NULL;
/* Return the next name which partially matches from the command list. */
diff --git a/src/mmap.c b/src/mmap.c
index 48e84ae..148b852 100644
--- a/src/mmap.c
+++ b/src/mmap.c
@@ -367,6 +367,10 @@ _gdbm_mapped_lseek (GDBM_FILE dbf, off_t offset, int whence)
needle = file_size - offset;
break;
}
+
+ default:
+ errno = EINVAL;
+ return -1;
}
if (needle < 0)
diff --git a/src/systems.h b/src/systems.h
index 750aa51..f269060 100644
--- a/src/systems.h
+++ b/src/systems.h
@@ -52,13 +52,6 @@
# define STATBLKSIZE(st) 1024
#endif
-/* Do we have ftruncate? */
-#if HAVE_FTRUNCATE
-# define TRUNCATE(dbf) ftruncate (dbf->desc, 0)
-#else
-# define TRUNCATE(dbf) close( open (dbf->name, O_RDWR|O_TRUNC, mode));
-#endif
-
#ifndef STDERR_FILENO
# define STDERR_FILENO 2
#endif
diff --git a/src/util.c b/src/util.c
index f254202..3493366 100644
--- a/src/util.c
+++ b/src/util.c
@@ -98,8 +98,9 @@ vgetyn (const char *prompt, va_list ap)
default:
fprintf (stdout, "%s\n", _("Please, reply 'y' or 'n'"));
}
- state = 0;
- } else
+ /* fall through */
+ }
+ else
break;
case 0:
--
cgit v0.9.0.3

View File

@ -1,24 +0,0 @@
Upstream backport: 00ba17479ff31c6825f0e6f28b965f11525e83f6
Fix problem with loading old format of databases exports
diff -ur gdbm-1.18/src/gdbmopen.c gdbm-patch/src/gdbmopen.c
--- gdbm-1.18/src/gdbmopen.c 2018-08-03 10:46:39.000000000 +0200
+++ gdbm-patch/src/gdbmopen.c 2022-07-01 08:56:08.000000000 +0200
@@ -168,9 +168,14 @@
return GDBM_BLOCK_SIZE_ERROR;
}
- if (hdr->next_block != st->st_size)
- /* FIXME: Should return GDBM_NEED_RECOVERY instead? */
- return GDBM_BAD_HEADER;
+ /* Technically speaking, the condition below should read
+ hdr->next_block != st->st_size
+ However, gdbm versions prior to commit 4e819c98 could leave
+ hdr->next_block pointing beyond current end of file. To ensure
+ backward compatibility with these versions, the condition has been
+ slackened to this: */
+ if (hdr->next_block < st->st_size)
+ return GDBM_BAD_HEADER;
/* Make sure dir and dir + dir_size fall within the file boundary */
if (!(hdr->dir > 0

View File

@ -1 +0,0 @@
SHA512 (gdbm-1.18.tar.gz) = 57c7e5dc52464e97ad955e28d49fdb3557d8e3bdf280f7d3cee69539e4878f055db17cb9dd591f82fadb8fa5041a5a56d8a571d34f6e115470a3a82537f872a8

View File

@ -1,18 +0,0 @@
---
# Tests that run in classic and container contexts
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
- container
tests:
- testsuite
required_packages:
- gcc # testsuite needs this package
- gettext # testsuite needs this package
- libtool # testsuite needs this package
- make # testsuite needs this package
- readline-devel # testsuite needs this package
- rpm-build # testsuite needs this package
- wget # rlFetchSrcForInstalled needs this package

View File

@ -1,63 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of testsuite
# Description: runs test suite from src package
# Author: Vaclav Danek <vdanek@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2017 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU 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/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=testsuite
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Vaclav Danek <vdanek@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: runs test suite from src package" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: gdbm" >> $(METADATA)
@echo "Requires: gdbm libtool readline-devel" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -1,3 +0,0 @@
PURPOSE of testsuite
Description: runs test suite from src package
Author: Vaclav Danek <vdanek@redhat.com>

View File

@ -1,74 +0,0 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of testsuite
# Description: runs test suite from src package
# Author: Vaclav Danek <vdanek@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2017 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU 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/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
[ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="gdbm"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
# fetch srpm
rlRun "rlFetchSrcForInstalled $PACKAGE || yumdownloader --enablerepo='*' --source $PACKAGE" \
0 "Fetching the source rpm"
package=`rpm -q --qf "%{SOURCERPM}" $PACKAGE`
installlog=`mktemp /tmp/install.log.XXXXXX`
rlLog "Using $installlog as installation log"
rlRun "rpm -ivh $TmpDir/$package &> $installlog"
BUILDDIR="$HOME/rpmbuild/BUILD"
SPECDIR="$HOME/rpmbuild/SPECS"
rlPhaseEnd
rlPhaseStartTest
rlRun "cd /root/rpmbuild"
rlRun "rpmbuild -bp $SPECDIR/$PACKAGE.spec"
rlRun "cd $BUILDDIR"
rlRun "cd gdbm-*"
if rlGetPrimaryArch == 'ppc64le'; then
rlRun "./configure --disable-static --enable-libgdbm-compat --build=ppc64le-redhat-linux-gnu --host=ppc64le-redhat-linux-gnu"
else
rlRun "./configure --disable-static --enable-libgdbm-compat"
fi
rlRun "make check"
rlRun "ls | grep -v tests | xargs rm -rf"
rlRun "cd tests"
rlRun "rm -f testsuite.log"
rlRun "./testsuite"
rlAssertGrep "All .* tests were successful." testsuite.log
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlRun "rm -rf /root/rpmbuild"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd