From 39b68843d4f3259789427995487b3c89809ea8f0 Mon Sep 17 00:00:00 2001 From: Patrick Honkonen Date: Tue, 13 Aug 2024 15:06:51 -0400 Subject: [PATCH] [PM-7276] Setup Bitwarden F-Droid repo --- .github/qrcode.png | Bin 0 -> 1473 bytes .github/workflows/fdroid.yml | 90 +++++ .gitignore | 16 + .thirdparty_licenses/xarantolus-LICENSE | 21 + README.md | 29 +- apps.yaml | 16 + fdroid/repo/categories.txt | 2 + fdroid/repo/icons/fdroid-icon.png | Bin 0 -> 1362 bytes fdroid/repo/icons/icon.png | Bin 0 -> 1362 bytes fdroid/repo/index.png | Bin 0 -> 1473 bytes metascoop/apps/apps.go | 80 ++++ metascoop/apps/index.go | 107 +++++ metascoop/apps/info.go | 81 ++++ metascoop/apps/meta.go | 40 ++ metascoop/apps/repo.go | 30 ++ metascoop/apps/screenshots.go | 45 +++ metascoop/apps_test.go | 18 + metascoop/file/file.go | 50 +++ metascoop/git/clone.go | 22 ++ metascoop/git/files.go | 22 ++ metascoop/go.mod | 23 ++ metascoop/go.sum | 402 +++++++++++++++++++ metascoop/main.go | 499 ++++++++++++++++++++++++ metascoop/md/generate_table.go | 58 +++ update.sh | 35 ++ 25 files changed, 1684 insertions(+), 2 deletions(-) create mode 100644 .github/qrcode.png create mode 100644 .github/workflows/fdroid.yml create mode 100644 .thirdparty_licenses/xarantolus-LICENSE create mode 100644 apps.yaml create mode 100644 fdroid/repo/categories.txt create mode 100644 fdroid/repo/icons/fdroid-icon.png create mode 100644 fdroid/repo/icons/icon.png create mode 100644 fdroid/repo/index.png create mode 100644 metascoop/apps/apps.go create mode 100644 metascoop/apps/index.go create mode 100644 metascoop/apps/info.go create mode 100644 metascoop/apps/meta.go create mode 100644 metascoop/apps/repo.go create mode 100644 metascoop/apps/screenshots.go create mode 100644 metascoop/apps_test.go create mode 100644 metascoop/file/file.go create mode 100644 metascoop/git/clone.go create mode 100644 metascoop/git/files.go create mode 100644 metascoop/go.mod create mode 100644 metascoop/go.sum create mode 100644 metascoop/main.go create mode 100644 metascoop/md/generate_table.go create mode 100755 update.sh diff --git a/.github/qrcode.png b/.github/qrcode.png new file mode 100644 index 0000000000000000000000000000000000000000..f338367a5f292623657afbf52644759d3a32b0f4 GIT binary patch literal 1473 zcmV;y1wQ(TP) zQI6|23`H+11NoGJSwNN|@1RR6W=U@c_EKg61IV8P$Y4JtO7djz`iewR*+>lMTo!pVSnNZlAr-W*|I+kgb3*B6970hsU#JZ zp=bS%mQB!rpseueCV*mpNq~=#5N9ZGOb9<_2;h|hv*Ho+=%{*$uAXr=L1Tixu83NFIxQnj=vK9LV_7^#P|qf4 zNYG839kiKp@4ZbbsZ)HvjHG1~G#JQ&37<+~YW~(-c=g%vb@2%Fp$nrCf(8WT6{Li> z2?``gh)@8>WK#Aq>9*t=5f%7%DcaxulCaIrY|ahJT!|c?~oaD9SIdq|A6Eqg6uk~wDb9UU(b=mb|{IQCFZ89yJ zpix0Nb-rCyOQll@vBmBtUJR$5H0Q1ic`|)AK?8zr z>qhh@vEI_|CI`AMSIHG5K_h~CpA7&_(rcY`%8jZHw#oF_1dR&nR*+UBQg%OfHs0Nh zZHIz8Rd0{?Y6Lwss0!Gw3Lnk9VS8%6tQP6x5?VGvgMlnlV>!s;fqkEO?25kS{T2UhymwQKO)yH3!UpwkM{7hNyk=r%+8;=S8P zYtq0to1hUvU8bh>gTKi#M)c80S7g$Rf4o;C=&3=cj+GWVcVcyQ;U@Tfy1_V`pfN#x zw}tGf)v}CrvwA0Vw}7RJ+Vt53jR-pT^{XuxA}kFPfvy=E{JCy~{YD5H6m;^%Ew=D2 zUDKymb0nn_t_0z&M+rF+rs(1K<*{zoguiA?P8c z&EH<{;t+(lDM^SktexM%zJ3G^3Hp5I!Ko_SJau2(*IJ;lKAWK7LG27*gf|fcP5CHD zgb2ujy4l7jV4Iz`&AqZb;)w_%=$oUh46PQss(BIU^6ah4NbOU}&hP{c52^>wY%?Gt zm)gj$o>OC;8f5XR<%~$i*#!M}Ku%TTAtm1Ms{P(|0Qx!~(nOPg;E4z#=x>jk)2X-R z5CASoIsNn{3E+wtvRyT|w*-8e1U{xVQkL{}VwZ3gsJ zE~@J;j7A6=67-WZd~=-b%hIyTORiNV;R=$VQ9+`AJ?B@(Hr}fdL=Zs)5kwF{1QA5g bzXtjf`$ZGiX=jH*00000NkvXXu0mjf*MhN` literal 0 HcmV?d00001 diff --git a/.github/workflows/fdroid.yml b/.github/workflows/fdroid.yml new file mode 100644 index 0000000..812aa07 --- /dev/null +++ b/.github/workflows/fdroid.yml @@ -0,0 +1,90 @@ +name: Generate F-Droid repo + +on: + push: + branches: [ main ] + workflow_dispatch: + schedule: + - cron: "45 2 * * *" + +jobs: + apps: + name: "Generate repo from apps listing" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Create basic directory structure + run: mkdir -p fdroid/repo + + - name: Restore correct mtime + run: | + sudo apt install git-restore-mtime + git restore-mtime + + - name: Install F-Droid server software + run: | + sudo add-apt-repository ppa:fdroid/fdroidserver + sudo apt-get update + sudo apt-get install fdroidserver + + - name: Set up Git credentials + env: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + run: | + git config --global credential.helper store + echo "https://${ACCESS_TOKEN}:x-oauth-basic@github.com" >> ~/.git-credentials + git config --global user.email "ci@bitwarden.com" + git config --global user.name "Bitwarden CI" + + - name: Login to Azure - CI Subscription + uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 + with: + cred: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} + + - name: Retrieve secrets + id: retrieve-secrets + uses: bitwarden/gh-action/get-keyvault-secrets@main + with: + keyvault: "bitwarden-ci" + secrets: "github-gpg-private-key, + github-gpg-private-key-passphrase, + github-pat-bitwarden-devops-mobile-fdroid" + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0 + with: + gpg_private_key: ${{ steps.retrive-secrets.outputs.github-gpg-private-key }} + passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }} + git_user_signingkey: true + git_commit_gpgsign: true + + - name: Download secrets + env: + ACCOUNT_NAME: bitwardenci + CONTAINER_NAME: mobile + run: | + mkdir -p $HOME/secrets + az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \ + --name store_fdroid-keystore.jks fdroid/keystore.p12 --output none + + - name: Configure F-Droid server + env: + FDROID_STORE_KEYSTORE_PASSWORD: ${{ secrets.FDROID_STORE_KEYSTORE_PASSWORD }} + run: | + chmod 600 fdroid/config.yml + echo "keypass: $FDROID_STORE_KEYSTORE_PASSWORD" >> fdroid/config.yml + echo "keystorepass: $FDROID_STORE_KEYSTORE_PASSWORD" >> fdroid/config.yml + echo "archive_older: 0" >> fdroid/config.yml + echo "repo_url: https://raw.githubusercontent.com/bitwarden/fdroid/main/fdroid/repo" >> fdroid/config.yml + + - name: Set up Go + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + with: + go-version: '^1.17.0' + + - name: Run update script + run: bash update.sh 2>&1 + env: + GH_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} diff --git a/.gitignore b/.gitignore index 4f42dd7..96f690c 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,19 @@ Thumbs.db # Node node_modules npm-debug.log + +# Secrets +config.yml +keystore.p12 +keystore.jks + +# F-Droid tools +fdroid/tmp +fdroid/repo/status +fdroid/metadata/**/phoneScreenshots + +# Metascoop +metascoop/metascoop +config.py +out.txt +**.tmp diff --git a/.thirdparty_licenses/xarantolus-LICENSE b/.thirdparty_licenses/xarantolus-LICENSE new file mode 100644 index 0000000..86ea801 --- /dev/null +++ b/.thirdparty_licenses/xarantolus-LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 xarantolus + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index bf008bf..231333a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,28 @@ -# Template Repository +# fdroid +This repository hosts an [F-Droid](https://f-droid.org/) repo for Bitwarden apps. This allows you to install and update Bitwarden apps very easily. -This repository serves as a template for others and establishes very basic structure and tooling setup for later customization. +### Bitwarden Apps + + +| Icon | Name | Description | Version | +|------|------|-------------|---------| + + +### How to use +1. At first, you should [install the F-Droid app](https://f-droid.org/), it's an alternative app store for Android. +2. Now you can copy the following [link](https://raw.githubusercontent.com/bitwatrden/fdroid/main/fdroid/repo?fingerprint={fingerprint-hash}), then add this repository to your F-Droid client: + + ``` + https://raw.githubusercontent.com/bitwarden/fdroid/main/fdroid/repo?fingerprint={fingerprint-hash} + ``` + + Alternatively, you can also scan this QR code: + +

