Revert "Merge branch 'write-yaml-overhaul' into 'master'"

This reverts merge request !630
This commit is contained in:
Michael Pöhn 2019-04-01 10:24:00 +00:00
parent d45431aa9e
commit 67731470cc
5 changed files with 174 additions and 467 deletions

View file

@ -199,14 +199,14 @@ Builds:
commit: 0.53-test
submodules: true
scandelete:
- 'yes'
- yes
- versionName: '0.54'
versionCode: 540
commit: '0.54'
submodules: true
scandelete:
- 'yes'
- yes
- versionName: '0.55'
versionCode: 550
@ -498,7 +498,7 @@ Builds:
subdir: F-Droid
submodules: true
gradle:
- true
- yes
- versionName: 0.95-alpha1
versionCode: 95001
@ -506,7 +506,7 @@ Builds:
subdir: F-Droid
submodules: true
gradle:
- true
- yes
- versionName: 0.95-alpha2
versionCode: 95002
@ -514,7 +514,7 @@ Builds:
subdir: F-Droid
submodules: true
gradle:
- true
- yes
- versionName: '0.95'
versionCode: 95050
@ -522,7 +522,7 @@ Builds:
subdir: F-Droid
submodules: true
gradle:
- true
- yes
- versionName: 0.95.1
versionCode: 95150
@ -530,56 +530,56 @@ Builds:
subdir: F-Droid
submodules: true
gradle:
- true
- yes
- versionName: 0.96-alpha1
versionCode: 96001
commit: v0.96-alpha1
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.96-alpha2
versionCode: 96002
commit: v0.96-alpha2
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.96-alpha3
versionCode: 96003
commit: v0.96-alpha3
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.96-alpha4
versionCode: 96004
commit: v0.96-alpha4
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.96-alpha5
versionCode: 96005
commit: v0.96-alpha5
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.96-alpha6
versionCode: 96006
commit: v0.96-alpha6
subdir: F-Droid
gradle:
- true
- yes
- versionName: '0.96'
versionCode: 96050
commit: v0.96
subdir: F-Droid
gradle:
- true
- yes
scanignore:
- extern/AndroidPinning/res/raw/cacerts
@ -588,7 +588,7 @@ Builds:
commit: v0.96.1
subdir: F-Droid
gradle:
- true
- yes
scanignore:
- extern/AndroidPinning/res/raw/cacerts
@ -597,7 +597,7 @@ Builds:
commit: v0.97-alpha1
subdir: F-Droid
gradle:
- true
- yes
scanignore:
- extern/AndroidPinning/res/raw/cacerts
@ -606,343 +606,343 @@ Builds:
commit: v0.97-alpha2
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.97-alpha3
versionCode: 97003
commit: v0.97-alpha3
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.97-alpha4
versionCode: 97004
commit: v0.97-alpha4
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.97-alpha5
versionCode: 97005
commit: v0.97-alpha5
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.97-alpha6
versionCode: 97006
commit: v0.97-alpha6
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.97-alpha7
versionCode: 97007
commit: v0.97-alpha7
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.97-alpha8
versionCode: 97008
commit: v0.97-alpha8
subdir: F-Droid
gradle:
- true
- yes
- versionName: '0.97'
versionCode: 97050
commit: v0.97
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.98-alpha1
versionCode: 98001
commit: v0.98-alpha1
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.98-alpha2
versionCode: 98002
commit: v0.98-alpha2
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.98-alpha3
versionCode: 98003
commit: v0.98-alpha3
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.98-alpha4
versionCode: 98004
commit: v0.98-alpha4
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.98-alpha5
versionCode: 98005
commit: v0.98-alpha5
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.98-alpha6
versionCode: 98006
commit: v0.98-alpha6
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.98-alpha7
versionCode: 98007
commit: v0.98-alpha7
subdir: F-Droid
gradle:
- true
- yes
- versionName: '0.98'
versionCode: 98050
commit: v0.98
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.98.1
versionCode: 98150
commit: v0.98.1
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.99-alpha1
versionCode: 99001
commit: v0.99-alpha1
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.99-alpha2
versionCode: 99002
commit: v0.99-alpha2
subdir: F-Droid
gradle:
- true
- yes
- versionName: '0.99'
versionCode: 99050
commit: v0.99
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.99.1
versionCode: 99150
commit: v0.99.1
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.99.2
versionCode: 99250
commit: v0.99.2
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.100-alpha1
versionCode: 100001
commit: v0.100-alpha1
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.100-alpha2
versionCode: 100002
commit: v0.100-alpha2
subdir: F-Droid
gradle:
- true
- yes
- versionName: 0.100-alpha3
versionCode: 100003
commit: v0.100-alpha3
subdir: app
gradle:
- true
- yes
- versionName: 0.100-alpha4
versionCode: 100004
commit: v0.100-alpha4
subdir: app
gradle:
- true
- yes
- versionName: 0.100-alpha5
versionCode: 100005
commit: v0.100-alpha5
subdir: app
gradle:
- true
- yes
- versionName: 0.100-alpha6
versionCode: 100006
commit: v0.100-alpha6
subdir: app
gradle:
- true
- yes
- versionName: 0.100-alpha7
versionCode: 100007
commit: v0.100-alpha7
subdir: app
gradle:
- true
- yes
- versionName: 0.100-alpha8
versionCode: 100008
commit: v0.100-alpha8
subdir: app
gradle:
- true
- yes
- versionName: '0.100'
versionCode: 100050
commit: v0.100
subdir: app
gradle:
- true
- yes
- versionName: 0.100.1
versionCode: 100150
commit: v0.100.1
subdir: app
gradle:
- true
- yes
- versionName: 0.101-alpha1
versionCode: 101001
commit: v0.101-alpha1
subdir: app
gradle:
- true
- yes
- versionName: 0.101-alpha2
versionCode: 101002
commit: v0.101-alpha2
subdir: app
gradle:
- true
- yes
- versionName: 0.101-alpha3
versionCode: 101003
commit: v0.101-alpha3
subdir: app
gradle:
- true
- yes
- versionName: 0.101-alpha4
versionCode: 101004
commit: v0.101-alpha4
subdir: app
gradle:
- true
- yes
- versionName: 0.101-alpha5
versionCode: 101005
commit: v0.101-alpha5
subdir: app
gradle:
- true
- yes
- versionName: 0.101-alpha6
versionCode: 101006
commit: v0.101-alpha6
subdir: app
gradle:
- true
- yes
- versionName: '0.101'
versionCode: 101050
commit: v0.101
subdir: app
gradle:
- true
- yes
- versionName: 0.102-alpha1
versionCode: 102001
commit: v0.102-alpha1
subdir: app
gradle:
- true
- yes
- versionName: 0.102-alpha2
versionCode: 102002
commit: v0.102-alpha2
subdir: app
gradle:
- true
- yes
- versionName: 0.102-alpha3
versionCode: 102003
commit: v0.102-alpha3
subdir: app
gradle:
- true
- yes
- versionName: '0.102'
versionCode: 102050
commit: v0.102
subdir: app
gradle:
- true
- yes
- versionName: 0.102.1
versionCode: 102150
commit: v0.102.1
subdir: app
gradle:
- true
- yes
- versionName: 0.102.2
versionCode: 102250
commit: v0.102.2
subdir: app
gradle:
- true
- yes
- versionName: 0.102.3
versionCode: 102350
commit: v0.102.3
subdir: app
gradle:
- true
- yes
- versionName: 0.103-alpha1
versionCode: 103001
commit: v0.103-alpha1
subdir: app
gradle:
- true
- yes
- versionName: 0.103-alpha2
versionCode: 103002
commit: v0.103-alpha2
subdir: app
gradle:
- true
- yes
- versionName: 0.103-alpha3
versionCode: 103003
commit: v0.103-alpha3
subdir: app
gradle:
- true
- yes
ArchivePolicy: 12 versions
AutoUpdateMode: None

