1033 Commits

Author SHA1 Message Date
Hans-Christoph Steiner
63298ad2ad update: change assert to fix flaky tests
This was happening often:

```
======================================================================
FAIL: test_strip_and_copy_image_in_file_ctime_changed (tests.test_update.UpdateTest.test_strip_and_copy_image_in_file_ctime_changed)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builds/fdroid/fdroidserver/tests/test_update.py", line 1409, in test_strip_and_copy_image_in_file_ctime_changed
    self.assertNotAlmostEqual(
AssertionError: 1750683024.4857466 == 1750683024.4957466 within 0.01 delta (0.009999990463256836 difference)
```
2025-06-23 15:16:21 +02:00
Hans-Christoph Steiner
ce018158ee nightly: set up test for git clone function 2025-06-18 18:03:59 +02:00
Hans-Christoph Steiner
494d811846 update: If cateogories.yml only has icon:, then add name:
E.g. if _categories.yml_ is like:

```yaml
Time:
  icon: time.png
```
2025-06-16 17:13:48 +00:00
Hans-Christoph Steiner
59102fb07f update: use ctime/mtime to control _strip_and_copy_image runs
Oftentimes, the file that is copied is stripped, in which case, the file
size is different.  Using a file size check here means it will rerun the
strip and copy every time `fdroid update` is run for any image that needs
to be stripped.  If the source's ctime is newer than the destination, then
the process should run since it is a newly created file.  Even more so with
mtime, since the destination's mtime is reset based on the source's.
2025-06-11 17:33:34 +02:00
linsui
cd1630d2f5 Lazyload environment variables in config.yml 2025-06-11 13:02:09 +00:00
linsui
a5d966bf0f calculate all combinations of gradle flavors 2025-05-22 12:24:33 +02:00
linsui
e957583337 common: add calculate_gradle_flavor_combination 2025-05-22 12:24:32 +02:00
Hans-Christoph Steiner
8c9b0b3a2a add test case 2025-05-22 12:12:24 +02:00
Leo Heitmann Ruiz
5f534ea2cb Add test case for Triple-T 1.0.0 graphics 2025-05-22 11:57:57 +02:00
Hans-Christoph Steiner
20b36f1970 SOURCE_DATE_EPOCH from app's git otherwise fdroiddata metadata file
https://reproducible-builds.org/docs/source-date-epoch
2025-05-19 16:31:40 +02:00
Hans-Christoph Steiner
4e7bda736c update: never execute VCS e.g. git
Package repos come from untrusted sources, in terms of the buildserver. They
should be handled in VMs and containers as much as possible to avoid
vulnerabilities.  As far as I could tell, `fdroid update` only has a single
place where it executes any VCS system: if there is .fdroid.yml present in
a package repo, then it will fetch the commit ID using git.

For better security properties, this implements a simple function to just
read the files to get that commit ID.  The function that executes git to do
the same thing is relabeled "unsafe".  That is used for status JSON
everywhere, but that runs on fdroiddata.git and fdroidserver.git, which are
trusted repos.

