• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Solaris11/OpenIndiana パッケージ作成
 

Solaris11/OpenIndiana パッケージ作成

on

  • 3,321 views

Solaris11/OpenIndianaのパッケージ作成方法。...

Solaris11/OpenIndianaのパッケージ作成方法。

jposug有志主導のバイナリレポジトリを立てるに当たり、その方針などの草案をまとめてあります。

後半は技術的にSFEの環境を利用し、specファイルを作成、実際にレポジトリを作る話が書いてあります。

Statistics

Views

Total Views
3,321
Views on SlideShare
3,145
Embed Views
176

Actions

Likes
3
Downloads
37
Comments
0

2 Embeds 176

http://kohju.justplayer.com 174
http://a0.twimg.com 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Solaris11/OpenIndiana パッケージ作成 Solaris11/OpenIndiana パッケージ作成 Presentation Transcript

    • OpenSolaris Study Group 2012.01 S IPS OpenSolaris Users Group Leader /TAKI, Yasushiwww.opensolaris.org 1
    • www.opensolaris.org 2
    • IPS. . . . .. . . . Solaris. . www.opensolaris.org 3
    • . . sunsite . Solaris10. . Blastwave. . pkg.opensolaris.org/contrib. sourcejuicer . Spec File Extra . spec . Source Juicer. . OpenIndiana contrib OI www.opensolaris.org 4
    • .. Solaris11 OpenIndiana. Solaris11 OpenIndiana . OpenSolaris www.opensolaris.org 5
    • .. . Solaris11 OpenIndiana.. . ... www.opensolaris.org 6
    • .. PRIMARY . release rc dev 3 S11 OI 2 . release . . rc . release . devhttp://*/release/ Internet http:// /OS /release/ www.opensolaris.org 7
    • . www.opensolaris.org 8
    • .. PRIMARY PRIMARY /usr PRIMARY www.opensolaris.org 9
    • . . . opensolaris.gr.jp opensolaris.jp. . . . sourceforge . http://sourceforge.jp/projects/jposug Solaris11/OpenIndiana. . . www.opensolaris.org 10
    • ..... spec.. www.opensolaris.org 11
    • CBE:Common Build Environmentwww.opensolaris.org 12
    • CBE:Common Build Environment. Common Build Environment . **. PATH 1 spec.. tar ball. . BUILD.sh . configure make www.opensolaris.org 13
    • . . 1 . CBE IPS. . IPS . spec .. spec www.opensolaris.org 14
    • OSD CBE 3 localIPS pkgsend pkg install pkg/server(IPS Build Server IPS Server Test Server www.opensolaris.org 15
    • CBE.CBE. http://kohju.justplayer.com/Tips_OpenSolaris_IPS_Solaris11CBE.html http://t.co/5T6GWBkN Zone CBE CBE IPSCBE OS Solaris11 OpenIndiana www.opensolaris.org 16
    • IPS # netstat -an | grep LISTEN | grep *.80 *.80 *.* 0 0 49152 0 LISTEN Listen PID pfiles VirtualBoxwww.opensolaris.org 17
    • . HOME 3 . ~/spec-files-extra. spec-file-extra SFE spec . ~/spec-files-jucr. sourcejuicer SFE ~/packages packages/ |-- BUILD ← tar ballから展開。ビルドディレクトリ |-- PKGMAPS | |-- copyright ← copyright宇が保存される | |-- depend ← SVr4用の依存関係ファイルの保存 | |-- manifest ← IPS、pkgsend用 manifest | |-- pkginfo ← SVr4用のpkginfo(メタ情報)ファイル | |-- proto ← SVr4用のproto(ファイル一覧)ファイル | `-- scripts ← SVr4 PKG用、IPS登録用のスクリプト |-- PKGS ← パッケージの仮想root |-- SOURCES ← tar ball、パッチ、追加ファイルなど |-- SPECS ← include用のspecファイル `-- SPKGS ← ソースパッケージ(rpmのsrpmに相当) www.opensolaris.org 18
    • jposug spec.. http://sourceforge.jp/projects/jposug/wiki/ http://bit.ly/ifICpV.. SFE*.spec.. www.opensolaris.org 19
    • spec spec IPSwww.opensolaris.org 20
    • pkgbuild spec pkgbuild pkgtool • • URL spec • .spec • .tar.gz • • • 1. URL URL 2. pkgbuild( 1. pkgtool 3.IPS SVr4 pkg pkgbuild 2. 3. 4. 5. • spec --svr4 • copyright --ips •1. IPS manifest 1. SVR4 proto/pkginfo/depend2. IPS 2. pkg www.opensolaris.org 21
    • spec pkgsend manifest. . spec RedHat Linux . perl experimental. rpm spec . Spec File Extra SFE SFE spec SVr4. . IPS pkgsend manifest . 1. .spec . 2. . 3. 4. pkgsend 5. manifest 6. 7. www.opensolaris.org 22
    • workjposug spec ~/work/jposug/contrib-spec-files |-- bin ← 便利スクリプト群 | |-- mk-Requires.pl | |-- pkgsend_manifest.sh | `-- specbuild.sh ← pkgbuildのオススメオプションが入ってるもの |-- manifests ← specファイルでは作れないmanifest群 | |-- GNUmakefile | |-- JPCenvcmds.lst | |-- JPCenvcmds.manifest | 割愛 `-- specs ← specファイル群 |-- SFE*.spec |-- ext-sources← その他のファイル群 | `-- SFE*-xxx.ini |-- copyright ← copyrightファイル群 | `-- SFE*.copyright |-- patches ← パッチファイル群 | `-- SFE*-01-kohju.diff |-- include ← 全体で使うファイル www.opensolaris.org 23
    • specspec 1. メタ情報セクション メタ情報を記述する 2. %prep/%setupセクション アーカイブを展開し、ディレクトリを作成する。 3. %buildセクション パッチや、ビルドのためのスクリプトを書きます。 4. %installセクション 仮のroot/にインストールします。 5. %files セクション インストール構造を示します。 6. %changelogセクション 更新履歴を記載する www.opensolaris.org 24
    • %include Solaris.incName: nano パッケージの名前Summary: GNU nano text editor サマリーVersion: 2.0.9 バージョン名License: GPLv2 ライセンス名(意味コードではない)Url: http://www.nano-editor.org WEBサイトSource: http://www.nano-editor.org/dist/v2.0/%{name}-%{version}.tar.gz ファイル配布URLGroup: Editor グループDistribution: OpenSolaris 参照)Vendor: OpenSolaris Community http://opensolaris.org/os/community/ sw-porters/contributing/ipsclass/BuildRoot: %{_tmppath}/%{name}-%{version}-buildSUNW_Basedir: %{_basedir}SUNW_Copyright: %{name}.copyright# OpenSolaris IPS Manifest FieldsMeta(info.upstream): Chris Allegretta ソースコード・メンテナーMeta(info.maintainer): Peter Jones パッケージ・メンテナーMeta(info.repository_url): svn://svn.sv.gnu.org/nano/trunk/nano/ レポジトリのURLMeta(info.classification): Editor IPS Class(Groupと一緒)%description 説明文GNU nano is an effort to provide a Pico-like editor, but also includes some features thatwere missing in the original, such as search and replace, goto line or internationalizationsupport. www.opensolaris.org 25
    • %prep/%setup %prep rm -rf %name-%version %setup -q -n nano-%version tar ball%setup tar cd www.opensolaris.org 26
    • %build %build export CFLAGS="%optflags" export LDFLAGS="%{_ldflags}" ./configure --prefix=%{_prefix} --bindir=%{_bindir} --mandir=%{_mandir} --infodir=%{_infodir} --sysconfdir=%{_sysconfdir} --enable-all makeconfigure && make configure make patch www.opensolaris.org 27
    • %install%installrm -rf $RPM_BUILD_ROOTmake install DESTDIR=$RPM_BUILD_ROOTrm -f $RPM_BUILD_ROOT%{_infodir}/dir make install configure && make DESTDIR=$RPM_BUILD_ROOT ROOT www.opensolaris.org 28
    • %files %files %defattr (-, root, bin) %dir %attr (0755, root, bin) %{_bindir} %{_bindir}/* %{_infodir}/* %dir %attr(0755, root, sys) %{_datadir} %dir %attr(0755, root, bin) %{_mandir} %dir %attr(0755, root, bin) %{_mandir}/* %{_mandir}/*/* %dir %attr(0755, root, bin) %{_basedir}/share/nano %{_basedir}/share/nano/* %dir %attr(0755, root, bin) %{_basedir}/share/locale %{_basedir}/share/locale/*meta basedir www.opensolaris.org 29
    • %changelog%changelog* Thu Oct 23 2008 - andras _dot_ barna _at_ gmail _dot_ com- new version, add --enable-all, add SFEncursesw for utf-8* Wed Jul 5 2006 - laca _at_ sun _dot_ com- delete -share subpkg- update file attributes* Fri Feb 3 2006 - mike kiedrowski (lakeside-AT-cybrzn-DOT-com)- Initial version www.opensolaris.org 30
    • specspec wget http://jucr.opensolaris.org/help/nano.spec <pre> </pre> %filescopyrightspec tar.gz tar.gz copyright http://www.nano-editor.org/dist/v2.0/nano-2.0.9.tar.gz gtar zxf nano-2.0.9.tar.gz cp nano-2.0.9/COPYING nano.copyrightpatch www.opensolaris.org 31
    • % pkgtool build-only --sourcedirs=`pwd` --ips --download nano.specINFO: IPS packages will be installed by default from http://localhost:80/INFO: Copying %used or %included spec files to SPECS directoryINFO: Processing spec filesINFO: Finding sourcesINFO: Running pkgbuild -ba [...] nano.spec (nano)INFO: nano PASSEDSummary: package | status | details---------------------------------+-------------+------------------------------- nano | PASSED | /tmp/nano.log IPS www.opensolaris.org 32
    • PASS work-specwww.opensolaris.org 33
    • pkg pkg publisher % pkg publisher -a 発行元 タイプ 状態 URI opensolaris.org (優先) 起点 online http://pkg.opensolaris.org/dev/ contrib 起点 online http://pkg.opensolaris.org/contrib/ mypkgs (無効) 起点 online http://192.168.199.61/ enable % pkg set-publisher --enable mypkgspkg % pkg refresh --full mypkgs % pkg list -a pkg://mypkgs/* NAME (PUBLISHER) VERSION STATE UFIX nano (mypkgs) 2.0.9-0.111 known ---- contents www.opensolaris.org 34
    • www.opensolaris.org 35
    • IPSwww.opensolaris.org 36
    • .Solaris .. Studio12 gcc .. SUN GNU . . PostgreSQL 8.1/8.2/8.3 so. . . PATH www.opensolaris.org 37
    • . . . PATH . configure MAKE . . gcc . . . pending contrib . CPUwww.opensolaris.org 38
    • spec #1 # # spec file for package eb # # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # # %include Solaris.inc~/package/SPECS/Solaris.inc %{_basedir} Solaris.inc prod.inc options.inc %define _prefix /usr %define tarball_version 4.4.1 Name: eb IPS_package_name: library/text/ebIPS_package_name IPS %package www.opensolaris.org 39
    • spec #2 Summary: the library for accessing to the EPWING format Dictionaries Version: 4.4.1 License: Modified BSDL Url: http://www.sra.co.jp/people/m-kasahr/eb/ Source: ftp://ftp.sra.co.jp/pub/misc/%{name}/%{name}-%{tarball_ version}.tar.bz2 Distribution: OpenSolaris Vendor: OpenSolaris Community #SUNW_Basedir: %{_basedir} SUNW_Basedir: /Solaris10 /usr SUNWapch22u /SUNWapch22r /usr SPARSE ZONE /usr global zone inheritancespec SVr4 OpenSolaris SUNW_Copyright: %{name}.copyright BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: %{pnm_buildrequires_SUNWbtool} BuildRequires: %{pnm_buildrequires_SUNWbinutils} www.opensolaris.org 40
    • spec #3 BuildRequires: %{pnm_buildrequires_SUNWxcu4} BuildRequires: %{pnm_buildrequires_SUNWgmake} configure GNU Solaris Requires: %{pnm_requires_SUNWzlib} Requires: %{pnm_requires_SUNWgnu-gettext} Requires: CBE CBESFE IPS Solaris10 PKG BuildRequires: Requires: %{pnm } spec include/packagenames*.incSVR4 root user IPSIPS www.opensolaris.org 41
    • spec #4 # OpenSolaris IPS Package Manifest Fields Meta(info.maintainer): pkglabo.justplayer.com <pkgadmin@justplayer.com> Meta(info.upstream): Motoyuki Kasahara <m-kasahr@sra.co.jp> # Meta(info.repository_url): [open source code repository] Meta(info.classification): System Libraries %description EB library is for accessing to the EPWING format Dictionaries %prep %setup -c -n %name-%version %ifarch amd64 sparcv9 rm -rf %{name}-%{tarball_version}-64 cp -rp %{name}-%{tarball_version} %{name}-%{tarball_version}-64 %endif 64bit1. %setup eb-4.4.12. eb-4.4.1 eb-4.4.1-64 32bit eb-4.4.1 64bit eb-4.4.1-64 pwd www.opensolaris.org 42
    • spec #5 %build CPUS=`/usr/sbin/psrinfo | grep on-line | wc -l | tr -d ` if test "x$CPUS" = "x" -o $CPUS = 0; then CPUS=1 fiCPU gmake -j cd %{name}-%{tarball_version} %ifarch sparc %define target sparc-sun-solaris %else %define target i386-sun-solaris %endif ./configure --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --libdir=%{_libdir} --bindir=%{_bindir} www.opensolaris.org 43
    • spec #6 --includedir=%{_includedir} --mandir=%{_mandir} gmake -j$CPUSconfigure enable disablewith without CBE CPU www.opensolaris.org 44
    • spec #7 %ifarch amd64 sparcv9 cd ../%{name}-%{tarball_version}-64 export CFLAGS="%optflags64" ./configure --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --libdir=%{_libdir}/%{_arch64} --bindir=%{_bindir}/%{_arch64} --includedir=%{_includedir} --mandir=%{_mandir} gmake -j$CPUS %endif64 64 2 www.opensolaris.org 45
    • spec #8 %install cd %{name}-%{tarball_version} gmake install DESTDIR=$RPM_BUILD_ROOT root DESTDIR= ROOT INSTALL_DIR Makefile.in aclocal %ifarch amd64 sparcv9 cd ../%{name}-%{tarball_version}-64 gmake install DESTDIR=$RPM_BUILD_ROOT cd .. %endif64 SMF MANIFESTconfig ROOT www.opensolaris.org 46
    • %{?pkgbuild_postprocess: %pkgbuild_postprocess -v -c "%{version}:%{jds_ version}:%{name}:$RPM_ARCH:%(date +%%Y-%%m-%%d):%{support_level}" $RPM_BUILD_ROOT}%cleanrm -rf $RPM_BUILD_ROOT%files%defattr (-, root, bin)%dir %attr (0755, root, bin) %{_bindir}%{_bindir}/*%dir %attr(0755, root, bin) %{_libdir}%{_libdir}/*%dir %attr(0755, root, bin) %{_prefix}/include/eb%{_prefix}/include/eb/*%dir %attr(0755, root, bin) %{_prefix}/share%{_prefix}/share/*%{_sysconfdir}/eb.conf%changelog* Wed May 6 2009 TAKI, Yasushi <taki@justplayer.com>- Initial Revision* Mon Mar 8 2010 TAKI, Yasushi <taki@justplayer.com>- delete sub packages www.opensolaris.org 47
    • ~/work/tmp/php-5.1.6 パッチ当て済みのディレクトリ ~/work/tmp/php-5.1.6.orig パッチ当て前のディレクトリ gdiff -urN php-5.1.6.orig php-5.1.6 > patches/php51-01-kohju.diff 1spec Source: http://museum.php.net/%{tarball_name}5/%{tarball_name}- %{tarball_version}.tar.bz2 Source1: php51-php5.1.conf Patch1: %{name}-01-kohju.diff %setup -c -n %name-%version %patch1 -p0 %build www.opensolaris.org 48
    • gcc gcc BuildRequires: SUNWgnu-automake-19 BuildRequires: SUNWlibtool BuildRequires: SUNWgcc BuildRequires: SUNWgnu-automake-110 BuildRequires: SUNWgmake BuildRequires: SUNWbison BuildRequires: SUNWflexlex BuildRequires: SUNWaconf%build export CC=gcc export CFLAGS="%gcc_optflags" export CXX=g++ export CXXFLAGS="%gcc_cxx_optflags" export LDFLAGS="%_ldflags"Python export PYCC_CC=gcc export PYCC_CXX=g++configure --with-gcc www.opensolaris.org 49
    • postinstall scriptIPS Post Install Script. .... pkg class SMF manifest.. zfs autosnap SMF roleadd enable/disable www.opensolaris.org 50
    • #1BuildRequired 1 WARNING: skipping package eb: required package SUNWgnu-gettext not installed WARNING: and no spec file specified on the command line provides it INFO: Hint: use the --autodeps to locate spec files for dependencies automatically Summary: package | status | details ---------------------------------+-------------+------------------------------- eb | DEP_FAILED | Dependency check failed/tmp/eb.log INFO: Checking dependencies of eb WARNING: skipping package eb: required package SUNWgnu-gettext not installed WARNING: and no spec file specified on the command line provides it INFO: Hint: use the --autodeps to locate spec files for dependencies automatically WARNING: eb wont be built as it requires SUNWgnu-gettext BuildRequires juicer SUNWgnu-gettext SUNWgnu-gettext SVr4 www.opensolaris.org 51
    • #2 CBE SourceJuicer Juicer pkgbuild: checking host system type... i386-pc-solaris2.11 pkgbuild: checking for a sed that does not truncate output... /usr/bin/sed pkgbuild: checking for grep that handles long lines and -e... configure: error: no acceptable grep could be found in /opt/jdsbld/bin:/usr/ccs/bin:/usr/gnu/bin:/usr/ bin:/usr/sbin:/bin:/usr/sfw/bin:/opt/SunStudioExpress/bin:/usr/xpg4/bin pkgbuild: Bad exit status from /var/tmp/pkgbuild-bld/pkgbuild-tmp-2.9172 (%build)configure grep CBE pkgbuild: checking for a sed that does not truncate output... /opt/dtbld/bin/sed pkgbuild: checking for grep that handles long lines and -e... /usr/xpg4/bin/grep pkgbuild: checking for egrep... /usr/xpg4/bin/grep -E pkgbuild: checking for fgrep... /usr/xpg4/bin/grep -F pkgbuild: checking for non-GNU ld... /usr/ccs/bin/ldgrep /usr/xpg4/bin/grep pkg search /usr/xpg4/bin/grep SUNWxcu4 IPS pkg contents -m SUNWxcu4 | grep legacy legacy BuildRequire www.opensolaris.org 52
    • #3Juicer linker configure pkgbuild: checking for objdump... no pkgbuild: checking how to recognize dependent libraries... pass_all pkgbuild: checking for ar... no pkgbuild: checking for strip... no pkgbuild: checking for ranlib... no pkgbuild: checking command to parse link -dump -symbols output from /opt/SunStudioExpress/bin/cc object... failed BuildRequires www.opensolaris.org 53
    • IPS IPSwww.opensolaris.org 54
    • IPS #1 pkg/server pkg install pkgsend http or https http or https Client pkg install Build Machine Clientpkgsend www.opensolaris.org 55
    • IPS #2ReadOnly pkgsend pkg install. Package Data http or https Client pkg install pkg/inst_. root Client Rewritable Data pkg/writable_root www.opensolaris.org 56
    • IPSIPS svccfg man pkg.depotd pkg/readonly リードオンリー。trueにすると、pkgsendできなくなります。 pkg/content_root ドキュメントルート。デザインを変更するときのコンポーネントはここに 保存(IPSは、httpdとして起動している)。デフォルトは、/usr/share/lib/pkg pkg/inst_root レポジトリの実体が入ります。レポジトリデータはこの場所にあるので、 ここをコピーすることにより、レポジトリの複製が可能です。デフォルトは/var/pkg/repo。 pkg/writable_root リライタブルな一次データが入ります。デフォルトは inst_root と同じ 場所を利用します。カラのディレクトリを指定すると勝手に作り、inst_rootをread only filesystemに設置することが可能になります。 pkg/log_access アクセスログ。 pkg/log_errors エラーログ。 pkg/port LISTENポート番号。 pkg/proxy_base Proxyサーバを経由したとき、実際に参照されるURL。 pkg/threads 受付スレッドの本数。デフォルトは10なので最大同時10人しかアクセスで きません。 pfexec svccfg -s pkg/server "setprop pkg/port=10000" pfexec svcadm refresh pkg/server pfexec svcadm restart pkg/server www.opensolaris.org 57
    • . pkg.depotd python Internet. Apache Apache worker prefork.. Apache (/dev /release . mod_proxy pkg.depotd pkg.depotd 1 Internet mod_proxy_balancer . apache pkg.depotd . Reverse Proxy DMZ mod_mem_cache/ . mod_disk_cachepkg.depotd pkg.depotd pkg.depotd pkg/writable_root ramdisk www.opensolaris.org 58
    • zfs,pkg.depotd Apache 1 pkg.depotd 1 ZFS zfs create rpool/export/pkglabo/dev zfs set mountpoint=/var/pkg/repo rpool/export/pkglabo/dev zfs set readonly=on rpool/export/pkglabo/devreadonly writable touch /var/pkg/repo.cfg svccfg -s application/pkg/server setprop pkg/proxy_base = “http://pkglabo.justplayer. com/dev” svccfg -s application/pkg/server setprop pkg/readonly = true svccfg -s application/pkg/server setprop pkg/cfg_file = “/var/pkg/repo.cfg” svccfg -s application/pkg/server setprop pkg/writable_root = “/var/pkg/wrepo” svcadm refresh application/pkg/server svcadm enable application/pkg/server www.opensolaris.org 59
    • Apache ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /dev http://inner-server/ ProxyPassReverse /dev http://inner-server/Apache mod_rewrite RewriteCond %{REQUEST_URI} ^/dev$ [NC] RewriteRule ^/dev /dev/ [R=301] RewriteCond %{REQUEST_URI} ^/dev/ [NC] RewriteRule ^/dev/(.*) http://inner-server/$1 [P] www.opensolaris.org 60
    • Internet . pkg.depotd pkgsend . Apache . . Reverse Proxy pkgsend IPS /dev/ . IPSBacknet IPS pkgsend . /release/ IPS Server zfs send IPS Server IPS Server /release/ /dev/ zfs send IPS Server www.opensolaris.org 61
    • OpenSolarisJapan OpenSolaris Users Group Leader www.opensolaris.org 62