View file

@ -70,194 +70,6 @@ class MetadataTest(unittest.TestCase):
# yaml.add_representer(fdroidserver.metadata.Build, _build_yaml_representer)
# yaml.dump(frommeta, f, default_flow_style=False)
def test_write_yaml_allfields(self):
mf = io.StringIO()
app = fdroidserver.metadata.App()
app.Disabled = True
app.AntiFeatures = ['Karl', 'Bert']
app.Provides = "org.fdroid.fdroid"
app.Categories = ['Secret', 'Stuff']
app.License = 'GPL-3.0-or-later'
app.AuthorName = 'He who must not be named.'
app.AuthorEmail = 'tom@f-droid.org'
app.AuthorWebSite = 'https://f-droid.org/~theDarkLord'
app.WebSite = 'https://f-droid.org'
app.SourceCode = 'https://gitlab.com/fdroid/fdroidclient.git'
app.IssueTracker = "https://gitlab.com/fdroid/fdroidclient/issues"
app.Translation = 'https://hosted.weblate.org/projects/f-droid/f-droid'
app.Changelog = 'https://example.com/fdroidclient/raw/master/CHANGELOG.md'
app.Donate = 'https://f-droid.org/about'
app.FlattrID = '343053'
app.LiberapayID = '27859'
app.Bitcoin = '15u8aAPK4jJ5N8wpWJ5gutAyyeHtKX5i18'
app.Litecoin = '000000000000000000000000000000000'
app.Name = 'F-Droid'
app.AutoName = 'F-Droid'
app.Summary = 'The app store that respects freedom and privacy'
app.Description = 'The app store that respects freedom and privacy'
app.RequiresRoot = True
app.RepoType = 'git'
app.Repo = 'https://gitlab.com/fdroid/fdroidclient.git'
app.Binaries = 'https://f-droid.org/fdroid-%v.apk'
app.builds = []
build = fdroidserver.metadata.Build()
build.versionName = '1.0.1'
build.versionCode = 101
build.disable = 'for this reason'
build.commit = '1.0.1'
build.timeout = 12345
build.subdir = 'app'
build.submodules = True
build.sudo = 'apt-get update -y && apt-get upgrade -y'
build.init = 'sed -i -e "/replace this/with that/" build.gradle'
build.patch = ['remove-play-services.patch', 'add-other-service.patch']
build.gradle = 'flavor'
build.maven = True
build.buildozer = True
build.output = 'app/build/fdroid-$$VERSION$$.zip'
build.scrlibs = ['DragSort@0.6.1,3', 'SlidingMenu@7ebe32772']
build.oldsdkloc = True
build.encoding = 'utf-8'
build.forceversion = True
build.forcevercode = True
build.rm = ['app/file1', 'app/file2', 'app/other*']
build.extlibs = ['android/android-support-v4.jar', 'android/android-support-v13.jar']
build.prebuild = 'sed -i -e "/replace this/with that/" build.gradle'
build.androidupdate = [False]
build.target = 'android-99'
build.scanignore = ['libs/a.so', 'libs/b.so']
build.scandelete = ['bin/exec', 'bin/run']
build.build = 'export NDK_DIR=$$NDK$$'
build.buildjni = True
build.ndk = 'r99b'
build.preassemble = ':gradleTask'
build.gradleprops = 'prop4gradle'
build.antcommands = 'package'
build.novcheck = True
build.antifeatures = ['Karl', 'Hank']
app.builds.append(build)
app.MaintainerNotes = 'Great app, highly recommended.'
app.ArchivePolicy = '3 versions'
app.AutoUpdateMode = 'None'
app.UpdateCheckMode = 'Tags'
app.UpdateCheckIgnore = '(alpha|beta|rc|RC|dev)'
app.VercodeOperation = '%c + 2'
app.UpdateCheckName = 'org.fdroid.fdroid'
app.UpdateCheckData = 'https://raw.githubusercontent.com/proj/app/master/AndroidManifest.xml|android:versionCode="([0-9]*)"|.|android:versionCode="([0-9]*)"'
app.CurrentVersion = '1.0.1'
app.CurrentVersionCode = 101
app.NoSourceSince = '1.0.1'
fdroidserver.metadata.write_yaml(mf, app)
mf.seek(0)
self.maxDiff = None
self.assertEqual(mf.read(), textwrap.dedent("""\
Disabled: true
AntiFeatures:
- Karl
- Bert
Provides: org.fdroid.fdroid
Categories:
- Secret
- Stuff
License: GPL-3.0-or-later
AuthorName: He who must not be named.
AuthorEmail: tom@f-droid.org
AuthorWebSite: https://f-droid.org/~theDarkLord
WebSite: https://f-droid.org
SourceCode: https://gitlab.com/fdroid/fdroidclient.git
IssueTracker: https://gitlab.com/fdroid/fdroidclient/issues
Translation: https://hosted.weblate.org/projects/f-droid/f-droid
Changelog: https://example.com/fdroidclient/raw/master/CHANGELOG.md
Donate: https://f-droid.org/about
FlattrID: '343053'
LiberapayID: '27859'
Bitcoin: 15u8aAPK4jJ5N8wpWJ5gutAyyeHtKX5i18
Litecoin: '000000000000000000000000000000000'
Name: F-Droid
AutoName: F-Droid
Summary: The app store that respects freedom and privacy
Description: |-
The app store that respects freedom and privacy
RequiresRoot: true
RepoType: git
Repo: https://gitlab.com/fdroid/fdroidclient.git
Binaries: https://f-droid.org/fdroid-%v.apk
Builds:
- versionName: 1.0.1
versionCode: 101
disable: for this reason
commit: 1.0.1
timeout: 12345
subdir: app
submodules: true
sudo:
- apt-get update -y
- apt-get upgrade -y
init: sed -i -e "/replace this/with that/" build.gradle
patch:
- remove-play-services.patch
- add-other-service.patch
gradle: flavor
maven: true
buildozer: true
output: app/build/fdroid-$$VERSION$$.zip
oldsdkloc: true
encoding: utf-8
forceversion: true
forcevercode: true
rm:
- app/file1
- app/file2
- app/other*
extlibs:
- android/android-support-v4.jar
- android/android-support-v13.jar
prebuild: sed -i -e "/replace this/with that/" build.gradle
androidupdate:
- false
target: android-99
scanignore:
- libs/a.so
- libs/b.so
scandelete:
- bin/exec
- bin/run
build: export NDK_DIR=$$NDK$$
buildjni: true
ndk: r99b
preassemble: :gradleTask
gradleprops: prop4gradle
antcommands: package
novcheck: true
antifeatures:
- Karl
- Hank
MaintainerNotes: |-
Great app, highly recommended.
ArchivePolicy: 3 versions
AutoUpdateMode: None
UpdateCheckMode: Tags
UpdateCheckIgnore: (alpha|beta|rc|RC|dev)
VercodeOperation: '%c + 2'
UpdateCheckName: org.fdroid.fdroid
UpdateCheckData: https://raw.githubusercontent.com/proj/app/master/AndroidManifest.xml|android:versionCode="([0-9]*)"|.|android:versionCode="([0-9]*)"
CurrentVersion: 1.0.1
CurrentVersionCode: 101
NoSourceSince: 1.0.1"""))
def test_rewrite_yaml_fakeotaupdate(self):
testdir = tempfile.mkdtemp(prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir)
fdroidserver.common.config = {'accepted_formats': ['txt', 'yml']}
@ -495,68 +307,6 @@ class MetadataTest(unittest.TestCase):
'prebuild': "a && b && "
"sed -i 's,a,b,'"}]})
def test_write_yaml_description_with_trailing_whitespace(self):
mf = io.StringIO()
app = fdroidserver.metadata.App()
app.Categories = ['None']
app.Description = "this evil description has a trailing whitespace "
app.builds = []
build = fdroidserver.metadata.Build()
build.versionCode = 102030
build.versionName = 'v1.2.3'
build.build = "./gradlew compile"
app.builds.append(build)
fdroidserver.metadata.write_yaml(mf, app)
mf.seek(0)
self.maxDiff = None
self.assertEqual(mf.read(), textwrap.dedent("""\
Categories:
- None
License: Unknown
Description: |-
this evil description has a trailing whitespace
Builds:
- versionName: v1.2.3
versionCode: 102030
build: ./gradlew compile
AutoUpdateMode: None
UpdateCheckMode: None
"""))
def test_write_yaml_long_description(self):
mf = io.StringIO()
app = fdroidserver.metadata.App()
app.Categories = ['None']
app.Description = "long description is long; " * 20
app.builds = []
build = fdroidserver.metadata.Build()
build.versionCode = 102030
build.versionName = 'v1.2.3'
build.build = "./gradlew compile"
app.builds.append(build)
fdroidserver.metadata.write_yaml(mf, app)
mf.seek(0)
self.maxDiff = None
self.assertEqual(mf.read(), textwrap.dedent("""\
Categories:
- None
License: Unknown
Description: |-
long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long; long description is long;
Builds:
- versionName: v1.2.3
versionCode: 102030
build: ./gradlew compile
AutoUpdateMode: None
UpdateCheckMode: None
"""))
def test_write_yaml_1_line_scripts_as_string(self):
mf = io.StringIO()
app = fdroidserver.metadata.App()
@ -711,37 +461,6 @@ class MetadataTest(unittest.TestCase):
UpdateCheckMode: None
"""))
def test_write_yaml_very_long_script(self):
mf = io.StringIO()
app = fdroidserver.metadata.App()
app.Categories = ['None']
app.builds = []
build = fdroidserver.metadata.Build()
build.versionCode = 102030
build.versionName = 'v1.2.3'
build.build = "./gradlew someSpecialTask && sed -i 'd/that wrong config/' gradle.properties && ./gradlew compile && long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long;"
app.builds.append(build)
fdroidserver.metadata.write_yaml(mf, app)
mf.seek(0)
self.maxDiff = None
self.assertEqual(mf.read(), textwrap.dedent("""\
Categories:
- None
License: Unknown
Builds:
- versionName: v1.2.3
versionCode: 102030
build:
- ./gradlew someSpecialTask
- sed -i 'd/that wrong config/' gradle.properties
- ./gradlew compile
- long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long; long script is very long;
AutoUpdateMode: None
UpdateCheckMode: None
"""))
if __name__ == "__main__":
os.chdir(os.path.dirname(__file__))