mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-13 02:30:30 +03:00
only copy icons into repo/ if they changed
This should make things more efficient and reduce the size of the diffs in the transparency log. Using shutil.copy2() preserves metadata.
This commit is contained in:
parent
8a36e264b4
commit
52c1bcca70
3 changed files with 50 additions and 6 deletions
|
|
@ -55,6 +55,7 @@ environment variable to include.
|
|||
import copy
|
||||
import difflib
|
||||
from typing import List
|
||||
import filecmp
|
||||
import git
|
||||
import glob
|
||||
import io
|
||||
|
|
@ -812,7 +813,10 @@ def load_localized_config(name, repodir):
|
|||
icons_dir = os.path.join(repodir, 'icons')
|
||||
if not os.path.exists(icons_dir):
|
||||
os.makedirs(icons_dir, exist_ok=True)
|
||||
shutil.copy(os.path.join("config", value), icons_dir)
|
||||
src = os.path.join("config", value)
|
||||
dest = os.path.join(icons_dir, os.path.basename(src))
|
||||
if not os.path.exists(dest) or not filecmp.cmp(src, dest):
|
||||
shutil.copy2(src, dest)
|
||||
ret[afname][key][locale] = file_entry(
|
||||
os.path.join(icons_dir, value)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import argparse
|
||||
import filecmp
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
|
|
@ -1460,19 +1461,18 @@ def insert_localized_ios_app_metadata(apps_with_packages):
|
|||
fdroidserver.update.copy_ios_screenshots_to_repo(screenshots, package_name)
|
||||
|
||||
# lookup icons, copy them and put them into app
|
||||
icon_path = _get_ipa_icon(Path('build') / package_name)
|
||||
icon_src = _get_ipa_icon(Path('build') / package_name)
|
||||
icon_dest = Path('repo') / package_name / 'icon.png' # for now just assume png
|
||||
icon_stat = os.stat(icon_path)
|
||||
app['iconv2'] = {
|
||||
DEFAULT_LOCALE: {
|
||||
'name': str(icon_dest).lstrip('repo'),
|
||||
'sha256': common.sha256sum(icon_dest),
|
||||
'size': icon_stat.st_size,
|
||||
'size': os.path.getsize(icon_src),
|
||||
}
|
||||
}
|
||||
if not icon_dest.exists():
|
||||
if not icon_dest.exists() or not filecmp.cmp(icon_src, icon_dest):
|
||||
icon_dest.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy(icon_path, icon_dest)
|
||||
shutil.copy2(icon_src, icon_dest)
|
||||
|
||||
|
||||
def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue