hack のためのネタ帳, etc,,,

状況

私家版 apt-cygtypo の修正をもらったんだけど、hhs.bash のコードを embed してた箇所なので、hhs.bash に patch を backport したい。

patch とは言う物の
誤: WARNING
正: WARNIGN
くらいの前後 1 文字入れ替わった程度の変更なので、手で直した方が早いレベルなんだけど、折角 pull request もらっているので、感謝の意を込めて、commit に記録を残しておきたいという趣旨。

apt-cyg への pull request は apt-cyg に対する物だけど、hhs.bash では hhs_debug.bash に当該箇所がある。

format-patch による patch の作成

まず、apt-cyg で当該 pull request における変更点 を以下のようにして e-mail submission 用の patch として抽出した。
$ git format-patch 214e3a537e30f09f6b310892d6557ec8fae3976b^..214e3a537e30f09f6b310892d6557ec8fae3976b
0001-fixed-typos-in-upstream-script.patch

次に、これを以下のように修正した。
$ diff 0001-fixed-typos-in-upstream-script.patch ../apt-cyg/0001-fixed-typos-in-upstream-script.patch
7,9d6
<
< This patch is backported from https://github.com/kou1okada/apt-cyg/pull/58.
<
11c8
<  hhs_debug.bash | 2 +-
---
>  apt-cyg | 8 ++++----
14c11
< diff --git a/hhs_debug.bash b/hhs_debug.bash
---
> diff --git a/apt-cyg b/apt-cyg
16,17c13,14
< --- a/hhs_debug.bash
< +++ b/hhs_debug.bash
---
> --- a/apt-cyg
> +++ b/apt-cyg
26a24,50
> @@ -290,7 +290,7 @@ function usage()
>
>  function git_status ()
>  {
> -  local origin stauts
> +  local origin status
>    [ ! -d "${SCRIPT_REALDIR%/}/.git" ] && return 1
>    pushd "${SCRIPT_REALDIR}" >/dev/null
>    echo
> @@ -1320,7 +1320,7 @@ function apt-cyg-benchmark-mirrors ()
>
>  function apt-cyg-benchmark-parallel-mirrors ()
>  {
> -  local result="$(mktemp --tmpdir "${SCRIPTNAME}.$$.XXXXX")"
> +  local result="$(mktemp --tmpdir "${SCRIPT_NAME}.$$.XXXXX")"
>    local mirror
>    for mirror; do echo $mirror; done | lesser-parallel apt-cyg-benchmark-mirrors {} | tee "$result"
>    echo Finished benchmark.
> @@ -1771,7 +1771,7 @@ function apt-cyg-time () # [<internal_function> [<args> ...]]
>  function apt-cyg-filesearch () # [<pattern>]
>  #   File search like apt-file search
>  {
> -  local arch cachedir cachefile cachequery colmns line package packages url
> +  local arch cachedir cachefile cachequery columns line package packages url
>    arch="$(current_cygarch)"
>    cachedir="/tmp/.apt-cyg.cache/filesearch"
>    cachequery="$cachedir/$(sha256sum <<<"$1"|awk '$0=$1')"
hhs.bash とは無関係な部分を削除した上で、
パッチ対象のファイル名を apt-cyg から hhs_debug.bash に書き換え、
hhs_debug.bash への変更箇所をカウントして反映させると共に、
コメントには当該 pull request へのリンクを追加している。

最後に hhs.bash で以下のようにして mailbox 形式の patch として適用した。
$ git am 0001-fixed-typos-in-upstream-script.patch
Applying: fixed typos in upstream script
以下がその結果

参考

関連

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

フリーエリア

管理人/副管理人のみ編集できます