next up previous contents
Next: *套件修補、檢驗與管理 Up: *RPM 與 SRPM 套件發行 Previous: 建立 RPM 套件   Contents

KPlayer RPM 實例

  • 安裝 rpm 原始碼
    1. 下載 Mandriva 2007.0 kplayer rpm 原始碼 至目錄 /usr/src/rpm/SRPMS
      [root@dywHome2 SRPMS]# wget ftp://ftp.isu.edu.tw/Linux/Mandriva/
      devel/2007.0/SRPMS/contrib/release/kplayer-0.5.3-5mdv2007.0.src.rpm
      
    2. 使用 urpmi 在 /usr/src/rpm/SRPMS,安裝 rpm 原始碼:
      [root@dywHome2 SRPMS]# cd ..
      [root@dywHome2 rpm]# urpmi SRPMS/kplayer-0.5.3-5mdv2007.0.src.rpm
      To satisfy dependencies, the following package is going to be installed:
      libnas2-devel-1.8-1.1mdv2007.0.i586
      Proceed with the installation of the 1 packages? (0 MB) (Y/n) y
      
          ftp://ftp.isu.edu.tw/Linux/Mandriva/official/2007.0/i586/media/main
              /updates/libnas2-devel-1.8-1.1mdv2007.0.i586.rpm
      installing libnas2-devel-1.8-1.1mdv2007.0.i586.rpm from /var/cache/urpmi/rpms
      Preparing...                     ############################################
            1/1: libnas2-devel         ############################################
      
    3. 查看 rpm 原始碼之目錄:
      [root@dywHome2 rpm]# ls BUILD/ RPMS/ SOURCES/ SPECS/ SRPMS/
      BUILD/:
      
      RPMS/:
      athlon/  i386/  i486/  i586/  i686/  noarch/
      
      SOURCES/:
      kplayer-0.5.3.tar.bz2
      
      SPECS/:
      kplayer.spec
      
      SRPMS/:
      kplayer-0.5.3-5mdv2007.0.src.rpm
      
  • 程式修改與重新打包壓縮:
    1. tarball 解打包壓縮在目錄 kplayer-0.5.3。
    2. 修改目錄名稱:
      [root@dywHome2 SOURCES]# mv kplayer-0.5.3 kplayer-0.5.3.systray
      [root@dywHome2 SOURCES]# ll
      total 3097
      drwxr-xr-x 9 root root     1024 Apr  5 15:17 kplayer-0.5.3.systray/
      -rw-r--r-- 1 root users 3156593 Jul  3  2006 kplayer-0.5.3.tar.bz2
      
    3. 修改程式:不詳述。
    4. Makefile 修改:與 tarball 相同。
    5. 版本序號 0.5.3 後,加入 .systray,故打包壓縮之 tarball 名稱為: kplayer-0.5.3.systray.tar.gz。
      [root@dywHome2 SOURCES]# ll
      total 6820
      drwxr-xr-x 9 root root     1024 Apr  5 17:27 kplayer-0.5.3.systray/
      -rw-r--r-- 1 root root  3795740 Apr  5 17:27 kplayer-0.5.3.systray.tar.gz
      -rw-r--r-- 1 root users 3156593 Jul  3  2006 kplayer-0.5.3.tar.bz2
      [root@dywHome2 SOURCES]# cd ../SPECS/
      
  • 建立 rpm 檔案:
    1. 修改 kplayer.spec:版本序號 0.5.3 後,加入 .systray
      [root@dywHome2 rpm]# vi SPECS/kplayer.spec
      %define version 0.5.3.systray
      
    2. 產生 kplayer-0.5.3.systray-5mdv2007.0.i586.rpm
      [root@dywHome2 SPECS]# rpmbuild -bb kplayer.spec
      ----以上省略----
      Wrote: /usr/src/rpm/RPMS/i586/kplayer-0.5.3.systray-5mdv2007.0.i586.rpm
      Wrote: /usr/src/rpm/RPMS/i586/kplayer-debug-0.5.3.systray-5mdv2007.0.i586.rpm
      Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.6408
      + umask 022
      + cd /usr/src/rpm/BUILD
      + cd kplayer-0.5.3.systray
      + rm -rf /var/tmp/kplayer-0.5.3.systray-buildroot
      + exit 0
      
    3. 查看 rpm 檔案
      [root@dywHome2 SPECS]# ll ../RPMS/i586/
      total 6377
      -rw-r--r-- 1 root root 3122228 Apr  5 17:29 
      kplayer-0.5.3.systray-5mdv2007.0.i586.rpm
      -rw-r--r-- 1 root root 3378549 Apr  5 17:29 
      kplayer-debug-0.5.3.systray-5mdv2007.0.i586.rpm
      
  • 建立二進位和原始碼 RPM 檔案:
    1. 產生 kplayer-0.5.3.systray-5mdv2007.0.i586.src.rpm
      [root@dywHome2 SPECS]# rpmbuild -ba kplayer.spec
      ----以上省略----
      Wrote: /usr/src/rpm/SRPMS/kplayer-0.5.3.systray-5mdv2007.0.src.rpm
      Wrote: /usr/src/rpm/RPMS/i586/kplayer-0.5.3.systray-5mdv2007.0.i586.rpm
      Wrote: /usr/src/rpm/RPMS/i586/kplayer-debug-0.5.3.systray-5mdv2007.0.i586.rpm
      Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.26586
      + umask 022
      + cd /usr/src/rpm/BUILD
      + cd kplayer-0.5.3.systray
      + rm -rf /var/tmp/kplayer-0.5.3.systray-buildroot
      + exit 0
      
    2. 查看二進位和原始碼 RPM 檔案
      [root@dywHome2 SPECS]# ll ../SRPMS/ ../RPMS/i586/
      ../RPMS/i586/:
      total 6377
      -rw-r--r-- 1 root root 3122404 Apr  5 17:46 
      kplayer-0.5.3.systray-5mdv2007.0.i586.rpm
      -rw-r--r-- 1 root root 3378599 Apr  5 17:46 
      kplayer-debug-0.5.3.systray-5mdv2007.0.i586.rpm
      
      ../SRPMS/:
      total 6845
      -rw-r--r-- 1 root root 3168326 Apr  5 10:35 
      kplayer-0.5.3-5mdv2007.0.src.rpm
      -rw-r--r-- 1 root root 3808850 Apr  5 17:46 
      kplayer-0.5.3.systray-5mdv2007.0.src.rpm
      

  • 將 rpm 及 原始碼 rpm 釋出
    1. 釋出 kplayer-0.5.3.systray-5mdv2007.0.i586.rpm
    2. 釋出 kplayer-0.5.3.systray-5mdv2007.0.src.rpm



2017-06-14