The unsafe version is also used in places where git.Repo() is needed for
other things.
2025-05-12 18:30:03 +02:00
Hans-Christoph Steiner
2a33857fd0
update: include stages timing info in update.json
!1627 missed this, so stages only get included in running.json.  That means
the stages info is only visible while update is running, making it hard to
use.
2025-04-23 19:26:50 +02:00
Hans-Christoph Steiner
17e5a59704 verify: generate <appid>.json files that list all reports 2025-04-10 15:41:46 +00:00
Hans-Christoph Steiner
9a8d80ee6b purge dead code: apk_signer_fingerprint_short 2025-03-31 11:09:07 +02:00
Hans-Christoph Steiner
59474437b3 delete cruft test script 2025-03-25 10:23:00 +00:00
Hans-Christoph Steiner
40be283c4a APK for testing maxSdkVersion handling
APK is org.bitbucket.tickytacky.mirrormirror_4.apk disassembled with
`apktool decode`, maxSdkVersion added, then reassembled with `apktool build`
2025-03-25 10:23:00 +00:00
Hans-Christoph Steiner
eef3188600 test_signatures: remove unneeded config from tests 2025-03-25 10:23:00 +00:00
Hans-Christoph Steiner
d024c8964f convert test_signatures.py to black code format 2025-03-25 10:23:00 +00:00
Hans-Christoph Steiner
8f351d8406 publish: convert to black code format 2025-03-25 10:23:00 +00:00
Hans-Christoph Steiner
58609aa9f0 fix _dexdump_found() in test_scanner.py !1621
find_sdk_tools_cmd() will throw an exception if it can't find the tool, not
return None.
2025-03-24 08:24:01 +00:00
Hans-Christoph Steiner
78efc16fc2 scanner: suppress verbose/confusing log output on success
This additionally asserts that the right log output happened.
2025-03-21 08:45:23 +00:00
Hans-Christoph Steiner
4b9100ae80 publish: remove last use of stats/ dir
This file can be treated like the other index files in repo/. This also has
the advantage that it will automatically get synced by @CiaranG's existing
sync scripts.
2025-03-20 15:08:32 +01:00
Hans-Christoph Steiner
38378ddfb7 rename v1_sort_packages to sort_package_versions 2025-03-20 15:08:32 +01:00
Hans-Christoph Steiner
8565a97465 rename functions and variables to reflect stats/ going away 2025-03-20 15:08:32 +01:00
Hans-Christoph Steiner
ec2b847e03 handle arches that are missing dexdump in tests
dexdump is only available for certain CPU architectures.  Google binaries
are for amd64 and arm64.  Debian binaries are for amd64, arm64, armhf,
i386, and riscv64.  That leaves out armel, ppc64el, s390x, loong64, etc.
where pure Python code runs perfectly fine.
2025-03-20 12:42:59 +00:00
Hans-Christoph Steiner
20569217d9 index: fail if user sets mirrors:isPrimary wrong
Really, this is not meant to be set by the user in the config.  But if they
add something harmless that'll be ignored anyway, it seems that throwing an
error is too much.  So only throw the error if it is set wrongly.
2025-03-20 11:13:09 +00:00
Hans-Christoph Steiner
0b3fe26524
skip tests that won't run on a given CPU architecture 2025-03-19 15:47:06 +01:00
Hans-Christoph Steiner
025828932d purge test exceptions for Python < 3.9, that's the min version 2025-03-19 11:11:36 +01:00
Hans-Christoph Steiner
c5f442616e gitlab-ci: "PUBLISH" job to test in the signing server's setup 2025-03-12 17:27:26 +01:00
Hans-Christoph Steiner
9d147c6b6b test_common: remove self.tmpdir and use standard self.testdir pat 2025-03-12 13:37:17 +01:00
Hans-Christoph Steiner
858068c64b only show "unsafe perms on config.yml" when secrets are present
This should make for fewer false positives.
2025-03-12 13:37:17 +01:00
Hans-Christoph Steiner
36007d50e5 AbstractBaseTest class for sharing setUp and tearDown in tests 2025-03-12 13:37:17 +01:00
Hans-Christoph Steiner
f269232b96 hide error messages in tests that are meant to fail 2025-03-12 13:37:17 +01:00
Hans-Christoph Steiner
8cf1297e2c clarify config data types and structures 2025-03-12 13:37:17 +01:00
Hans-Christoph Steiner
081e02c109 expand {env: foo} in any place a string can be
`keypass: {env: keypass}` has been in use in production repos for
years.  That is not anything new. It makes it possible to maintain
_config.yml_ publicly even when it needs secrets.  This change makes
sure it is possible to use {env: foo} syntax anywhere where a string
value is valid. The "list of dicts" values can be str, list of str or
list of dicts with str.

