ページ

2022-08-17

Cinnamon アプレットの改修手順

たまにしかやらないので、自分用の備忘録として記録してみます。

リポジトリを GitHub 上で fork する
linuxmint/cinnamon-spices-applets

 

ローカルディスクに clone する
・空のディレクトリを作成
・git init で初期化
・リポジトリ内の特定ディレクトリのみ clone できるように設定
config に sparsecheckout = true
・info/sparse-checkout にローカルにコピーしたいディレクトリ名を記述
・同じく cinnamon-spices-makepot、validate-spice もローカルコピー対象として記述
・git remote add origin [url]
・git config -l で準備状況を確認
・いざ git pull origin master でローカルディスクにコピー

$ git pull origin master
remote: Enumerating objects: 11279, done.
remote: Counting objects: 100% (11279/11279), done.
remote: Compressing objects: 100% (5473/5473), done.
remote: Total 11279 (delta 5031), reused 11128 (delta 4981), pack-reused 0
Receiving objects: 100% (11279/11279), 52.67 MiB | 6.76 MiB/s, done.
Resolving deltas: 100% (5031/5031), done.
From https://github.com/xxxxxxxx/cinnamon-spices-desklets
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master


途中で改修中のアプレットに誰かが更新をかけた
・GitHub 上でリモートリポジトリを最新化する(Sync fork)


 

 

デバッグ方法
以下のような命令文を追加する
global.logError(“sliderChanged : start : ” + this.LoopPromptOn);

出力先は ~/.xsession-errors になる。Cinnamon の Looking Glass というか Melange の「Log」画面でも確認できる。あまりにもたくさん書き出すと ~/.xsession-errors のファイルサイズが巨大になるので注意が必要。


GitHub への投稿
・cinnamon-spices-makepot で翻訳ファイルを最新化
・validate-spice で資源の整合性を自己点検
・README.md は GitHub 上でプレビューしながら編集した方が楽かも(改修履歴の記載など)
・fetch でリモートリポジトリの最新情報を取得

$ git fetch
remote: Enumerating objects: 1471, done.
remote: Counting objects: 100% (422/422), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 1471 (delta 415), reused 414 (delta 414), pack-reused 1049
Receiving objects: 100% (1471/1471), 1.53 MiB | 2.56 MiB/s, done.
Resolving deltas: 100% (855/855), completed with 183 local objects.
From https://github.com/xxxxxxxx/cinnamon-spices-applets
 * [new branch]        appsys                                   -> origin/appsys
 * [new branch]        ci                                       -> origin/ci
 * [new branch]        clefebvre-patch-1                        -> origin/clefebvre-patch-1
   nnnnnnnn..nnnnnnnn  master                                   -> origin/master
 * [new branch]        old-unpopular-umaintained-applet-removal -> origin/old-unpopular-umaintained-applet-removal
 * [new branch]        patch-1                                  -> origin/patch-1
 * [new branch]        translation-status-tables                -> origin/translation-status-tables

・pull でローカルコピーを最新化

$ git pull origin master
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
From https://github.com/xxxxxxxx/cinnamon-spices-applets
 * branch              master     -> FETCH_HEAD
Updating nnnnnnnn..nnnnnnnn
Fast-forward
 xxxxxxxxxxxxxx@yyyyyyyy/README.md      |  19 +++++++++++++++++++
 xxxxxxxxxxxxxx@yyyyyyyy/screenshot.png | Bin 183497 -> 101214 bytes
 2 files changed, 19 insertions(+)

Web 上で 2つのファイルを更新(commit) していたので、それらがローカルにコピーされた


・status でローカルの未コミット状況を確認

$ git status
On branch master
You are in a sparse checkout with 1% of tracked files present.

Changes not staged for commit:
  (use "git add  <file> ..." to update what will be committed)
  (use "git restore  <file> ..." to discard changes in working directory)
	modified:   xxxxxxxxxxxxxx@yyyyyyyy/files/xxxxxxxxxxxxxx@yyyyyyyy/3.4/applet.js
	modified:   xxxxxxxxxxxxxx@yyyyyyyy/files/xxxxxxxxxxxxxx@yyyyyyyy/metadata.json

no changes added to commit (use "git add" and/or "git commit -a")

applet.js と metadata.json は確かにローカルで修正しているので正しく検知されている。 


・add でコミットするためのステージエリアに配置

$ git add -u

先ほどの 2つのファイル(modified と表示されているもの)がステージエリアに配置される。特にコマンドの実行結果は(さびしいけど)応答されない。

 

・status で add の結果を確認

$ git status
On branch master
You are in a sparse checkout with 1% of tracked files present.

Changes to be committed:
  (use "git restore --staged <file≷..." to unstage)
	modified:   xxxxxxxxxxxxxx@yyyyyyyy/files/xxxxxxxxxxxxxx@yyyyyyyy/3.4/applet.js
	modified:   xxxxxxxxxxxxxx@yyyyyyyy/files/xxxxxxxxxxxxxx@yyyyyyyy/metadata.json

はい、ステージエリアに配置されました。

 

・commit 発行

$ git commit
[master nnnnnnnn] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 2 files changed, 2 insertions(+), 1 deletion(-)

端末内にエディタが起動されるのでコミット用のコメントを記載して保存まで完了するとこんな応答メッセージが出力される。

 

・push するための access token を取得(以前に取得したものの有効期限が切れていれば)

久しぶりのコミットなので当然にトークンは期限切れです。こちらを参考にトークンを再発行しましょう。

GitHubにPushできない!?GitHubアクセストークン作成を画像で分かりやすく解説

今はトークン作成方法として Fine-grained token(beta) と Tokens (classic) の 2種類が選べるようになっていましたが、今回は Tokens (classic) で作成しました。
※2023年 6月時点

 

・push でローカルからリモートリポジトリに反映

$ git push origin master
Username for 'https://github.com': xxxxxxxx
Password for 'https://xxxxxxxx@github.com': 
Enumerating objects: 14, done.
Counting objects: 100% (14/14), done.
Delta compression using up to 12 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 847 bytes | 847.00 KiB/s, done.
Total 8 (delta 4), reused 1 (delta 1), pack-reused 0
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To https://github.com/xxxxxxxx/cinnamon-spices-applets.git
   nnnnnnnn..nnnnnnnn  master -> master

「Password for」には GitHub のパスワードではなく、先ほど用意した access token の値を入力します。

 

・GitHub 上で pull request を発行

pull request を作成する際に title の入力が必要ですが、慣習として?アプレットやデスクレットの UUID を文頭に差し込むようです。

メモにはメンテナーの人が修正内容を把握しやすいように親切に記載した方が良さそうです。

右側の「contribute」ボタンを押す

 
緑色の「Create pull request」ボタンを押す