# OS Package Binary Collection — Per-Distro Reference
AI Summary
Purpose:
- Concise reference of the OS-package binary-collection crawlers (Ubuntu, Debian, CentOS, OpenWrt) and the package-repo-URL extraction project: repository structure, package format, extraction method, and what is stored.
Key points:
- Ubuntu/Debian: APT
pool/archives,.deb(Debian also.udeb);.debis anararchive ofcontrol.tar.*+data.tar.*; extract withar+ tar/xz/zstd/gzip. - CentOS: Vault (EOL snapshots, no security updates);
.rpm; extract withrpm2cpio | cpio -idm; CentOS 6–7 useos/{arch}/Packages/, CentOS 8+ split intoBaseOS/+AppStream/. - OpenWrt:
.ipk(ar archive like.deb, sometimes gzip tar); reuses the Debian/Ubuntu extraction logic; huge scale (~17.6M packages, ~1.7–3.5TB est.). - All crawlers: HTML index parsing, DFS recursion, resumable via
_state.json, binary-file filtering (ELF/.so/exec/shebang), hashes + metadata into MySQL, Docker-packaged. - Repo-URL project: extract package name + Git repo URL — APT via
Vcs-Git(sources.gz) thenHomepage(packages.gz); OpenWrt viaPKG_SOURCE_URLin feed Makefiles.
Relevant when:
- Working on OS-package crawlers, binary-hash collection, or repo-URL extraction; needing per-distro structural differences.
Do not read full document unless:
- You need the exact directory layout, extraction commands, or repo-URL extraction strategy for one distro.
Linked documents:
- [[../../wiki/people/career-timeline.md]]
- [[../index.md]]
Open Questions
- OpenWrt collection was implemented but real end-to-end collection test was still pending in the source notes (marked incomplete there).
- Scale figures for OpenWrt (~17.6M packages, ~1.7–3.5TB) are author estimates from late 2024.
Details
Source: author's archive notes (Obsidian vault, 600. Archives/01. OS PKG Binary 수집): Ubuntu, Debian, CentOS, OpenWrt, and the PKG_REPO_URL project. Status in source: all "완료/complete" except OpenWrt's real-collection test.
Common design across all crawlers
- Discovery: parse Apache-style HTML directory index; DFS recursive traversal.
- Resumable: state persisted in
_state.jsonto allow restart. - Binary filtering (to avoid hashing everything): ELF binaries,
.solibraries, files underusr/bin,usr/sbin,bin,sbin, files with exec permission, script extensions (.sh,.py,.bash,.pl,.rb, ...), and files starting with a shebang (#!). - Output: file hashes + package metadata + license info into MySQL; packaged with Docker / docker-compose.
Ubuntu (.deb)
- Source:
http://archive.ubuntu.com/ubuntu/pool/main/(alsorestricted,universe,multiverse). - Layout: by source-package name, split by first letter or
lib*prefix (e.g.a/abc/,libz/libzzip-0-13/). Filename:{name}_{version}_{arch}.deb. - Extraction:
.debis anararchive →ar x→control.tar.*(metadata) +data.tar.*(files); unified extractor handles tar/xz/zstd/gzip.
Debian (.deb, .udeb)
- Source:
https://deb.debian.org/debian/pool/main/(alsonon-free,contrib). - Layout: same pool structure as Ubuntu. Filename:
{name}_{version}_{arch}.debor.udeb. .udeb: Debian-installer binary packages (Ubuntu mostly uses.deb).- Extraction: identical to Ubuntu (
ar→ control/data tar).
CentOS (.rpm)
- Source:
https://vault.centos.org/— archived snapshots of EOL versions; no security updates. - Layout: CentOS 6–7 use
centos/{version}/os/{arch}/Packages/(traditional); CentOS 8+ split intocentos/{version}/BaseOS/{arch}/Packages/+AppStream/{arch}/Packages/. CentOS 7 alone has 10,000+ RPMs. - Extraction:
rpm2cpio {file} | cpio -idmto expand the filesystem; metadata viarpm -qp. - Extra: multi-source-URL support with filename-based dedup across mirrors.
OpenWrt (.ipk)
- Source:
https://downloads.openwrt.org/releases/; pathreleases/{version}/packages/{arch}/{category}/. Categories: packages, base, luci, routing, telephony. - Format:
.ipkis usually anararchive like.deb(debian-binary+control.tar.gz+data.tar.gz); some are gzip-compressed tar — crawler tries both. Extraction logic reused from the Debian/Ubuntuextract_and_hash.py. - Scale (author estimate, Nov 2024): 56 versions (17.01.7 → 24.10.4), ~35–36 architectures per version, 5 categories per arch → ~17.6M packages, ~1.7–3.5TB.
- Discovery: auto-discover version → arch → category; supports selective collection; filename-based dedup.
Package-repo-URL extraction project (PKG_REPO_URL)
- Goal: extract
package_name+ Gitrepo_urlfor Ubuntu, Debian, OpenWrt into one DB. - APT (Ubuntu/Debian): use
Packages.gz(binary index, hasHomepage) +Sources.gz(source index, hasVcs-Git). Priority:Vcs-Gitfirst; else crawlHomepageHTML for a Git repo link (GitHub/GitLab/SourceForge patterns), with caching and request delay (0.3–0.5s). Debian additionally does dynamic architecture discovery (Ubuntu fixed to amd64/i386). Components differ: Ubuntumain/multiverse/restricted/universe; Debianmain/contrib/non-free-firmware/non-free. - OpenWrt: no
Packages.gz/Sources.gzindex and.ipkcontrol files lackHomepage/Vcs-Git; instead clone the GitHub feeds (packages, luci, routing, telephony) and extractPKG_SOURCE_URLfrom each Makefile, then normalize (strip$(VAR)variables,codeload.github.com→github.com, dropreleases/download/archivepaths,git:///git@→https://, validate repo pattern).