Repackage source tarball to remove non-free DBI/FAQ.pm

This commit is contained in:
Jitka Plesnikova 2015-03-09 13:53:34 +01:00
parent 7ee3ecf55f
commit a664819767
4 changed files with 54 additions and 3 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ DBI-1.613.tar.gz
/DBI-1.631.tar.gz
/DBI-1.632.tar.gz
/DBI-1.633.tar.gz
/DBI-1.633_repackaged.tar.gz

View File

@ -10,12 +10,18 @@
Name: perl-DBI
Version: 1.633
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A database access API for perl
Group: Development/Libraries
License: GPL+ or Artistic
URL: http://dbi.perl.org/
Source0: http://www.cpan.org/authors/id/T/TI/TIMB/DBI-%{version}.tar.gz
# The source tarball must be repackaged to remove the DBI/FAQ.pm, since the
# license is not a FSF free license.
# When upgrading, download the new source tarball, and run
# "./strip-FAQ.sh <version>" to produce the "-repackaged" tarball.
# Source0: http://www.cpan.org/authors/id/T/TI/TIMB/DBI-%{version}.tar.gz
Source0: DBI-%{version}_repackaged.tar.gz
Source1: strip_FAQ.sh
BuildRequires: perl
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(File::Find)
@ -165,6 +171,9 @@ make test
%endif
%changelog
* Mon Mar 09 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.633-2
- Repackage source tarball to remove non-free DBI/FAQ.pm (bug #1199532)
* Tue Jan 13 2015 Jitka Plesnikova <jplesnik@redhat.com> - 1.633-1
- 1.633 bump

View File

@ -1 +1 @@
b4fe13b9a51c1446c5f3cf93e69a2044 DBI-1.633.tar.gz
edb8878df0f086d2759ce688a0359164 DBI-1.633_repackaged.tar.gz

41
strip_FAQ.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
version=$1
[ -z "$version" ] && { echo "Usage: $0 <version>"; exit 1; }
# files to be removed without the main DBI-<version>/ prefix
declare -a REMOVE
REMOVE[${#REMOVE[*]}]="lib/DBI/FAQ.pm"
orig="DBI-${version}"
orig_tgz="${orig}.tar.gz"
repackaged="${orig}_repackaged"
repackaged_tgz="${repackaged}.tar.gz"
# pre checks
[ ! -f "${orig_tgz}" ] && { echo "ERROR: ${orig_tgz} does not exist"; exit 1; }
[ -f "${repackaged_tgz}" ] && { echo "ERROR: ${repackaged_tgz} already exist"; exit 1; }
# repackage
tdir=`mktemp -d tmpXXXXXX`
pushd "${tdir}"
tar -xpzf ../${orig_tgz}
for file in "${REMOVE[@]}"; do
rm -rf "${orig}/${file}"
done
tar -cpzf ../"${repackaged_tgz}" "${orig}"
popd
rm -rf "${tdir}"
# post checks
RET=0
for file in "${REMOVE[@]}"; do
found=$(tar -ztvf "${repackaged_tgz}" | grep "${file}")
[ -n "$found" ] && { echo "ERROR: file ${file} is still in the repackaged archive."; RET=1; }
done
[ $RET == 0 ] && echo "Sucessfully repackaged ${orig}: ${repackaged_tgz}"
exit $RET