+ F-Droid repo QR code +

+ +3. Open the link in F-Droid. It will ask you to add the repository. Everything should already be filled in correctly, so just press "OK". +4. You can now install Bitwarden apps, e.g. start by searching for "Bitwarden" in the F-Droid client. + +Please note that some apps published here might contain [Anti-Features](https://f-droid.org/en/docs/Anti-Features/). If you can't find an app by searching for it, you can go to settings and enable "Include anti-feature apps". diff --git a/apps.yaml b/apps.yaml new file mode 100644 index 0000000..b804fed --- /dev/null +++ b/apps.yaml @@ -0,0 +1,16 @@ +bitwarden: + git: https://github.com/bitwarden/android + name: "Bitwarden" + description: | + This repo has the new native Android app, currently in Beta. Looking for the legacy .NET MAUI apps? Head on over to bitwarden/mobile. + categories: + - Security + +bitwarden-beta: + git: https://github.com/bitwarden/android + name: "Bitwarden Beta" + prerelease: true + description: | + This repo has the new native Android app. Looking for the legacy .NET MAUI apps? Head on over to bitwarden/mobile. + categories: + - Security diff --git a/fdroid/repo/categories.txt b/fdroid/repo/categories.txt new file mode 100644 index 0000000..1db5202 --- /dev/null +++ b/fdroid/repo/categories.txt @@ -0,0 +1,2 @@ +Security +fdroid diff --git a/fdroid/repo/icons/fdroid-icon.png b/fdroid/repo/icons/fdroid-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b4ee70b7436af4b928199b51c60985c597e9b9c0 GIT binary patch literal 1362 zcmV-Y1+DstP)x)8L zD1sF+0nyT`rBYLj;H4mKQKL=8)^yTbnr1SYOlHny`7o17CYekUC&^5q3ufjpd!KXu zf3LOvz4qR4(~4`7x3y6%`r4$Z2Vw^re-xXt0|db&V$F!-B|*FHBbMsTnSZS zsTKveFCrvkSDNM8WNf)ZDBWT8u5e`#kG-qPPDGuej=qX3=;x-g`lax})gzNh*g1)h z484a~&x3*%JAM>}7u?8I2iP@z5;v+vtN5#*ICHCS*Zhu39jZx;v5Ut-AP78+38@$B z4+hR}?mzKV_ZZe}52V$`jSkex(i%qqjM!)~lUY+309A1UFIEe5PgKS!;4~NzL6lOo zU}TDN)f-RKRW_9lHKqG>_Tp?Uuv^_iB&L&YePOggWlp2xMNj_lW(r2%qcuw z60Y*-o=!S@&Ekd7%4PPvfCngZgu04BG#Opo5Soo0{b`sle;&@+wsB2}mv=79XrCYN z#S%fB>e3-_q1)x_GqId)1H-|TqQH;$W5KLRl#B|ANQ#681fv6}8@oYeRMI38*Jnkd zga`2`^sU9GDA%40t4y6G37SlV{~?O349P;3W-OeS*Xw8jO~{2QuS120lYX z(L@B2$r2|ZlAX-st^ouWw}c5y0Y4T>20>7f(#wI6onv)7DGy|_XXcB*K-4do!0juX z3D0w906)(j=nN;ho>dCW%_>5|_RW<5L}DHny5jl4%RGA^=_$w04F9kF3IVp?TgAh7 zSE35Xe(WddX&&%0{~iE1d@{n|us>(;TQ-#QTGKMh9U&6)ICw0a1AHoh5tD{#=AS@E zSCS8o52ict8++t%7;g<(9sn~#2{iOfR`)@Wua8)(1{2w?NR(7 zKMC6sc05?kf!+12uXpeRrKPQh1INR8LMDBkCxi-~2V7s-d!!H7^>}hyEsj0)MYYuy zuRp$=oex#xSb`rYAAft5eINZp!qxoXGxBP17OIp;xUlz=0Xn+k>}jg!ma6f`Hf*Zk znMamn7XQ%^pLagH%;9gk2?AybKAjsmD9qbT9H?;Qbewa4Ut~|y3L5UI1>k`V<(WR; zpC9C{PcLz{GluFk;3rk1W8ih6LMVIZOgMYl;@SO|cx+2AyLYT*<84*^`R@paz6$fj z5B&_sgX|eMR|PtGxFXBxFIW2feEiol6rFm4y zo@QxL*ygSX;w+&r7Nz%GWQNIUnt0DaPQ=m~38-fqMMWrZ&qo9kszD*OEG!6os$H$A zvOi9sZmR-lGCVA7@)3LNaG`($4nfLlz!=mU%~@^E2wv4gOb7}5Al?(3ej;lXpJp`! zZ7=rw!&gob_+YG1s*fq)V;OO3jM$Y1vBv+Gv34G-c+orgv9)bl<(t{Dgdns-#N`HBN*w4kA~YX0#|9) zME+yei6mN^Y<_EX^1oqG%x6=hOJj>S8T|AF#%$|%HqpO|d)!oWr%sIdn^tP}AEFuR UFWS(!NB{r;07*qoM6N<$f^YSECjbBd literal 0 HcmV?d00001 diff --git a/fdroid/repo/icons/icon.png b/fdroid/repo/icons/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b4ee70b7436af4b928199b51c60985c597e9b9c0 GIT binary patch literal 1362 zcmV-Y1+DstP)x)8L zD1sF+0nyT`rBYLj;H4mKQKL=8)^yTbnr1SYOlHny`7o17CYekUC&^5q3ufjpd!KXu zf3LOvz4qR4(~4`7x3y6%`r4$Z2Vw^re-xXt0|db&V$F!-B|*FHBbMsTnSZS zsTKveFCrvkSDNM8WNf)ZDBWT8u5e`#kG-qPPDGuej=qX3=;x-g`lax})gzNh*g1)h z484a~&x3*%JAM>}7u?8I2iP@z5;v+vtN5#*ICHCS*Zhu39jZx;v5Ut-AP78+38@$B z4+hR}?mzKV_ZZe}52V$`jSkex(i%qqjM!)~lUY+309A1UFIEe5PgKS!;4~NzL6lOo zU}TDN)f-RKRW_9lHKqG>_Tp?Uuv^_iB&L&YePOggWlp2xMNj_lW(r2%qcuw z60Y*-o=!S@&Ekd7%4PPvfCngZgu04BG#Opo5Soo0{b`sle;&@+wsB2}mv=79XrCYN z#S%fB>e3-_q1)x_GqId)1H-|TqQH;$W5KLRl#B|ANQ#681fv6}8@oYeRMI38*Jnkd zga`2`^sU9GDA%40t4y6G37SlV{~?O349P;3W-OeS*Xw8jO~{2QuS120lYX z(L@B2$r2|ZlAX-st^ouWw}c5y0Y4T>20>7f(#wI6onv)7DGy|_XXcB*K-4do!0juX z3D0w906)(j=nN;ho>dCW%_>5|_RW<5L}DHny5jl4%RGA^=_$w04F9kF3IVp?TgAh7 zSE35Xe(WddX&&%0{~iE1d@{n|us>(;TQ-#QTGKMh9U&6)ICw0a1AHoh5tD{#=AS@E zSCS8o52ict8++t%7;g<(9sn~#2{iOfR`)@Wua8)(1{2w?NR(7 zKMC6sc05?kf!+12uXpeRrKPQh1INR8LMDBkCxi-~2V7s-d!!H7^>}hyEsj0)MYYuy zuRp$=oex#xSb`rYAAft5eINZp!qxoXGxBP17OIp;xUlz=0Xn+k>}jg!ma6f`Hf*Zk znMamn7XQ%^pLagH%;9gk2?AybKAjsmD9qbT9H?;Qbewa4Ut~|y3L5UI1>k`V<(WR; zpC9C{PcLz{GluFk;3rk1W8ih6LMVIZOgMYl;@SO|cx+2AyLYT*<84*^`R@paz6$fj z5B&_sgX|eMR|PtGxFXBxFIW2feEiol6rFm4y zo@QxL*ygSX;w+&r7Nz%GWQNIUnt0DaPQ=m~38-fqMMWrZ&qo9kszD*OEG!6os$H$A zvOi9sZmR-lGCVA7@)3LNaG`($4nfLlz!=mU%~@^E2wv4gOb7}5Al?(3ej;lXpJp`! zZ7=rw!&gob_+YG1s*fq)V;OO3jM$Y1vBv+Gv34G-c+orgv9)bl<(t{Dgdns-#N`HBN*w4kA~YX0#|9) zME+yei6mN^Y<_EX^1oqG%x6=hOJj>S8T|AF#%$|%HqpO|d)!oWr%sIdn^tP}AEFuR UFWS(!NB{r;07*qoM6N<$f^YSECjbBd literal 0 HcmV?d00001 diff --git a/fdroid/repo/index.png b/fdroid/repo/index.png new file mode 100644 index 0000000000000000000000000000000000000000..f338367a5f292623657afbf52644759d3a32b0f4 GIT binary patch literal 1473 zcmV;y1wQ(TP) zQI6|23`H+11NoGJSwNN|@1RR6W=U@c_EKg61IV8P$Y4JtO7djz`iewR*+>lMTo!pVSnNZlAr-W*|I+kgb3*B6970hsU#JZ zp=bS%mQB!rpseueCV*mpNq~=#5N9ZGOb9<_2;h|hv*Ho+=%{*$uAXr=L1Tixu83NFIxQnj=vK9LV_7^#P|qf4 zNYG839kiKp@4ZbbsZ)HvjHG1~G#JQ&37<+~YW~(-c=g%vb@2%Fp$nrCf(8WT6{Li> z2?``gh)@8>WK#Aq>9*t=5f%7%DcaxulCaIrY|ahJT!|c?~oaD9SIdq|A6Eqg6uk~wDb9UU(b=mb|{IQCFZ89yJ zpix0Nb-rCyOQll@vBmBtUJR$5H0Q1ic`|)AK?8zr z>qhh@vEI_|CI`AMSIHG5K_h~CpA7&_(rcY`%8jZHw#oF_1dR&nR*+UBQg%OfHs0Nh zZHIz8Rd0{?Y6Lwss0!Gw3Lnk9VS8%6tQP6x5?VGvgMlnlV>!s;fqkEO?25kS{T2UhymwQKO)yH3!UpwkM{7hNyk=r%+8;=S8P zYtq0to1hUvU8bh>gTKi#M)c80S7g$Rf4o;C=&3=cj+GWVcVcyQ;U@Tfy1_V`pfN#x zw}tGf)v}CrvwA0Vw}7RJ+Vt53jR-pT^{XuxA}kFPfvy=E{JCy~{YD5H6m;^%Ew=D2 zUDKymb0nn_t_0z&M+rF+rs(1K<*{zoguiA?P8c z&EH<{;t+(lDM^SktexM%zJ3G^3Hp5I!Ko_SJau2(*IJ;lKAWK7LG27*gf|fcP5CHD zgb2ujy4l7jV4Iz`&AqZb;)w_%=$oUh46PQss(BIU^6ah4NbOU}&hP{c52^>wY%?Gt zm)gj$o>OC;8f5XR<%~$i*#!M}Ku%TTAtm1Ms{P(|0Qx!~(nOPg;E4z#=x>jk)2X-R z5CASoIsNn{3E+wtvRyT|w*-8e1U{xVQkL{}VwZ3gsJ zE~@J;j7A6=67-WZd~=-b%hIyTORiNV;R=$VQ9+`AJ?B@(Hr}fdL=Zs)5kwF{1QA5g bzXtjf`$ZGiX=jH*00000NkvXXu0mjf*MhN` literal 0 HcmV?d00001 diff --git a/metascoop/apps/apps.go b/metascoop/apps/apps.go new file mode 100644 index 0000000..5cf8962 --- /dev/null +++ b/metascoop/apps/apps.go @@ -0,0 +1,80 @@ +package apps + +import ( + "fmt" + "net/url" + "os" + "strings" + + "gopkg.in/yaml.v3" +) + +type AppInfo struct { + GitURL string `yaml:"git"` + Summary string `yaml:"summary"` + + AuthorName string `yaml:"author"` + repoAuthor string + + FriendlyName string `yaml:"name"` + keyName string + + Description string `yaml:"description"` + + Categories []string `yaml:"categories"` + + AntiFeatures []string `yaml:"anti_features"` + + ReleaseDescription string + + License string + + Prerelease bool `yaml:"prerelease"` +} + +func (a AppInfo) Name() string { + return a.keyName +} + +func (a AppInfo) Author() string { + if a.AuthorName != "" { + return a.AuthorName + } + return a.repoAuthor +} + +// ParseAppFile returns the list of apps from the app file +func ParseAppFile(filepath string) (list []AppInfo, err error) { + f, err := os.Open(filepath) + if err != nil { + return + } + defer f.Close() + + var apps map[string]AppInfo + + err = yaml.NewDecoder(f).Decode(&apps) + if err != nil { + return + } + + for k, a := range apps { + a.keyName = k + + u, uerr := url.ParseRequestURI(a.GitURL) + if uerr != nil { + err = fmt.Errorf("problem with given git URL %q for app with key=%q, name=%q: %w", a.GitURL, k, a.Name(), uerr) + return + } + + split := strings.Split(strings.Trim(u.Path, "/"), "/") + if len(split) == 0 { + return + } + a.repoAuthor = split[0] + + list = append(list, a) + } + + return +} diff --git a/metascoop/apps/index.go b/metascoop/apps/index.go new file mode 100644 index 0000000..b51094b --- /dev/null +++ b/metascoop/apps/index.go @@ -0,0 +1,107 @@ +package apps + +import ( + "encoding/json" + "os" + "reflect" + "sort" + "strings" + + "github.com/hashicorp/go-version" + "github.com/r3labs/diff/v2" +) + +type RepoIndex struct { + Repo map[string]interface{} `json:"repo"` + Requests map[string]interface{} `json:"requests"` + Apps []map[string]interface{} `json:"apps"` + + Packages map[string][]PackageInfo `json:"packages"` +} + +type PackageInfo struct { + Added int64 `json:"added"` + ApkName string `json:"apkName"` + Hash string `json:"hash"` + HashType string `json:"hashType"` + MinSdkVersion int `json:"minSdkVersion"` + Nativecode []string `json:"nativecode"` + PackageName string `json:"packageName"` + Sig string `json:"sig"` + Signer string `json:"signer"` + Size int `json:"size"` + TargetSdkVersion int `json:"targetSdkVersion"` + VersionCode int `json:"versionCode,omitempty"` + VersionName string `json:"versionName"` +} + +func (r *RepoIndex) FindLatestPackage(pkgName string) (p PackageInfo, ok bool) { + pkgs, ok := r.Packages[pkgName] + if !ok { + return p, false + } + + sort.Slice(pkgs, func(i, j int) bool { + if pkgs[i].VersionCode != pkgs[j].VersionCode { + return pkgs[i].VersionCode < pkgs[j].VersionCode + } + + v1, err := version.NewVersion(pkgs[i].VersionName) + if err != nil { + return true + } + + v2, err := version.NewVersion(pkgs[i].VersionName) + if err != nil { + return false + } + + return v1.LessThan(v2) + }) + + // Return the one with the latest version + return pkgs[len(pkgs)-1], true +} + +func ReadIndex(path string) (index *RepoIndex, err error) { + f, err := os.Open(path) + if err != nil { + return + } + defer f.Close() + + err = json.NewDecoder(f).Decode(&index) + + return +} + +func HasSignificantChanges(old, new *RepoIndex) (changedPath string, changed bool) { + changelog, err := diff.Diff(old, new) + if err != nil { + panic("diffing fdroid index structs: " + err.Error()) + } + + for _, change := range changelog { + if change.Type != diff.UPDATE { + return strings.Join(change.Path, "."), true + } + + var isIgnoredChange = false + + // Fdroid seems to update the "added" timestamp of apps every time we run the command + if len(change.Path) > 0 && (strings.EqualFold(change.Path[len(change.Path)-1], "added") || strings.EqualFold(change.Path[len(change.Path)-1], "lastUpdated")) { + isIgnoredChange = true + } + + // Also it updates the repo timestamp + if reflect.DeepEqual(change.Path, []string{"Repo", "timestamp"}) { + isIgnoredChange = true + } + + if !isIgnoredChange { + return strings.Join(change.Path, "."), true + } + } + + return "", false +} diff --git a/metascoop/apps/info.go b/metascoop/apps/info.go new file mode 100644 index 0000000..1d68013 --- /dev/null +++ b/metascoop/apps/info.go @@ -0,0 +1,81 @@ +package apps + +import ( + "context" + "fmt" + "strings" + "unicode" + + "github.com/google/go-github/v39/github" + "golang.org/x/text/runes" + "golang.org/x/text/transform" + "golang.org/x/text/unicode/norm" +) + +func FindAPKRelease(release *github.RepositoryRelease) *github.ReleaseAsset { + return FindAPK(release, "fdroid.apk") +} + +func FindAPKBeta(release* github.RepositoryRelease) *github.ReleaseAsset { + return FindAPK(release, "-fdroid-beta.apk") +} + +func FindAPK(release* github.RepositoryRelease, suffix string) *github.ReleaseAsset { + for _, asset := range release.Assets { + if asset.State == nil || *asset.State != "uploaded" { + continue + } + + if asset.Name != nil && strings.HasSuffix(*asset.Name, suffix) { + return asset + } + } + + return nil +} + +func GenerateReleaseFilename(appName string, tagName string) string { + var normalName = fmt.Sprintf("%s_%s.apk", appName, tagName) + + var tc = transform.Chain(norm.NFD, runes.Remove(runes.Predicate(func(r rune) bool { + return unicode.Is(unicode.Mn, r) + })), norm.NFC) + + cleaned, _, err := transform.String(tc, normalName) + if err != nil { + cleaned = normalName + } + + return strings.Map(func(r rune) rune { + if unicode.IsSpace(r) { + return '_' + } + if r >= 'a' && r <= 'z' || r >= 'A' && r <= 'Z' || r >= '0' && r <= '9' { + return r + } + if r == '_' || r == '-' || r == '.' { + return r + } + return -1 + }, cleaned) +} + +func ListAllReleases(githubClient *github.Client, appRepoAuthor, appRepoName string) (allReleases []*github.RepositoryRelease, err error) { + var currentPage int = 1 + + for { + rels, _, ierr := githubClient.Repositories.ListReleases(context.Background(), appRepoAuthor, appRepoName, &github.ListOptions{ + Page: currentPage, + PerPage: 100, + }) + if ierr != nil || len(rels) == 0 { + err = ierr + break + } + + allReleases = append(allReleases, rels...) + currentPage++ + } + + return +} diff --git a/metascoop/apps/meta.go b/metascoop/apps/meta.go new file mode 100644 index 0000000..e24fe20 --- /dev/null +++ b/metascoop/apps/meta.go @@ -0,0 +1,40 @@ +package apps + +import ( + "os" + + "gopkg.in/yaml.v3" +) + +func ReadMetaFile(path string) (d map[string]interface{}, err error) { + f, err := os.Open(path) + if err != nil { + return + } + defer f.Close() + + err = yaml.NewDecoder(f).Decode(&d) + + return +} + +func WriteMetaFile(path string, data map[string]interface{}) (err error) { + tmpPath := path + ".tmp" + f, err := os.Create(tmpPath) + if err != nil { + return + } + + err = yaml.NewEncoder(f).Encode(data) + if err != nil { + _ = f.Close() + return + } + + err = f.Close() + if err != nil { + return + } + + return os.Rename(tmpPath, path) +} diff --git a/metascoop/apps/repo.go b/metascoop/apps/repo.go new file mode 100644 index 0000000..981798d --- /dev/null +++ b/metascoop/apps/repo.go @@ -0,0 +1,30 @@ +package apps + +import ( + "net/url" + "strings" +) + +type Repo struct { + Author string + Name string + Host string +} + +func RepoInfo(repoURL string) (r Repo, err error) { + u, uerr := url.ParseRequestURI(repoURL) + if uerr != nil { + return + } + + split := strings.Split(strings.Trim(u.Path, "/"), "/") + if len(split) < 2 { + return + } + + r.Author = split[0] + r.Name = split[1] + r.Host = strings.TrimPrefix(u.Host, "www.") + + return +} diff --git a/metascoop/apps/screenshots.go b/metascoop/apps/screenshots.go new file mode 100644 index 0000000..a92768b --- /dev/null +++ b/metascoop/apps/screenshots.go @@ -0,0 +1,45 @@ +package apps + +import ( + "io/fs" + "path/filepath" + "strings" +) + +type RepoMetadata struct { + Screenshots []string +} + +var imageSuffixes = map[string]bool{ + "png": true, + "jpg": true, + "jpeg": true, +} + +func hasImageSuffix(path string) bool { + return imageSuffixes[strings.TrimPrefix(filepath.Ext(path), ".")] +} + +func FindMetadata(clonedRepoPath string) (r RepoMetadata, err error) { + abs, err := filepath.Abs(clonedRepoPath) + if err != nil { + return + } + + err = filepath.WalkDir(abs, func(path string, d fs.DirEntry, err error) error { + if err != nil || d.IsDir() { + return err + } + + lp := strings.ToLower(path) + + if strings.Contains(lp, "screenshot") && hasImageSuffix(path) { + r.Screenshots = append(r.Screenshots, path) + return nil + } + + return nil + }) + + return +} diff --git a/metascoop/apps_test.go b/metascoop/apps_test.go new file mode 100644 index 0000000..f979578 --- /dev/null +++ b/metascoop/apps_test.go @@ -0,0 +1,18 @@ +package main + +import ( + "testing" + + "metascoop/apps" +) + +func TestAppsFile(t *testing.T) { + appsList, err := apps.ParseAppFile("../apps.yaml") + if err != nil { + t.Errorf("error parsing apps file: %s", err.Error()) + } + + if len(appsList) == 0 { + t.Errorf("the app list is empty, wanted at least one app") + } +} diff --git a/metascoop/file/file.go b/metascoop/file/file.go new file mode 100644 index 0000000..6975549 --- /dev/null +++ b/metascoop/file/file.go @@ -0,0 +1,50 @@ +package file + +import ( + "io" + "os" +) + +// Move moves a file from oldpath to newpath +func Move(oldpath, newpath string) (err error) { + // Try the normal method using rename + err = os.Rename(oldpath, newpath) + if err == nil { + return + } + + // This part is reached either on permission errors + // OR when it's not possible to move files between drives (especially on windows). + // To fix it, we copy the file without renaming it + + // Basically open the old file, create the new file and copy the contents. + srcFile, err := os.Open(oldpath) + if err != nil { + return + } + + destFile, err := os.Create(newpath) + if err != nil { + _ = srcFile.Close() + return + } + + _, err = io.Copy(destFile, srcFile) + + _ = srcFile.Close() + + if err != nil { + // Clean up newly created file + _ = destFile.Close() + _ = os.Remove(newpath) + return + } + + err = destFile.Close() + if err != nil { + return + } + + // Now that we know that the destination file was created, we can remove the old path + return os.Remove(oldpath) +} diff --git a/metascoop/git/clone.go b/metascoop/git/clone.go new file mode 100644 index 0000000..2dd3ab1 --- /dev/null +++ b/metascoop/git/clone.go @@ -0,0 +1,22 @@ +package git + +import ( + "os" + "os/exec" +) + +func CloneRepo(gitUrl string) (dirPath string, err error) { + dirPath, err = os.MkdirTemp("", "git-*") + if err != nil { + return + } + + cloneCmd := exec.Command("git", "clone", gitUrl, dirPath) + err = cloneCmd.Run() + if err != nil { + _ = os.RemoveAll(dirPath) + return + } + + return +} diff --git a/metascoop/git/files.go b/metascoop/git/files.go new file mode 100644 index 0000000..cc667a0 --- /dev/null +++ b/metascoop/git/files.go @@ -0,0 +1,22 @@ +package git + +import ( + "fmt" + "os/exec" + "strings" +) + +func GetChangedFileNames(repoPath string) (paths []string, err error) { + cmd := exec.Command("git", "diff", "--name-only") + cmd.Dir = repoPath + + output, err := cmd.Output() + if err != nil { + err = fmt.Errorf("running git: %w\nOutput:\n%s", err, string(output)) + return + } + + paths = strings.Split(strings.TrimSpace(string(output)), "\n") + + return +} diff --git a/metascoop/go.mod b/metascoop/go.mod new file mode 100644 index 0000000..1819202 --- /dev/null +++ b/metascoop/go.mod @@ -0,0 +1,23 @@ +module metascoop + +go 1.17 + +require gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b + +require ( + github.com/google/go-github/v39 v39.1.0 + github.com/hashicorp/go-version v1.3.0 + github.com/r3labs/diff/v2 v2.14.0 + golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 + golang.org/x/text v0.3.7 +) + +require ( + github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-querystring v1.1.0 // indirect + github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect + golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect + golang.org/x/net v0.0.0-20211008194852-3b03d305991f // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/protobuf v1.27.1 // indirect +) diff --git a/metascoop/go.sum b/metascoop/go.sum new file mode 100644 index 0000000..d386877 --- /dev/null +++ b/metascoop/go.sum @@ -0,0 +1,402 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-github/v39 v39.1.0 h1:1vf4gM0D1e+Df2HMxaYC3+o9+Huj3ywGTtWc3VVYaDA= +github.com/google/go-github/v39 v39.1.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw= +github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/r3labs/diff/v2 v2.14.0 h1:VRI8lhKFP4miM+RlyKkdoT94u7RlFge2S+WAqDScV2Q= +github.com/r3labs/diff/v2 v2.14.0/go.mod h1:I8noH9Fc2fjSaMxqF3G2lhDdC0b+JXCfyx85tWFM9kc= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= +github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211008194852-3b03d305991f h1:1scJEYZBaF48BaG6tYbtxmLcXqwYGSfGcMoStTqkkIw= +golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 h1:B333XXssMuKQeBwiNODx4TupZy7bf4sxFZnN2ZOcvUE= +golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/metascoop/main.go b/metascoop/main.go new file mode 100644 index 0000000..aac6a7c --- /dev/null +++ b/metascoop/main.go @@ -0,0 +1,499 @@ +package main + +import ( + "context" + "errors" + "flag" + "fmt" + "io" + "io/fs" + "log" + "net/http" + "os" + "os/exec" + "path/filepath" + "strings" + "time" + + "metascoop/apps" + "metascoop/file" + "metascoop/git" + "metascoop/md" + + "github.com/google/go-github/v39/github" + "golang.org/x/oauth2" +) + +func main() { + var ( + appsFilePath = flag.String("ap", "apps.yaml", "Path to apps.yaml file") + repoDir = flag.String("rd", "fdroid/repo", "Path to fdroid \"repo\" directory") + accessToken = flag.String("pat", "", "GitHub personal access token") + + debugMode = flag.Bool("debug", false, "Debug mode won't run the fdroid command") + ) + flag.Parse() + + fmt.Println("::group::Initializing") + + appsList, err := apps.ParseAppFile(*appsFilePath) + if err != nil { + log.Fatalf("parsing given app file: %s\n", err.Error()) + } + + var authenticatedClient *http.Client = nil + if *accessToken != "" { + ctx := context.Background() + ts := oauth2.StaticTokenSource( + &oauth2.Token{AccessToken: *accessToken}, + ) + authenticatedClient = oauth2.NewClient(ctx, ts) + } + githubClient := github.NewClient(authenticatedClient) + + var haveError bool + + fdroidIndexFilePath := filepath.Join(*repoDir, "index-v1.json") + + initialFdroidIndex, err := apps.ReadIndex(fdroidIndexFilePath) + if err != nil { + log.Fatalf("reading f-droid repo index: %s\n", err.Error()) + } + + err = os.MkdirAll(*repoDir, 0o644) + if err != nil { + log.Fatalf("creating repo directory: %s\n", err.Error()) + } + + fmt.Println("::endgroup::") + + // map[apkName]info + var apkInfoMap = make(map[string]apps.AppInfo) + + for _, app := range appsList { + fmt.Printf("App: %s/%s\n", app.Author(), app.Name()) + + repo, err := apps.RepoInfo(app.GitURL) + if err != nil { + log.Printf("Error while getting repo info from URL %q: %s", app.GitURL, err.Error()) + haveError = true + return + } + + log.Printf("Looking up %s/%s on GitHub", repo.Author, repo.Name) + gitHubRepo, _, err := githubClient.Repositories.Get(context.Background(), repo.Author, repo.Name) + if err != nil { + log.Printf("Error while looking up repo: %s", err.Error()) + } else { + app.Summary = gitHubRepo.GetDescription() + + if gitHubRepo.License != nil && gitHubRepo.License.SPDXID != nil { + app.License = *gitHubRepo.License.SPDXID + } + + log.Printf("Data from GitHub: summary=%q, license=%q", app.Summary, app.License) + } + + releases, err := apps.ListAllReleases(githubClient, repo.Author, repo.Name) + if err != nil { + log.Printf("Error while listing repo releases for %q: %s\n", app.GitURL, err.Error()) + haveError = true + return + } + + log.Printf("Received %d releases", len(releases)) + + for _, release := range releases { + fmt.Printf("::group::Release %s\n", release.GetTagName()) + isReleaseDownloaded := func() bool { + defer fmt.Println("::endgroup::") + + if release.GetDraft() { + log.Printf("Skipping draft %q", release.GetTagName()) + return false + } + if release.GetTagName() == "" { + log.Printf("Skipping release with empty tag name") + return false + } + + log.Printf("Working on release with tag name %q", release.GetTagName()) + var apk *github.ReleaseAsset + + if release.GetPrerelease() { + if !app.Prerelease { + log.Printf("Skipping prerelease build for release application") + return false + } + + log.Printf("Looking for prerelease asset %s", release.GetName()) + apk = apps.FindAPKBeta(release) + } else { + if app.Prerelease { + log.Printf("Skipping release asset for prerelease application") + return false + } + log.Printf("Looking for production asset %s", release.GetName()) + apk = apps.FindAPKRelease(release) + } + + if apk == nil { + log.Printf("Couldn't find any F-Droid assets") + return false + } + + appName := apps.GenerateReleaseFilename(app.Name(), release.GetTagName()) + + log.Printf("Target APK name: %s", appName) + + appClone := app + + appClone.ReleaseDescription = release.GetBody() + if appClone.ReleaseDescription != "" { + log.Printf("Release notes: %s", appClone.ReleaseDescription) + } + + apkInfoMap[appName] = appClone + + appTargetPath := filepath.Join(*repoDir, appName) + + // If the app file already exists for this version, we continue + if _, err := os.Stat(appTargetPath); !errors.Is(err, os.ErrNotExist) { + log.Printf("Already have APK for version %q at %q", release.GetTagName(), appTargetPath) + return true + } + + log.Printf("Downloading APK %q from release %q to %q", apk.GetName(), release.GetTagName(), appTargetPath) + + dlCtx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) + defer cancel() + + appStream, _, err := githubClient.Repositories.DownloadReleaseAsset(dlCtx, repo.Author, repo.Name, apk.GetID(), http.DefaultClient) + if err != nil { + log.Printf("Error while downloading app %q (artifact id %d) from from release %q: %s", app.GitURL, apk.GetID(), release.GetTagName(), err.Error()) + haveError = true + return false + } + + err = downloadStream(appTargetPath, appStream) + if err != nil { + log.Printf("Error while downloading app %q (artifact id %d) from from release %q to %q: %s", app.GitURL, *apk.ID, *release.TagName, appTargetPath, err.Error()) + haveError = true + return false + } + + log.Printf("Successfully downloaded app for version %q", release.GetTagName()) + return true + }() + // Stop after the first [release] of this [app] is downloaded to prevent backfilling legacy releases. + if isReleaseDownloaded { + break + } + } + } + + if !*debugMode { + fmt.Println("::group::F-Droid: Creating metadata stubs") + // Now, we run the fdroid update command + cmd := exec.Command("fdroid", "update", "--pretty", "--create-metadata", "--delete-unknown") + cmd.Stderr = os.Stderr + cmd.Stdout = os.Stdout + cmd.Stdin = os.Stdin + cmd.Dir = filepath.Dir(*repoDir) + + log.Printf("Running %q in %s", cmd.String(), cmd.Dir) + + err = cmd.Run() + + if err != nil { + log.Println("Error while running \"fdroid update -c\":", err.Error()) + + fmt.Println("::endgroup::") + os.Exit(1) + } + fmt.Println("::endgroup::") + } + + fmt.Println("Filling in metadata") + + fdroidIndex, err := apps.ReadIndex(fdroidIndexFilePath) + if err != nil { + log.Fatalf("reading f-droid repo index: %s\n::endgroup::\n", err.Error()) + } + + // directory paths that should be removed after updating metadata + var toRemovePaths []string + + walkPath := filepath.Join(filepath.Dir(*repoDir), "metadata") + err = filepath.WalkDir(walkPath, func(path string, d fs.DirEntry, err error) error { + if err != nil || d.IsDir() || !strings.HasSuffix(path, ".yml") { + return err + } + + pkgname := strings.TrimSuffix(filepath.Base(path), ".yml") + + fmt.Printf("::group::%s\n", pkgname) + + return func() error { + defer fmt.Println("::endgroup::") + log.Printf("Working on %q", pkgname) + + meta, err := apps.ReadMetaFile(path) + if err != nil { + log.Printf("Reading meta file %q: %s", path, err.Error()) + return nil + } + + latestPackage, ok := fdroidIndex.FindLatestPackage(pkgname) + if !ok { + return nil + } + + log.Printf("The latest version is %q with versionCode %d", latestPackage.VersionName, latestPackage.VersionCode) + + apkInfo, ok := apkInfoMap[latestPackage.ApkName] + if !ok { + log.Printf("Cannot find apk info for %q", latestPackage.ApkName) + return nil + } + + // Now update with some info + + setNonEmpty(meta, "AuthorName", apkInfo.Author()) + fn := apkInfo.FriendlyName + if fn == "" { + fn = apkInfo.Name() + } + setNonEmpty(meta, "Name", fn) + setNonEmpty(meta, "SourceCode", apkInfo.GitURL) + setNonEmpty(meta, "License", apkInfo.License) + setNonEmpty(meta, "Description", apkInfo.Description) + + var summary = apkInfo.Summary + // See https://f-droid.org/en/docs/Build_Metadata_Reference/#Summary for max length + const maxSummaryLength = 80 + if len(summary) > maxSummaryLength { + summary = summary[:maxSummaryLength-3] + "..." + + log.Printf("Truncated summary to length of %d (max length)", len(summary)) + } + + setNonEmpty(meta, "Summary", summary) + + if len(apkInfo.Categories) != 0 { + meta["Categories"] = apkInfo.Categories + } + + if len(apkInfo.AntiFeatures) != 0 { + meta["AntiFeatures"] = strings.Join(apkInfo.AntiFeatures, ",") + } + + meta["CurrentVersion"] = latestPackage.VersionName + meta["CurrentVersionCode"] = latestPackage.VersionCode + + log.Printf("Set current version info to versionName=%q, versionCode=%d", latestPackage.VersionName, latestPackage.VersionCode) + + err = apps.WriteMetaFile(path, meta) + if err != nil { + log.Printf("Writing meta file %q: %s", path, err.Error()) + return nil + } + + log.Printf("Updated metadata file %q", path) + + if apkInfo.ReleaseDescription != "" { + destFilePath := filepath.Join(walkPath, latestPackage.PackageName, "en-US", "changelogs", fmt.Sprintf("%d.txt", latestPackage.VersionCode)) + + err = os.MkdirAll(filepath.Dir(destFilePath), os.ModePerm) + if err != nil { + log.Printf("Creating directory for changelog file %q: %s", destFilePath, err.Error()) + return nil + } + + err = os.WriteFile(destFilePath, []byte(apkInfo.ReleaseDescription), os.ModePerm) + if err != nil { + log.Printf("Writing changelog file %q: %s", destFilePath, err.Error()) + return nil + } + + log.Printf("Wrote release notes to %q", destFilePath) + } + + log.Printf("Cloning git repository to search for screenshots") + + gitRepoPath, err := git.CloneRepo(apkInfo.GitURL) + if err != nil { + log.Printf("Cloning git repo from %q: %s", apkInfo.GitURL, err.Error()) + return nil + } + defer os.RemoveAll(gitRepoPath) + + metadata, err := apps.FindMetadata(gitRepoPath) + if err != nil { + log.Printf("finding metadata in git repo %q: %s", gitRepoPath, err.Error()) + return nil + } + + log.Printf("Found %d screenshots", len(metadata.Screenshots)) + + screenshotsPath := filepath.Join(walkPath, latestPackage.PackageName, "en-US", "phoneScreenshots") + + _ = os.RemoveAll(screenshotsPath) + + var sccounter int = 1 + for _, sc := range metadata.Screenshots { + var ext = filepath.Ext(sc) + if ext == "" { + log.Printf("Invalid: screenshot file extension is empty for %q", sc) + continue + } + + var newFilePath = filepath.Join(screenshotsPath, fmt.Sprintf("%d%s", sccounter, ext)) + + err = os.MkdirAll(filepath.Dir(newFilePath), os.ModePerm) + if err != nil { + log.Printf("Creating directory for screenshot file %q: %s", newFilePath, err.Error()) + return nil + } + + err = file.Move(sc, newFilePath) + if err != nil { + log.Printf("Moving screenshot file %q to %q: %s", sc, newFilePath, err.Error()) + return nil + } + + log.Printf("Wrote screenshot to %s", newFilePath) + + sccounter++ + } + + toRemovePaths = append(toRemovePaths, screenshotsPath) + + return nil + }() + }) + if err != nil { + log.Printf("Error while walking metadata: %s", err.Error()) + + os.Exit(1) + } + + if !*debugMode { + fmt.Println("::group::F-Droid: Reading updated metadata") + + // Now, we run the fdroid update command again to regenerate the index with our new metadata + cmd := exec.Command("fdroid", "update", "--pretty", "--delete-unknown") + cmd.Stderr = os.Stderr + cmd.Stdout = os.Stdout + cmd.Stdin = os.Stdin + cmd.Dir = filepath.Dir(*repoDir) + + log.Printf("Running %q in %s", cmd.String(), cmd.Dir) + + err = cmd.Run() + if err != nil { + log.Println("Error while running \"fdroid update -c\":", err.Error()) + + fmt.Println("::endgroup::") + os.Exit(1) + } + fmt.Println("::endgroup::") + } + + fmt.Println("::group::Assessing changes") + + // Now at the end, we read the index again + fdroidIndex, err = apps.ReadIndex(fdroidIndexFilePath) + if err != nil { + log.Fatalf("reading f-droid repo index: %s\n::endgroup::\n", err.Error()) + } + + // Now we can remove all paths that were marked for doing so + + for _, rmpath := range toRemovePaths { + err = os.RemoveAll(rmpath) + if err != nil { + log.Fatalf("removing path %q: %s\n", rmpath, err.Error()) + } + } + + // We can now generate the README file + readmePath := filepath.Join(filepath.Dir(filepath.Dir(*repoDir)), "README.md") + err = md.RegenerateReadme(readmePath, fdroidIndex) + if err != nil { + log.Fatalf("error generating %q: %s\n", readmePath, err.Error()) + } + + cpath, haveSignificantChanges := apps.HasSignificantChanges(initialFdroidIndex, fdroidIndex) + if haveSignificantChanges { + log.Printf("The index %q had a significant change at JSON path %q", fdroidIndexFilePath, cpath) + } else { + log.Printf("The index files didn't change significantly") + + changedFiles, err := git.GetChangedFileNames(*repoDir) + if err != nil { + log.Fatalf("getting changed files: %s\n::endgroup::\n", err.Error()) + } + + // If only the index files changed, we ignore the commit + for _, fname := range changedFiles { + if !strings.Contains(fname, "index") { + haveSignificantChanges = true + + log.Printf("File %q is a significant change", fname) + } + } + + if !haveSignificantChanges { + log.Printf("It doesn't look like there were any relevant changes, neither to the index file nor any file indexed by git.") + } + } + + fmt.Println("::endgroup::") + + // If we have an error, we report it as such + if haveError { + os.Exit(1) + } + + // If we don't have any good changes, we report it with exit code 2 + if !haveSignificantChanges { + os.Exit(2) + } + + // If we have relevant changes, we exit with code 0 +} + +func setNonEmpty(m map[string]interface{}, key string, value string) { + if value != "" || m[key] == "Unknown" { + m[key] = value + + log.Printf("Set %s to %q", key, value) + } +} + +func downloadStream(targetFile string, rc io.ReadCloser) (err error) { + defer rc.Close() + + targetTemp := targetFile + ".tmp" + + f, err := os.Create(targetTemp) + if err != nil { + return + } + + _, err = io.Copy(f, rc) + if err != nil { + _ = f.Close() + _ = os.Remove(targetTemp) + + return + } + + err = f.Close() + if err != nil { + return + } + + return os.Rename(targetTemp, targetFile) +} diff --git a/metascoop/md/generate_table.go b/metascoop/md/generate_table.go new file mode 100644 index 0000000..fd74177 --- /dev/null +++ b/metascoop/md/generate_table.go @@ -0,0 +1,58 @@ +package md + +import ( + "bytes" + "fmt" + "html/template" + "os" + + "metascoop/apps" +) + +const ( + tableStart = "" + + tableEnd = "" + + tableTmpl = ` +| Icon | Name | Description | Version | +| --- | --- | --- | --- |{{range .Apps}} +| {{.name}} icon | [**{{.name}}**]({{.sourceCode}}) | {{.summary}} | {{.suggestedVersionName}} ({{.suggestedVersionCode}}) |{{end}} +` + tableEnd +) + +var tmpl = template.Must(template.New("").Parse(tableTmpl)) + +func RegenerateReadme(readMePath string, index *apps.RepoIndex) (err error) { + content, err := os.ReadFile(readMePath) + if err != nil { + return + } + + var tableStartIndex = bytes.Index(content, []byte(tableStart)) + if tableStartIndex < 0 { + return fmt.Errorf("cannot find table start in %q", readMePath) + } + + var tableEndIndex = bytes.Index(content, []byte(tableEnd)) + if tableEndIndex < 0 { + return fmt.Errorf("cannot find table end in %q", readMePath) + } + + var table bytes.Buffer + + table.WriteString(tableStart) + + err = tmpl.Execute(&table, index) + if err != nil { + return err + } + + newContent := []byte{} + + newContent = append(newContent, content[:tableStartIndex]...) + newContent = append(newContent, table.Bytes()...) + newContent = append(newContent, content[tableEndIndex:]...) + + return os.WriteFile(readMePath, newContent, os.ModePerm) +} diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..ef68a4a --- /dev/null +++ b/update.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +cd metascoop +echo "::group::Building metascoop executable" +go build -o metascoop +echo "::endgroup::" + +./metascoop -ap=../apps.yaml -rd=../fdroid/repo -pat="$ACCESS_TOKEN" $1 +EXIT_CODE=$? +cd .. + +echo "Scoop had an exit code of $EXIT_CODE" + +set -e + +if [ $EXIT_CODE -eq 2 ]; then + # Exit code 2 means that there were no significant changes + echo "This means that there were no significant changes" + exit 0 +elif [ $EXIT_CODE -eq 0 ]; then + # Exit code 0 means that we can commit everything & push + + echo "This means that we now have changes we should push" + + git config --local user.name 'Bitwarden CI' + git config --local user.email 'ci@bitwarden.com' + + git add . + git commit -m"Automated update" + git push +else + echo "This is an unexpected error" + + exit $EXIT_CODE +fi