Before the {env: keypass} syntax, the actual password was just inline
in the config file.  Before this commit, it was only possible to use
{env: key} syntax in simple, string-only configs, e.g. from
examples/config.yml:
2025-03-12 13:37:17 +01:00
Hans-Christoph Steiner
3ab2baf542 _yaml.config_dump() for writing out config
This outputs YAML in a string that is suitable for use in regexps
and string replacements, as well as complete files.  It is therefore
explicitly set up to avoid writing out headers and footers.
2025-03-10 08:49:18 +01:00
Hans-Christoph Steiner
2f47938dbf standardize config on ruamel.yaml with a YAML 1.2 config
This is a key piece of the ongoing `PUBLISH` _config.yml_ migration. There was uneven implementation of which YAML parser to use, and that could lead to bugs where one parser might read a value one way, and a different parser will read the value a different way. I wanted to be sure that YAML 1.2 would always work.

This makes all code that handles config files use the same `ruamel.yaml` parsers.  This only touches other usages of YAML parsers when there is overlap.  This does not port all of _fdroidserver_ to `ruamel.yaml` and YAML 1.2.  The metadata files should already be YAML 1.2 anyway.

# Conflicts:
#	fdroidserver/lint.py
2025-03-10 08:48:58 +01:00
Hans-Christoph Steiner
3cc6c09ffc use common var for 'config.yml', standarize on UTF-8
This makes it easy to track all the places that use config.yml, and
hopefully makes things feel cleaner.  This also standardizes all places
where config.yml is written out to use UTF-8 as the file encoding.

This also includes a lot of black code format fixes.
2025-03-05 12:20:32 +01:00
Hans-Christoph Steiner
1f96a84f9a
gitlab-ci: add yamllint job 2025-02-26 17:28:01 +01:00
Hans-Christoph Steiner
642499ec94
purge config.py handling, it is no longer supported 2025-02-26 17:27:58 +01:00
Hans-Christoph Steiner
1ee9ea8cf9 lint: implement for config.yml 2025-02-24 19:07:27 +01:00
Hans-Christoph Steiner
695d97e103
fix: "no new line character at the end of file"
If yamllint is installed `fdroid lint` will run it, and what will output
the  (new-line-at-end-of-file) warning message.
2025-02-24 18:13:13 +01:00
Hans-Christoph Steiner
f92542c7ea skip test with mystery failure only on macOS
https://gitlab.com/fdroid/fdroidserver/-/merge_requests/1587#note_2273747610

This happened when this test was a shell script as well:
https://gitlab.com/fdroid/fdroidserver/-/blob/2.3.5/tests/run-tests#L1244
2025-02-14 11:12:22 +01:00
Hans-Christoph Steiner
1694966455 gpg requires a short path to the socket to talk to gpg-agent 2025-02-13 17:56:30 +01:00
Hans-Christoph Steiner
efda0f5d6c skip gpgsign test if gpg is not availabe on the PATH 2025-02-13 17:56:30 +01:00
Hans-Christoph Steiner
b7c5233668 test_integration: stop trying to handle proxy errors
I don't think it is possible to automatically handle those cases, because
proxy setups can be so widely varied and can have privacy ramifications.
The person running the test who hits proxy errors will need to handle them
manually.
2025-02-13 17:56:30 +01:00
Hans-Christoph Steiner
efce0ce0e4 use shared test function to replicate .testfiles setup
* It should include a subdir named after the test case.
* self.testdir is the common var name for this.
* tmp_repo is not a repo/ subdir, but instead the root of the whole repo
2025-02-13 17:56:30 +01:00
Hans-Christoph Steiner
820abbc876 'archive/' dir might have been locally created 2025-02-13 17:56:30 +01:00
Hans-Christoph Steiner
7a21c24e45 test_integration: add docstring comments 2025-02-13 17:56:30 +01:00
Hans-Christoph Steiner
b933043ca1 new helpers: get_output_extension() & get_release_apk_filename()
This also moves to the standard var names: appid & versionCode
2025-02-13 17:56:30 +01:00