diff options
Diffstat (limited to 'addons.mozilla.org-fsd/sync-data/fsd-amo-bot')
-rwxr-xr-x | addons.mozilla.org-fsd/sync-data/fsd-amo-bot | 164 |
1 files changed, 0 insertions, 164 deletions
diff --git a/addons.mozilla.org-fsd/sync-data/fsd-amo-bot b/addons.mozilla.org-fsd/sync-data/fsd-amo-bot index 14b008d..4947ae7 100755 --- a/addons.mozilla.org-fsd/sync-data/fsd-amo-bot +++ b/addons.mozilla.org-fsd/sync-data/fsd-amo-bot @@ -115,168 +115,6 @@ case "$1" in ;; - --make-xml) - - if [ ! -d "build/fsd" ]; then mkdir -p build/fsd; fi - - # Get number of edits: - wget "https://directory.fsf.org/w/api.php?action=query&list=recentchanges&rclimit=1" -O fsdedits.xml - oldrevid="$(grep revid fsdedits.xml | sed "s|"||g; s|revid|\nrevid|; s|old_revid|\n|" | grep revid | sed "s|revid=||")" - newrevid=$(expr 1 + $oldrevid) - - cd build/ || exit - - while read url; do - - retrive - # List JSON structure: cat amo/json/$slug.json | js '.' - # XML value "homepage" is not always set in AMO API, but the FSD require "Homepage URL" to be set: Therfore we use the AMO page itself in Homepage URL to complete the build of the repo automatically. - echo "<mediawiki xmlns=\"http://www.mediawiki.org/xml/export-0.7/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.mediawiki.org/xml/export-0.7/ http://www.mediawiki.org/xml/export-0.7.xsd\" version=\"0.7\" xml:lang=\"en\"> - <siteinfo> - <sitename>Free Software Directory</sitename> - <base>https://directory.fsf.org/wiki/Main_Page</base> - <generator>MediaWiki 1.20.2</generator> - <case>first-letter</case> - <namespaces> - <namespace key=\"-2\" case=\"first-letter\">Media</namespace> - <namespace key=\"-1\" case=\"first-letter\">Special</namespace> - <namespace key=\"0\" case=\"first-letter\" /> - <namespace key=\"1\" case=\"first-letter\">Talk</namespace> - <namespace key=\"2\" case=\"first-letter\">User</namespace> - <namespace key=\"3\" case=\"first-letter\">User talk</namespace> - <namespace key=\"4\" case=\"first-letter\">Free Software Directory</namespace> - <namespace key=\"5\" case=\"first-letter\">Free Software Directory talk</namespace> - <namespace key=\"6\" case=\"first-letter\">File</namespace> - <namespace key=\"7\" case=\"first-letter\">File talk</namespace> - <namespace key=\"8\" case=\"first-letter\">MediaWiki</namespace> - <namespace key=\"9\" case=\"first-letter\">MediaWiki talk</namespace> - <namespace key=\"10\" case=\"first-letter\">Template</namespace> - <namespace key=\"11\" case=\"first-letter\">Template talk</namespace> - <namespace key=\"12\" case=\"first-letter\">Help</namespace> - <namespace key=\"13\" case=\"first-letter\">Help talk</namespace> - <namespace key=\"14\" case=\"first-letter\">Category</namespace> - <namespace key=\"15\" case=\"first-letter\">Category talk</namespace> - <namespace key=\"102\" case=\"first-letter\">Property</namespace> - <namespace key=\"103\" case=\"first-letter\">Property talk</namespace> - <namespace key=\"106\" case=\"first-letter\">Form</namespace> - <namespace key=\"107\" case=\"first-letter\">Form talk</namespace> - <namespace key=\"108\" case=\"first-letter\">Concept</namespace> - <namespace key=\"109\" case=\"first-letter\">Concept talk</namespace> - <namespace key=\"170\" case=\"first-letter\">Filter</namespace> - <namespace key=\"171\" case=\"first-letter\">Filter talk</namespace> - <namespace key=\"500\" case=\"first-letter\">Review</namespace> - <namespace key=\"501\" case=\"first-letter\">Review talk</namespace> - <namespace key=\"502\" case=\"first-letter\">License</namespace> - <namespace key=\"503\" case=\"first-letter\">License talk</namespace> - <namespace key=\"510\" case=\"first-letter\">Collection</namespace> - <namespace key=\"511\" case=\"first-letter\">Collection talk</namespace> - <namespace key=\"520\" case=\"first-letter\">Org</namespace> - <namespace key=\"521\" case=\"first-letter\">Org talk</namespace> - </namespaces> - </siteinfo> - <page> - <title>IceCat/$(cat amo/json/$slug.json | sed "s|-||g;" | jq '.name.enUS' | sed "s|^\"||; s|\"$||;")</title> - <revision> - <id>$newrevid</id> - <timestamp>$(date -u +%Y-%m-%dT%H:%M:%SZ)</timestamp> - <contributor> - <username>amo-import</username> - <id>1501</id> - </contributor> - <sha1>kj1p9nd2p15bqr2tb7jkihshlxow11y</sha1> - <text xml:space=\"preserve\" bytes=\"2687\">{{Entry" > fsd/$slug.xml - - # Dash have to be removed in jq 1.3: https://github.com/stedolan/jq/issues/341 - echo "|Name=$(cat amo/json/$slug.json | sed "s|-||g;" | jq '.name.enUS' | sed "s|^\"||; s|\"$||;") -|Short description=$(cat amo/json/$slug.json | sed "s|-||g;" | jq '.summary.enUS' | sed "s|^\"||; s|\"$||; s|\\\n|\n|g; s|\\\\\"|\"|g;") -|Full description=$(cat amo/json/$slug.json | sed "s|-||g;" | jq '.description.enUS' | sed "s|^\"||; s|\"$||; s|\\\n|\n|g; s|\\\\\"|\"|g;") -|Homepage URL=$(cat amo/json/$slug.json | sed "s|-||g;" | jq '.homepage.enUS' | sed "s|^\"||; s|\"$||;")" >> fsd/$slug.xml - - - if [[ "$(cat amo/json/$slug.json | jq '.current_version.compatibility.seamonkey')" != "null" ]]; then - set_seamonkey="SeaMonkey,"; - fi - - if [[ "$(cat amo/json/$slug.json | jq '.current_version.compatibility.firefox')" != "null" ]]; then - set_icecat="IceCat,"; - fi - - if [[ "$(cat amo/json/$slug.json | jq '.current_version.compatibility.android')" != "null" ]]; then - set_icecatmobile="IceCatMobile,"; - fi - - if [[ "$(cat amo/json/$slug.json | jq '.current_version.compatibility.mobile')" != "null" ]]; then - set_icecatmobile="IceCatMobile,"; - fi - - if [[ "$(cat amo/json/$slug.json | jq '.current_version.compatibility.thunderbird')" != "null" ]]; then - set_thunderbird="Thunderbird,"; - fi - - echo "|Extension of=$(echo "$set_seamonkey$set_icecat$set_icecatmobile$set_thunderbird" | sed "s|,$||;")" >> fsd/$slug.xml - - - if [[ "$(cat amo/json/$slug.json | sed "s|-||g;" | jq '.homepage.enUS' | grep "github.com")" != "null" ]]; then - echo "|VCS checkout command=git clone $(cat amo/json/$slug.json | sed "s|-||g;" | jq '.homepage.enUS' | sed "s|^\"||; s|\"$||;")" >> fsd/$slug.xml - fi - - echo "|VCS checkout command=git clone $(cat amo/json/$slug.json | sed "s|-||g;" | jq '.homepage.enUS' | sed "s|^\"||; s|\"$||;")"; - echo "|Version identifier=$(cat amo/json/$slug.json | jq '.current_version.version' | sed "s|^\"||; s|\"$||;") -|Version date=$(cat amo/json/$slug.json | jq '.last_updated' | sed "s|^\"||; s|\"$||;") -|Version download=https://addons.mozilla.org/firefox/downloads/latest/$slug/addon-$(cat amo/json/$slug.json | jq '.current_version.id')-latest.xpi -|Last review by=FSDbot -|Last review date=$(date +"%Y/%m/%d") -|Submitted by=FSDbot -|Submitted date=2017/02/01 -|Is GNU=No -}}" >> fsd/$slug.xml - - - # https://addons.mozilla.org/api/v3/addons/addon/noscript/versions/1910123/ - echo "{{Project license - -# Stuck here (have to use old API until this have been fixed): https://github.com/mozilla/addons-server/issues/3936 - -|License=$(cat amo/json.versions/$slug.json | sed "s|-||g;" | jq '.license.name.enUS' | sed "s|^\"||; s|\"$||;") -|License copyright=$(cat amo/json/$slug.json | sed "s|-||g;" | jq '.authors[].name' | sed "s|^\"||; s|\"$||;") -}}" >> fsd/$slug.xml - - # Homepage URL can be changed by the community so lets do a backup here - echo "{{Resource -|Resource audience=amo-import -|Resource kind=General -|Resource URL=$url -}}" >> fsd/$slug.xml - - - if [[ "$(cat amo/json/$slug.json | sed "s|-||g;" | jq '.support_url[]' | sed "s|^\"||; s|\"$||;")" != "" ]]; - then - - echo "{{Resource -|Resource audience=Users -|Resource kind=Support -|Resource URL=$(cat amo/json/$slug.json | sed "s|-||g;" | jq '.support_url[]' | sed "s|^\"||; s|\"$||;") -}}" >> "fsd/$slug.xml" - - fi - - # Add "E-mail" here when "Support E-mail" have been added to the API: https://github.com/mozilla/addons-server/issues/3901 - - - echo "{{Featured}}</text> - </revision> - </page> -</mediawiki>" >> "fsd/$slug.xml" - - cat "fsd/$slug.xml" - - - - done < ../amo-repo.txt - - - ;; - --all) @@ -284,8 +122,6 @@ case "$1" in $0 --get-xpi-url $0 --get-xpi $0 --xpi-extract - $0 --make-xml - ;; *) |