mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
Test index before signing
This commit is contained in:
parent
eb44b1691c
commit
d6574a401b
1 changed files with 8 additions and 0 deletions
|
|
@ -16,6 +16,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
@ -24,6 +25,7 @@ import logging
|
||||||
|
|
||||||
from . import _
|
from . import _
|
||||||
from . import common
|
from . import common
|
||||||
|
from . import metadata
|
||||||
from .exception import FDroidException
|
from .exception import FDroidException
|
||||||
|
|
||||||
config = None
|
config = None
|
||||||
|
|
@ -78,6 +80,12 @@ def sign_index_v1(repodir, json_name):
|
||||||
"""
|
"""
|
||||||
name, ext = common.get_extension(json_name)
|
name, ext = common.get_extension(json_name)
|
||||||
index_file = os.path.join(repodir, json_name)
|
index_file = os.path.join(repodir, json_name)
|
||||||
|
|
||||||
|
# Test if index is valid
|
||||||
|
with open(index_file, encoding="utf-8") as fp:
|
||||||
|
index = json.load(fp)
|
||||||
|
[metadata.App(app) for app in index["apps"]]
|
||||||
|
|
||||||
jar_file = os.path.join(repodir, name + '.jar')
|
jar_file = os.path.join(repodir, name + '.jar')
|
||||||
with zipfile.ZipFile(jar_file, 'w', zipfile.ZIP_DEFLATED) as jar:
|
with zipfile.ZipFile(jar_file, 'w', zipfile.ZIP_DEFLATED) as jar:
|
||||||
jar.write(index_file, json_name)
|
jar.write(index_file, json_name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue