Skip to content

Instantly share code, notes, and snippets.

@s1037989
Created May 28, 2025 00:48
Show Gist options
  • Save s1037989/ac450aafd6e2090bf56309d239712937 to your computer and use it in GitHub Desktop.
Save s1037989/ac450aafd6e2090bf56309d239712937 to your computer and use it in GitHub Desktop.
Create big RPM from added RPMs and unpacked tarballs
Capture state after a fresh install
# rpm -qa --qf "%{name} == %{version}\n" > /root/1.rpm-qa.txt ; rpm -qal > /root/1.rpm-qal.txt ; find / \( -path /proc -prune -o -path /sys -o -path /dev -o -path /boot -o -path /run -o -path /tmp \) -prune -o ! -type d > /root/1.files.txt ; find / \( -path /proc -prune -o -path /sys -o -path /dev -o -path /boot -o -path /run -o -path /tmp \) -prune -o -type d > /root/1.dirs.txt
# wc -l 1.*
5104 1.dirs.txt
30962 1.files.txt
52912 1.rpm-qal.txt
404 1.rpm-qa.txt
Add rpms and unpack tarballs
# yum update -q -y && yum upgrade -q -y ; yum install -q -y firefox postgresql grafana wget rpm-build rpmdevtools; wget -q https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.15.tar.xz -O /tmp/linux-6.15.tar.xz && tar xf /tmp/linux-6.15.tar.xz -C /opt
# find /opt/linux-6.15/ | wc -l
94738
Capture state after adding rpms and unpacking tarballs
# rpm -qa --qf "%{name} == %{version}\n" > /root/2.rpm-qa.txt ; rpm -qal > /root/2.rpm-qal.txt ; find / \( -path /proc -prune -o -path /sys -o -path /dev -o -path /boot -o -path /run -o -path /tmp \) -prune -o ! -type d > /root/2.files.txt ; find / \( -path /proc -prune -o -path /sys -o -path /dev -o -path /boot -o -path /run -o -path /tmp \) -prune -o -type d > /root/2.dirs.txt
# wc -l 2.*
13724 2.dirs.txt
142434 2.files.txt
78910 2.rpm-qal.txt
654 2.rpm-qa.txt
Create a spec files from the added rpms and unpacked tarballs
# for i in dirs files rpm-qal rpm-qa; do uniq -u <(cat [12].$i.txt | sort) > /root/3.$i.diff && echo /root/3.$i.diff ; done
/root/3.dirs.diff
/root/3.files.diff
/root/3.rpm-qal.diff
/root/3.rpm-qa.diff
# wc -l 3.*
8622 3.dirs.diff
111556 3.files.diff
266 3.rpm-qa.diff
25311 3.rpm-qal.diff
# { echo -en "Name: big\nVersion: 1.0\nRelease: 1\nSummary: Big package\nLicense: GPL\n" ; sed 's/^/Requires: /' 3.rpm-qa.diff ; echo -en "\n%description\nBig package description\n\n%files\n" ; uniq -u <(cat 3.{files,dirs,rpm-qal}.diff | sort); } > big.spec
# sed -n '/^Requires: /p' big.spec | wc -l
266
# sed -n '/^%files/,$p' big.spec | wc -l
94888
Name: big
Version: 1.0
Release: 1
Summary: Big package
License: GPL
Requires: adwaita-cursor-theme == 40.1.1
Requires: adwaita-icon-theme == 40.1.1
:
Requires: zip == 3.0
Requires: zstd == 1.5.5
%description
Big package description
%files
/etc/alsa
/etc/alsa/conf.d
:
/opt/linux-6.15
/opt/linux-6.15/arch
/opt/linux-6.15/arch/alpha
:
/opt/linux-6.15/virt/lib/Kconfig
/opt/linux-6.15/virt/lib/Makefile
/opt/linux-6.15/virt/Makefile
:
/var/lib/sss/db/config.ldb
/var/lib/upower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment