firefox: apply update patch process-json-files.py
This commit is contained in:
parent
aadc0d6ea5
commit
666695bccb
2 changed files with 26 additions and 9 deletions
|
|
@ -51,10 +51,18 @@ class RemoteSettings:
|
|||
DUMPS_PATH_ABSOLUTE = arguments.MAIN_PATH / DUMPS_PATH_RELATIVE
|
||||
|
||||
_WRAPPER_NAME = 'data'
|
||||
_LAST_MODIFIED_KEY_NAME = 'last_modified'
|
||||
|
||||
@classmethod
|
||||
def get_collection_timestamp(cls, collection):
|
||||
return max((record[cls._LAST_MODIFIED_KEY_NAME]
|
||||
for record in collection.content), default=0)
|
||||
|
||||
@classmethod
|
||||
def wrap(cls, processed):
|
||||
return File(processed.path, {cls._WRAPPER_NAME: processed.content})
|
||||
return File(processed.path,
|
||||
{cls._WRAPPER_NAME: processed.content,
|
||||
'timestamp': cls.get_collection_timestamp(processed)})
|
||||
|
||||
@classmethod
|
||||
def unwrap(cls, parsed_jsons):
|
||||
|
|
@ -88,13 +96,15 @@ class RemoteSettings:
|
|||
while timestamp in timestamps:
|
||||
timestamp += 1
|
||||
timestamps.append(timestamp)
|
||||
record['last_modified'] = timestamp
|
||||
record[cls._LAST_MODIFIED_KEY_NAME] = timestamp
|
||||
|
||||
if parsed_schema is not None:
|
||||
validate(record, schema=parsed_schema)
|
||||
|
||||
result.append(record)
|
||||
|
||||
result.sort(
|
||||
key=lambda record: record[cls._LAST_MODIFIED_KEY_NAME], reverse=True)
|
||||
cls.OUTPUT_PATH.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
return File(cls.OUTPUT_PATH, result)
|
||||
|
|
@ -109,7 +119,7 @@ class RemoteSettings:
|
|||
|
||||
class Changes(RemoteSettings):
|
||||
JSON_PATHS = tuple(RemoteSettings.DUMPS_PATH_ABSOLUTE.glob('*/*.json'))
|
||||
OUTPUT_PATH = RemoteSettings.DUMPS_PATH_ABSOLUTE / 'monitor/changes.json'
|
||||
OUTPUT_PATH = RemoteSettings.DUMPS_PATH_ABSOLUTE / 'monitor/changes'
|
||||
|
||||
@classmethod
|
||||
def wrap(cls, processed):
|
||||
|
|
@ -124,8 +134,8 @@ class Changes(RemoteSettings):
|
|||
for collection in unwrapped_jsons:
|
||||
if collection.path != RemoteSettings.DUMPS_PATH_ABSOLUTE / 'main/example.json':
|
||||
latest_change = {}
|
||||
latest_change['last_modified'] = max(
|
||||
(record['last_modified'] for record in collection.content), default=0)
|
||||
latest_change[cls._LAST_MODIFIED_KEY_NAME] = cls.get_collection_timestamp(
|
||||
collection)
|
||||
latest_change['bucket'] = collection.path.parent.name
|
||||
latest_change['collection'] = collection.path.stem
|
||||
changes.append(latest_change)
|
||||
|
|
|
|||
|
|
@ -201,7 +201,8 @@ cat << TOP_JSON > services/settings/dumps/main/top-sites.json
|
|||
"id": "c426481f-8c3f-53b8-b23a-431a91a1c7b4",
|
||||
"last_modified": $(date +%s%N | cut -b1-13)
|
||||
}
|
||||
]
|
||||
],
|
||||
"timestamp": $(date +%s%N | cut -b1-13)
|
||||
}
|
||||
TOP_JSON
|
||||
|
||||
|
|
@ -245,14 +246,19 @@ sed "s_^Maintainer.*_Maintainer: $DEBFULLNAME <$DEBEMAIL>_g" -i debian/control.i
|
|||
cp -a $DATA/branding/* browser/branding/official
|
||||
cp -a $DATA/branding/* browser/branding/unofficial
|
||||
cp -a $DATA/branding/* browser/branding/nightly
|
||||
cp -a $DATA/branding/* browser/branding/aurora
|
||||
|
||||
sed '/about-wordmark.svg/d' -i browser/base/content/aboutDialog.css
|
||||
echo '#warningDesc, #communityExperimentalDesc, #communityDesc, #contributeDesc {display:none!important}' >> browser/base/content/aboutDialog.css
|
||||
# Disable preprocessor
|
||||
sed 's/_PP//' -i browser/branding/branding-common.mozbuild
|
||||
cat << EOF >> debian/config/branch.mk
|
||||
#Prevent duplicated values.
|
||||
cat << EOF > debian/config/branch.mk
|
||||
MOZILLA_REPO = https://hg.mozilla.org/releases/mozilla-release
|
||||
L10N_REPO = https://hg.mozilla.org/l10n-central
|
||||
CHANNEL = release
|
||||
MOZ_WANT_UNIT_TESTS = 0
|
||||
MOZ_BUILD_OFFICIAL = 0
|
||||
MOZ_OFFICIAL_BUILD = 0
|
||||
MOZ_ENABLE_BREAKPAD = 0
|
||||
MOZ_ENABLE_TELEMETRY = 0
|
||||
EOF
|
||||
|
|
@ -268,8 +274,9 @@ s|www.mozilla.com/firefox/central|trisquel.info/browser|g;
|
|||
s|mozilla.com/plugincheck|trisquel.info/browser|g;
|
||||
s|www.mozilla.com/legal/privacy|trisquel.info/legal|g;
|
||||
s|Firefox Nightly|Abrowser|;
|
||||
s|Firefox Developer Edition|Abrowser|g;
|
||||
s|Nightly|Abrowser|g;
|
||||
s|brandProductName=Firefox|brandProductName=Abrowser|;
|
||||
s|brand-product-name = Firefox|brand-product-name = Abrowser|;
|
||||
s|Sign in to Firefox|Sign in to Sync|;
|
||||
s|Search addons.mozilla.org|Search|g;
|
||||
s|firefox.settings.services.mozilla.com|127.0.0.1|g;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue