Bug 259207 - ports-mgmt/pkg_tree: cleanup
Summary: ports-mgmt/pkg_tree: cleanup
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Koichiro Iwao
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-16 09:47 UTC by Tatsuki Makino
Modified: 2021-10-28 09:04 UTC (History)
2 users (show)

See Also:
tatsuki_makino: maintainer-feedback+


Attachments
patch for ports-mgmt/pkg_tree (1.06 KB, patch)
2021-10-16 09:47 UTC, Tatsuki Makino
tatsuki_makino: maintainer-approval+
Details | Diff
poudriere log (12.34 KB, text/plain)
2021-10-16 09:48 UTC, Tatsuki Makino
no flags Details
format-patch for ports-mgmt/pkg_tree (1.63 KB, patch)
2021-10-21 01:22 UTC, Tatsuki Makino
tatsuki_makino: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tatsuki Makino 2021-10-16 09:47:15 UTC
Created attachment 228753 [details]
patch for ports-mgmt/pkg_tree

Switched from PORTVERSION to DISTVERSION.
URLs such as MASTER_SITES have been switched from http to https.
Variables have been sorted to silence portclippy :)
Regenerated distinfo by running make makesum "FORCE_FETCH_ALL=yes" "FETCH_ARGS=-pm".
Comment 1 Tatsuki Makino 2021-10-16 09:48:01 UTC
Created attachment 228754 [details]
poudriere log
Comment 2 Koichiro Iwao freebsd_committer 2021-10-19 07:44:14 UTC
Can you commit it to your local git repo and submit the patch created by `git format-patch`?
Comment 3 Tatsuki Makino 2021-10-21 01:22:59 UTC
Created attachment 228910 [details]
format-patch for ports-mgmt/pkg_tree

(In reply to Koichiro Iwao from comment #2)
こんな感じのやつでよいですか?
Is this what the format-patch should look like?


The commands I used to generate it:
rm -r -f -- ports-mgmt/pkg_tree/
cp -R -- ~/work/pkg_tree ports-mgmt/
git add -- ports-mgmt/pkg_tree
git commit "--author=Tatsuki Makino <tatsuki_makino@hotmail.com>" --
git format-patch --no-prefix -1 "--output-directory=/tmp/" --start-number=1 "--subject-prefix=" HEAD

In addition, the commands to restore the local clone to its original state:
git reset --soft HEAD^ --
git restore --source=HEAD --staged -- ports-mgmt/pkg_tree

(These additional information can be used as a reference to see what kind of ideas the less understanding maintainer might generate :) )
Comment 4 Tatsuki Makino 2021-10-21 01:25:37 UTC
Comment on attachment 228910 [details]
format-patch for ports-mgmt/pkg_tree

Auto-detection will be application/mbox, so checking the patch is a must :)
Comment 5 Tatsuki Makino 2021-10-21 01:29:05 UTC
(In reply to Tatsuki Makino from comment #4)
And, the format doesn't work with Bugzilla's compare to previous file function.
Comment 6 commit-hook freebsd_committer 2021-10-28 07:58:09 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2ab4c64e83a569924c23143b22d9b67b1c54a25d

commit 2ab4c64e83a569924c23143b22d9b67b1c54a25d
Author:     Koichiro Iwao <meta@FreeBSD.org>
AuthorDate: 2021-10-28 07:46:09 +0000
Commit:     Koichiro Iwao <meta@FreeBSD.org>
CommitDate: 2021-10-28 07:48:05 +0000

    ports-mgmt/pkg_tree: cleanup

    - Switch to DISTVERSION
    - Switch to https MASTER_SITES
    - Pet portclippy
    PR:             259207

 ports-mgmt/pkg_tree/Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Comment 7 Koichiro Iwao freebsd_committer 2021-10-28 07:58:17 UTC
It failed to apply but hand applied. Simply do `git format-patch HEAD^1`.

Applying: ports-mgmt/pkg_tree: cleanup
error: pkg_tree/Makefile: does not exist in index
error: pkg_tree/distinfo: does not exist in index
Patch failed at 0001 ports-mgmt/pkg_tree: cleanup
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Comment 8 Tatsuki Makino 2021-10-28 09:04:19 UTC
(In reply to Koichiro Iwao from comment #7)

ありがとうございます。
こちらでも git am attachment-228910.patch を実行したときに、そのようなメッセージを出して失敗しました。
git am -p0 attachment-228910.patch で実行した場合には Applying: 〜 の行だけ表示され、適用に成功したと思われます。
つまり、パッチを作る側が --no-prefix のようなオプションを追加していると、パッチを使うコミッター側でも -p0 のような余計なオプションが必要になってしまうということ。
と、 /usr/bin にある patch コマンドも -p を使わない(あるいは -p957)で diff --git の文字列を含むパッチを通せば、 git が付加する a/ や b/ を自動的に削る機能が入っているから、パスのあたりの細かい考慮は必要ないということのようでした。

English summary of the above:
We don't need to add --no-prefix when we output patches in git, because git needs to make minor modifications like -p0 when it handles patches.
Also, /usr/bin/patch can read the patches output by git without any modification.