Feb 192016
I was receiving this error when trying to build an RPM containing a very large number of files. The files contained USPS zip code data for the entire United States. When building the RPM, I would receive the following error:
error: Unable to create immutable header region
I tried searching for a solution and came across this bug: http://rpm.org/ticket/862. So, basically, this is an arbitrary limit imposed by RPM which doesn’t appear to have a clean workaround.
My method for bypassing the limit was to use the suggestion at https://bugzilla.redhat.com/show_bug.cgi?id=913099#c8. I built an RPM which split the zip code data by the first digit. The resulting spec file looks something like this.
Name: usps-zipdata
Version: 0.1
Release: 1%{?dist}
Summary: USPS zip code data
License: custom license
URL: https://example.com/uspsdata
Source0: %{name}-%{version}.tar.bz2
BuildArch: noarch
BuildRequires: coreutils, bzip2
Requires: usps-zipdata-0 = %{version}-%{release}
Requires: usps-zipdata-1 = %{version}-%{release}
Requires: usps-zipdata-2 = %{version}-%{release}
Requires: usps-zipdata-3 = %{version}-%{release}
Requires: usps-zipdata-4 = %{version}-%{release}
Requires: usps-zipdata-5 = %{version}-%{release}
Requires: usps-zipdata-6 = %{version}-%{release}
Requires: usps-zipdata-7 = %{version}-%{release}
Requires: usps-zipdata-8 = %{version}-%{release}
Requires: usps-zipdata-9 = %{version}-%{release}
%description
Static USPS zip code data.
%package 0
Summary: USPS zip code data 0*
%description 0
Static USPS zip code data for zip codes starting with the number zero.
%package 1
Summary: USPS zip code data 1*
%description 1
Static USPS zip code data for zip codes starting with the number one.
%package 2
Summary: USPS zip code data 2*
%description 2
Static USPS zip code data for zip codes starting with the number two.
%package 3
Summary: USPS zip code data 3*
%description 3
Static USPS zip code data for zip codes starting with the number three.
%package 4
Summary: USPS zip code data 4*
%description 4
Static USPS zip code data for zip codes starting with the number four.
%package 5
Summary: USPS zip code data 5*
%description 5
Static USPS zip code data for zip codes starting with the number five.
%package 6
Summary: USPS zip code data 6*
%description 6
Static USPS zip code data for zip codes starting with the number six.
%package 7
Summary: USPS zip code data 7*
%description 7
Static USPS zip code data for zip codes starting with the number seven.
%package 8
Summary: USPS zip code data 8*
%description 8
Static USPS zip code data for zip codes starting with the number eight.
%package 9
Summary: USPS zip code data 9*
%description 9
Static USPS zip code data for zip codes starting with the number nine.
%prep
%setup -q
%build
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/var/usps
tar xvf zip.tar.bz2
mv zip $RPM_BUILD_ROOT/var/usps/
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%dir /var/usps/zip
%dir /var/usps/zip/MSS
/var/usps/zip/MSS/[a-z]*
%files 0
/var/usps/zip/MSS/0*
%files 1
/var/usps/zip/MSS/1*
%files 2
/var/usps/zip/MSS/2*
%files 3
/var/usps/zip/MSS/3*
%files 4
/var/usps/zip/MSS/4*
%files 5
/var/usps/zip/MSS/5*
%files 6
/var/usps/zip/MSS/6*
%files 7
/var/usps/zip/MSS/7*
%files 8
/var/usps/zip/MSS/8*
%files 9
/var/usps/zip/MSS/9*
%changelog
* Thu Feb 18 2016 Sol Jerome - 0.1-1
- create new RPM for USPS zip code data