
前回記事 RPM データベース(DB)の整理(クリンーナップ)を行いたい
展開したファイルをコンパイル (configure, make) 出来ないで configure 実行時、回避方法を紹介しましたが、私でもどんなエラーか分からない時があります。例えば、opensslv.h が無いと言われたら、opensslv.h とはどんなヘッダーファイルだろう??と思い、opensslv.h を検索キーに google で検索する事もあります。
checking for OpenSSL version... checking openssl/opensslv.h usability... no checking openssl/opensslv.h presence... no checking for openssl/opensslv.h... no checking openssl/ssl.h usability... no checking openssl/ssl.h presence... no checking for openssl/ssl.h... no
# yum search opensslv.h
と実行し
openssl-devel
と表示されてくれれば嬉しいのですが、そこまで yum は賢く無いのです。
yum makecache, yum update とすると yum は、ftp の yum レポジトリよりデータをダウンロードしローカルの /var/cache/yum/ にデータを保存します。
# yum makecache 読み込んだプラグイン:fastestmirror, langpacks base | 3.6 kB 00:00:00 epel/x86_64/metalink | 8.5 kB 00:00:00 extras | 3.4 kB 00:00:00 google-chrome | 951 B 00:00:00 nux-dextop | 2.9 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/5): extras/7/x86_64/other_db | 96 kB 00:00:00 (2/5): updates/7/x86_64/other_db | 492 kB 00:00:00 (3/5): epel/x86_64/other_db | 2.9 MB 00:00:00 (4/5): base/7/x86_64/other_db | 2.5 MB 00:00:00 (5/5): nux-dextop/x86_64/other_db | 771 kB 00:00:05 google-chrome/other | 487 B 00:00:00 Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * epel: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * nux-dextop: li.nux.ro * updates: ftp.iij.ad.jp google-chrome 3/3 google-chrome 3/3 メタデータのキャッシュを作成しました
パッケージに関する実際のデータは、 拡張子 .sqlite という sqlite という DBMS に保存されています。少し難しいですが sql 文を駆使し、パッケージの依存関係を手動で調べてみましょう。
sqlite は、 アプリケーションに組み込んで利用される軽量のデータベースです。
yum のキャッシュデータを見ると、拡張子が .sqlite.bz2 となっているファイルがあります。これがパッケージの依存情報が書かれているファイルです。
# cd /var/cache/yum # find # find . ./x86_64 ./x86_64/7 ./x86_64/7/base ./x86_64/7/base/gen ./x86_64/7/base/gen/primary_db.sqlite ./x86_64/7/base/gen/filelists_db.sqlite ./x86_64/7/base/gen/other_db.sqlite ./x86_64/7/base/packages ./x86_64/7/base/mirrorlist.txt ./x86_64/7/base/repomd.xml ./x86_64/7/base/cachecookie ./x86_64/7/base/9346184be1deb727caf4b1ecf4a7949155da5da74af9b92c172687b290a773df-c7-x86_64-comps.xml.gz ./x86_64/7/base/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2 ./x86_64/7/base/6cd606547d4f569538d4090e9accdc3c69964de1116b9ab1e0a7864bb1f3ec98-filelists.sqlite.bz2 ./x86_64/7/base/cf0cc856d46b3095106da78256fb28f9d8defea4118d0e75eab07dc53b7d3f0d-other.sqlite.bz2 : : bz2 ファイルは、bzip2 コマンドで展開するので無い場合はインストールします。 # yum install bzip2
# bzip2 -d ./x86_64/7/base/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2 [root@dhcp-146 yum]# sqlite3 ./x86_64/7/base/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite SQLite version 3.7.17 2013-05-20 00:56:22 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .tables <- テーブルの一覧を取得 conflicts db_info files obsoletes packages provides requires <- 7つのテーブルが存在する事が分かる。 sqlite> PRAGMA table_info(packages); <- packages テーブルのカラム名を取得 0|pkgKey|INTEGER|0||1 1|pkgId|TEXT|0||0 2|name|TEXT|0||0 3|arch|TEXT|0||0 4|version|TEXT|0||0 5|epoch|TEXT|0||0 6|release|TEXT|0||0 7|summary|TEXT|0||0 8|description|TEXT|0||0 9|url|TEXT|0||0 10|time_file|INTEGER|0||0 11|time_build|INTEGER|0||0 12|rpm_license|TEXT|0||0 13|rpm_vendor|TEXT|0||0 14|rpm_group|TEXT|0||0 15|rpm_buildhost|TEXT|0||0 16|rpm_sourcerpm|TEXT|0||0 17|rpm_header_start|INTEGER|0||0 18|rpm_header_end|INTEGER|0||0 19|rpm_packager|TEXT|0||0 20|size_package|INTEGER|0||0 21|size_installed|INTEGER|0||0 22|size_archive|INTEGER|0||0 23|location_href|TEXT|0||0 24|location_base|TEXT|0||0 25|checksum_type|TEXT|0||0
# sqlite3 ./updates/608649851ff504503112d7431712de3b297fd3a0141038d6718131b729e28866-filelists.sqlite SQLite version 3.6.12 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .tables <- テーブルの一覧を取得 db_info filelist packages <- 3つのテーブルが存在する事が分かる。 sqlite> PRAGMA table_info(filelist); <- filelist テーブルのカラム名を取得 0|pkgKey|INTEGER|0||0 1|dirname|TEXT|0||0 2|filenames|TEXT|0||0 3|filetypes|TEXT|0||0 sqlite> select * from filelist where filenames like '%opensslv.h%'; <- filenames に opensslv.h がある列を検索し、pkgKey が 1831 のパッケージに opensslv.h が存在する事が分かった。 1831|/usr/include/openssl|x509v3.h/x509_vfy.h/x509.h/ui_compat.h/ui.h/txt_db.h/tmdiff.h/tls1.h/symhacks.h/store.h/stack.h/ssl3.h/ssl23.h/ssl2.h/ssl.h/sha.h/seed.h/safestack.h/rsa.h/ripemd.h/rc4.h/rc2.h/rand.h/pqueue.h/pq_compat.h/pkcs7.h/pkcs12.h/pem2.h/pem.h/ossl_typ.h/opensslv.h/opensslconf.h/opensslconf-i386.h/ocsp.h/objects.h/obj_mac.h/md5.h/md4.h/md2.h/lhash.h/kssl.h/krb5_asn.h/hmac.h/fips_rand.h/fips.h/evp.h/err.h/engine.h/ebcdic.h/e_os2.h/dtls1.h/dso.h/dsa.h/dh.h/des_old.h/des.h/crypto.h/conf_api.h/conf.h/comp.h/cms.h/cast.h/camellia.h/buffer.h/bn.h/blowfish.h/bio.h/asn1t.h/asn1_mac.h/asn1.h/aes.h|fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 2161|/usr/i686-pc-mingw32/sys-root/mingw/include/openssl|x509v3.h/x509_vfy.h/x509.h/ui_compat.h/ui.h/txt_db.h/tmdiff.h/tls1.h/symhacks.h/store.h/stack.h/ssl3.h/ssl23.h/ssl2.h/ssl.h/sha.h/seed.h/safestack.h/rsa.h/ripemd.h/rc4.h/rc2.h/rand.h/pqueue.h/pq_compat.h/pkcs7.h/pkcs12.h/pem2.h/pem.h/ossl_typ.h/opensslv.h/opensslconf.h/ocsp.h/objects.h/obj_mac.h/md5.h/md4.h/md2.h/lhash.h/kssl.h/krb5_asn.h/hmac.h/fips_rand.h/fips.h/evp.h/err.h/engine.h/ebcdic.h/e_os2.h/dtls1.h/dso.h/dsa.h/dh.h/des_old.h/des.h/crypto.h/conf_api.h/conf.h/comp.h/cast.h/camellia.h/buffer.h/bn.h/blowfish.h/bio.h/asn1t.h/asn1_mac.h/asn1.h/applink.c/aes.h|ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff sqlite> .quit # sqlite3 ./updates/b6be24399005f44b1a1c50a96f835507532e95f7973f5a827ab942dae38b8036-primary.sqlite SQLite version 3.6.12 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .tables <- テーブルの一覧を取得 conflicts db_info files obsoletes packages provides requires <- 7つのテーブルが存在する事が分かる。 sqlite> PRAGMA table_info(packages); <- packages テーブルのカラム名を取得 0|pkgKey|INTEGER|0||1 1|pkgId|TEXT|0||0 2|name|TEXT|0||0 3|arch|TEXT|0||0 4|version|TEXT|0||0 5|epoch|TEXT|0||0 6|release|TEXT|0||0 7|summary|TEXT|0||0 8|description|TEXT|0||0 9|url|TEXT|0||0 10|time_file|INTEGER|0||0 11|time_build|INTEGER|0||0 12|rpm_license|TEXT|0||0 13|rpm_vendor|TEXT|0||0 14|rpm_group|TEXT|0||0 15|rpm_buildhost|TEXT|0||0 16|rpm_sourcerpm|TEXT|0||0 17|rpm_header_start|INTEGER|0||0 18|rpm_header_end|INTEGER|0||0 19|rpm_packager|TEXT|0||0 20|size_package|INTEGER|0||0 21|size_installed|INTEGER|0||0 22|size_archive|INTEGER|0||0 23|location_href|TEXT|0||0 24|location_base|TEXT|0||0 25|checksum_type|TEXT|0||0 sqlite> select * from packages limit 3; 1|64f07184d6a38cb907681950372180e7a6ecb8c6cb4b0fc3963c6f60031e37f7|389-ds-base|x86_64|1.3.6.1|0|16.el7|389 Directory Server (base)|389 Directory Server is an LDAPv3 compliant server. The base package includes the LDAP server and command line utilities for server administration.|https://www.port389.org/|1502376452|1501859238|GPLv3+|CentOS|System Environment/Daemons|c1bm.rdu2.centos.org|389-ds-base-1.3.6.1-16.el7.src.rpm|1384|206460|CentOS BuildSystem <http://bugs.centos.org>|1783596|5480006|5538336|Packages/389-ds-base-1.3.6.1-16.el7.x86_64.rpm||sha256 2|f7c8bfd2e805d0a04f0c80b2009d321714c3dc665271d9fd2bae4746bc86c433|389-ds-base-devel|x86_64|1.3.6.1|0|16.el7|Development libraries for 389 Directory Server|Development Libraries and headers for the 389 Directory Server base package.|https://www.port389.org/|1502376460|1501859238|GPLv3+|CentOS|Development/Libraries|c1bm.rdu2.centos.org|389-ds-base-1.3.6.1-16.el7.src.rpm|1384|137248|CentOS BuildSystem <http://bugs.centos.org>|261296|484541|490080|Packages/389-ds-base-devel-1.3.6.1-16.el7.x86_64.rpm||sha256 3|2c13f5b52ddd5a08745256340771bea688504206db1853e823f9598a17b9da9b|389-ds-base-libs|x86_64|1.3.6.1|0|16.el7|Core libraries for 389 Directory Server|Core libraries for the 389 Directory Server base package. These libraries are used by the main package and the -devel package. This allows the -devel package to be installed with just the -libs package and without the main package.|https://www.port389.org/|1502376471|1501859238|GPLv3+|CentOS|System Environment/Daemons|c1bm.rdu2.centos.org|389-ds-base-1.3.6.1-16.el7.src.rpm|1384|136028|CentOS BuildSystem <http://bugs.centos.org>|693652|1693427|1695604|Packages/389-ds-base-libs-1.3.6.1-16.el7.x86_64.rpm||sha256
なお sqlite のダンプデータを見たい場合は、以下のように取得します。
# sqlite3 ./x86_64/7/base/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite .dump >/tmp/data