建立pgn-extract包

建立pgn-extract包

我想創建一個安裝包來安裝最新版本pgn 萃取物。我下載pgn-extract.tgz並解壓縮了存檔。但我自己無法進一步思考,因為我對建構包的概念沒有經驗。

答案1

最簡單的方法(對於某些“最簡單”的值)是下載現有的pgn-extract包裹並以此為基礎:

  1. 下載目前來源:

    wget ftp://ftp.cs.kent.ac.uk/pub/djb/pgn-extract/pgn-extract.tgz
    
  2. 提取它:

    tar xf pgn-extract.tgz
    
  3. 確定版本號:

    grep Version pgn-extract/index.html
    

    (我得到“17-38”,所以我將在以下說明中使用它;如果您有更高版本,請根據需要替換“17”和“38”)

  4. 將 tarball 連結到 Debian 建置工具期望的「.orig」tarball:

    ln -s pgn-extract.tgz pgn-extract_17.38.orig.tar.gz
    
  5. 下載源碼包並解壓縮:

    apt-get source pgn-extract
    
  6. 將現有debian目錄複製到pgn-extract來源目錄中:

    cd pgn-extract
    cp -a ../pgn-extract-17.21/debian .
    
  7. 為您的版本新增變更日誌條目,例如

    dch -v 17.38-0.1 "New upstream release."
    
  8. 建置新包;如果此處出現錯誤,請根據需要修復包裝,然後再試一次:

    dpkg-buildpackage -us -uc
    

就我而言,我必須修復makefile.patch;這顯示為在建置開始時修補程式碼時出現的錯誤:

dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building pgn-extract using existing ./pgn-extract_17.38.orig.tar.gz
patching file Makefile
Hunk #1 FAILED at 37.
Hunk #2 succeeded at 48 (offset 1 line).
1 out of 2 hunks FAILED
dpkg-source: info: the patch has fuzz which is not allowed, or is malformed
dpkg-source: info: if patch 'makefile.patch' is correctly applied by quilt, use 'quilt refresh' to update it
dpkg-source: error: LC_ALL=C patch -t -F 0 -N -p1 -u -V never -E -b -B .pc/makefile.patch/ --reject-file=- < pgn-extract.orig.ltAFev/debian/patches/makefile.patch gave error exit status 1
dpkg-buildpackage: error: dpkg-source -b pgn-extract gave error exit status 2

為了解決這個問題,我按照以下步驟進行:

  1. 強制套用補丁:

    export QUILT_PATCHES="debian/patches"
    quilt push -f
    
  2. 檢查拒絕Makefile.rej並使用編輯器手動應用它們;對於當前版本的pgn-extract,這意味著:

    1. 尋找線# AIX 3.2 Users might like these alternatives

    2. 找到這句話上方的一行CC=gcc

    3. 在上面,刪除說 的行-O3,並將\上一行末尾的 替換為$(CPPFLAGS),因此整行最終為

             -I/usr/local/lib/ansi-include -std=c99 $(CPPFLAGS)
      
  3. 刷新補丁:

    quilt refresh
    
  4. 再次運行建置。

您也可以從提取的 Debian 原始碼包開始,並用於uscan下載和處理最新的 tarball,但如果您有興趣,我會讓您研究一下。

相關內容