[521] | 1 | ############################################################ |
---|
| 2 | # directory <baseuri>/<distribution_name>/RPMS.<component> |
---|
| 3 | # default /var/local/apt-repository/vine-nosrc/RPMS.self-build |
---|
| 4 | %define baseuri /var/local/apt-repository |
---|
| 5 | %define distribution_name vine-nosrc |
---|
| 6 | %define component self-build |
---|
| 7 | |
---|
| 8 | # scheme [file,copy] |
---|
| 9 | # default file |
---|
| 10 | %define scheme file |
---|
| 11 | |
---|
| 12 | # vendor_id |
---|
| 13 | # default { } |
---|
| 14 | ### example {[your_id]} |
---|
| 15 | %define vendor_id { } |
---|
| 16 | |
---|
| 17 | # genbasedir command option |
---|
| 18 | # default {--flat} |
---|
| 19 | ### example {--flat --progress -s --default-key=KEYID} |
---|
| 20 | %define genbasedir_option {--flat} |
---|
| 21 | |
---|
| 22 | ### DEFAULT : NO VEDOR_ID , NO SIGNATURE |
---|
| 23 | ### TO SIGN AUTOMATICALLY, YOU SHOULD REWRITE CRON FILE. |
---|
| 24 | |
---|
| 25 | # cron schedule [hourly,daily,weekly,monthly] |
---|
| 26 | %define schedule weekly |
---|
| 27 | |
---|
| 28 | # niceness (genbasedir command in cron file) |
---|
| 29 | # -20(highest) 0(normal) 19(lowest) |
---|
| 30 | # default 1 |
---|
| 31 | %define niceness 1 |
---|
| 32 | ############################################################ |
---|
| 33 | |
---|
| 34 | %define pkg_version 1 |
---|
| 35 | %define pkg_release 1%{?_dist_release} |
---|
| 36 | |
---|
| 37 | Summary: local apt repository setup (%{distribution_name}:%{component}) |
---|
| 38 | Summary(ja): ローカルのAPTリポジトリを扱うためのパッケージ (%{distribution_name}:%{component}) |
---|
| 39 | Name: local-apt-repository-%{distribution_name}-%{component} |
---|
| 40 | Version: %{pkg_version} |
---|
| 41 | Release: %{pkg_release} |
---|
| 42 | License: GPL |
---|
| 43 | Group: Applications/Administration |
---|
| 44 | BuildRoot: %{_tmppath}/%{name}-%{version}-root |
---|
| 45 | BuildArch: noarch |
---|
| 46 | Requires: apt crontabs |
---|
| 47 | |
---|
| 48 | Packager: Takuya Kobayashi <ruby11@cocoa.ocn.ne.jp> |
---|
| 49 | Vendor: Project Vine |
---|
| 50 | Distribution: Vine Linux |
---|
| 51 | |
---|
| 52 | %description |
---|
| 53 | This package makes local apt repository. |
---|
| 54 | |
---|
| 55 | scheme - %{scheme} |
---|
| 56 | baseuri - %{baseuri} |
---|
| 57 | distribution - %{distribution_name} |
---|
| 58 | component - %{component} |
---|
| 59 | resource list - %{_sysconfdir}/apt/sources.list.d/%{distribution_name}-%{component}.list |
---|
| 60 | update script - %{baseuri}/%{distribution_name}/update-%{distribution_name}-%{component}.sh |
---|
| 61 | cron file - %{_sysconfdir}/cron.%{schedule}/update-%{distribution_name}-%{component}.cron |
---|
| 62 | |
---|
| 63 | %description -l ja |
---|
| 64 | ローカルのAPTリポジトリを作成、管理するためのパッケージです。 |
---|
| 65 | |
---|
| 66 | このパッケージは |
---|
| 67 | scheme - %{scheme} |
---|
| 68 | baseuri - %{baseuri} |
---|
| 69 | distribution - %{distribution_name} |
---|
| 70 | component - %{component} |
---|
| 71 | resource list - %{_sysconfdir}/apt/sources.list.d/%{distribution_name}-%{component}.list |
---|
| 72 | update script - %{baseuri}/%{distribution_name}/update-%{distribution_name}-%{component}.sh |
---|
| 73 | cron file - %{_sysconfdir}/cron.%{schedule}/update-%{distribution_name}-%{component}.cron |
---|
| 74 | として build されています。 |
---|
| 75 | |
---|
| 76 | %{baseuri}/%{distribution_name}/RPMS.%{component} |
---|
| 77 | %{baseuri}/%{distribution_name}/SRPMS.%{component} |
---|
| 78 | にパッケージを入れて |
---|
| 79 | update script (%{baseuri}/%{distribution_name}/update-%{distribution_name}-%{component}.sh) |
---|
| 80 | を実行するとリポジトリの作成は完了し、 |
---|
| 81 | %{_bindir}/apt-get update を実行すると利用できるようになります。 |
---|
| 82 | パッケージの追加や削除の際は、update script や cron file でリポジトリの情報を更新してください。 |
---|
| 83 | |
---|
| 84 | apt_preferences, genbasedir, sources.list, vendors.list 等の man page を参照し、 |
---|
| 85 | 必要に応じて %{baseuri}/%{distribution_name}/base/ 以下のファイルを書き換えてください。 |
---|
| 86 | |
---|
| 87 | baseuri 等を変更する場合は、Source RPM を入手し spec ファイルを書き換えてください。 |
---|
| 88 | |
---|
| 89 | %prep |
---|
| 90 | if [ -e %{buildroot} ] ; then |
---|
| 91 | [ "%{buildroot}" != "/" ] && %{__rm} -r %{buildroot} |
---|
| 92 | fi |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | %build |
---|
| 96 | %{__mkdir_p} %{name}-%{version} |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | # write sources.list |
---|
| 100 | %{__cat} << EOF > %{name}-%{version}/%{distribution_name}-%{component}.list |
---|
| 101 | rpm %{vendor_id} %{scheme}:%{baseuri} %{distribution_name} %{component} |
---|
| 102 | rpm-src %{vendor_id} %{scheme}:%{baseuri} %{distribution_name} %{component} |
---|
| 103 | EOF |
---|
| 104 | |
---|
| 105 | #%{__cat} %{name}-%{version}/%{distribution_name}-%{component}.list |
---|
| 106 | |
---|
| 107 | # write update script |
---|
| 108 | %{__cat} << EOF > %{name}-%{version}/update-%{distribution_name}-%{component}.sh |
---|
| 109 | #! /bin/bash |
---|
| 110 | %{_bindir}/genbasedir %{genbasedir_option} %{baseuri}/%{distribution_name} |
---|
| 111 | EOF |
---|
| 112 | |
---|
| 113 | #%{__cat} %{name}-%{version}/update-%{distribution_name}-%{component}.sh |
---|
| 114 | |
---|
| 115 | # write cron file |
---|
| 116 | %{__cat} << EOF > %{name}-%{version}/update-%{distribution_name}-%{component}.cron |
---|
| 117 | #! /bin/bash |
---|
| 118 | %{_sysbindir}/nice -n %{niceness} %{_bindir}/genbasedir %{genbasedir_option} %{baseuri}/%{distribution_name} |
---|
| 119 | EOF |
---|
| 120 | |
---|
| 121 | #%{__cat} %{name}-%{version}/update-%{distribution_name}-%{component}.cron |
---|
| 122 | |
---|
| 123 | %install |
---|
| 124 | # make component directories |
---|
| 125 | %{__mkdir_p} %{buildroot}/%{baseuri}/%{distribution_name}/RPMS.%{component} |
---|
| 126 | %{__mkdir_p} %{buildroot}/%{baseuri}/%{distribution_name}/SRPMS.%{component} |
---|
| 127 | |
---|
| 128 | # install sources.list |
---|
| 129 | %{__mkdir_p} %{buildroot}/%{_sysconfdir}/apt/sources.list.d |
---|
| 130 | %{__install} -m 644 %{name}-%{version}/%{distribution_name}-%{component}.list %{buildroot}/%{_sysconfdir}/apt/sources.list.d |
---|
| 131 | |
---|
| 132 | # install update script |
---|
| 133 | %{__install} -m 744 %{name}-%{version}/update-%{distribution_name}-%{component}.sh %{buildroot}/%{baseuri}/%{distribution_name}/ |
---|
| 134 | |
---|
| 135 | # install cron file |
---|
| 136 | %{__mkdir_p} %{buildroot}/%{_sysconfdir}/cron.%{schedule} |
---|
| 137 | %{__install} -m 744 %{name}-%{version}/update-%{distribution_name}-%{component}.cron %{buildroot}/%{_sysconfdir}/cron.%{schedule} |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | %files |
---|
| 141 | %defattr (-,root,root) |
---|
| 142 | %dir %{baseuri}/%{distribution_name}/RPMS.%{component} |
---|
| 143 | %dir %{baseuri}/%{distribution_name}/SRPMS.%{component} |
---|
| 144 | %{baseuri}/%{distribution_name}/update-%{distribution_name}-%{component}.sh |
---|
| 145 | %config %{_sysconfdir}/cron.%{schedule}/update-%{distribution_name}-%{component}.cron |
---|
| 146 | %config %{_sysconfdir}/apt/sources.list.d/%{distribution_name}-%{component}.list |
---|
| 147 | |
---|
| 148 | |
---|
| 149 | %clean |
---|
| 150 | [ "%{buildroot}" != "/" ] && %{__rm} -r %{buildroot} |
---|
| 151 | |
---|
| 152 | |
---|
| 153 | %changelog |
---|
| 154 | * Fri Oct 03 2008 Shu KONNO <owa@bg.wakwak.com> 1-1vl5 |
---|
| 155 | - applied new versioning policy, spec in utf-8 |
---|
| 156 | |
---|
| 157 | * Tue Oct 16 2007 Takuya Kobayashi <ruby11@cocoa.ocn.ne.jp> 1-0vl1 |
---|
| 158 | - Initial Package for Vine Linux |
---|