pkgbuild tips - 1

来源:互联网 发布:北京太极计算机做java 编辑:程序博客网 时间:2024/05/22 17:41
 I have been thinking for some time that I should publish some tips for building packages using pkgbuild.If you have created more then one spec file using pkgbuild, then youwill know that many things are repeatable. The general process goeslike time -
  1. Create an initial spec file from either a template or a spec file for a similar application.
  2. Try a build.
  3. You should expect that the above should fail. Check the log file (/tmp/.log) for where it failed. Fix the problem. Generally a typo or the build needs a patch
  4. Repeat 2-3 until the prep and build works. If it actually installs the packages, then go to 7
  5. Look in the RPM_BUILD_ROOT directory tree in /var/tmp for what was installed, and adjust the %files section of the spec file to match the installation.
  6. Go back and repeat from 2 (Note: you can short-cut this with pkgbuild)
  7. Publish the spec file(s), patches, ChangeLog etc and your done.
Todaystip involves adding a patch. I find that using 2 or 3 windows makesthis really easy. The 1st window is where you do the pkgtool/pkgbuildcommands and edit your spec files. You use the 2nd window to digthrough the build area to find and fix any bugs or problems after afail build. Have the 3rd window setup so you are in the /tmp directory.Once you have a change to make that requires a patch, just do somthingsimilar in following in the 3rd window.
jdsbuild@prae> cd /tmp
jdsbuild@prae> gtar fxj ~/packages/SOURCES/xfwm4-4.4.1.tar.bz2
jdsbuild@prae> mv xfwm4-4.4.1 xfwm4-4.4.1-orig
jdsbuild@prae> gtar fxj ~/packages/SOURCES/xfwm4-4.4.1.tar.bz2
#
# Fix the files which need to be patched.
#
jdsbuild@prae> diff -ur xfwm4-4.4.1-orig xfwm4-4.4.1 > ~/spec-files-xfce/patches/xfwm4-01-fixbadcode.diff

At this point add an entry for the patch xfwm4-01-fixbadcode.diff into the spec file and try again.

If you need to add another patch, just remove the patched directory, and un-tar again.

Maybe you want to merge a fix into an existing patch. Just patch the directory in /tmp and then make the changes.
jdsbuild@prae> cd /tmp
jdsbuild@prae> gtar fxj ~/packages/SOURCES/xfwm4-4.4.1.tar.bz2
jdsbuild@prae> mv xfwm4-4.4.1 xfwm4-4.4.1-orig
jdsbuild@prae> gtar fxj ~/packages/SOURCES/xfwm4-4.4.1.tar.bz2
jdsbuild@prae> cd xfwm4-4.4.1
jdsbuild@prae> gpatch -p1 < ~/spec-files-xfce/patches/xfwm4-01-fixbadcode.diff jdsbuild@prae> cd /tmp
#
# Fix the files which need to be patched.
#
jdsbuild@prae> diff -ur xfwm4-4.4.1-orig xfwm4-4.4.1 > ~/spec-files-xfce/patches/xfwm4-01-fixbadcode.diff

Using a shell like bash with command line editing, the process can be quite quick and easy.

Have Fun!!!

Note: this article is originally posted at

http://solaristhings.blogspot.com/2007/04/pkgbuild-tips-1.html

refer there for latest update
原创粉丝点击