local-apt-repository-vine-nosrc-self-build-vl.spec 5.7 KB

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