├── tests ├── data1 ├── data2 ├── importme.py ├── importme2.py ├── hello.sh ├── testpython.py ├── hello.tar.xz ├── org.test.Hello.png ├── org.test.Hello-256.png ├── source1.json ├── source2.json ├── test-keyring │ ├── pubring.gpg │ ├── secring.gpg │ ├── README │ └── meson.build ├── test-keyring2 │ ├── pubring.gpg │ ├── secring.gpg │ ├── README │ └── meson.build ├── empty-configure ├── Hello.desktop ├── data1.patch ├── data2.patch ├── tap.test.in ├── org.test.Hello.desktop ├── org.flatpak_builder.gui.desktop ├── module2.yaml ├── module1.yaml ├── org.test.Deprecated.MD5.file.yaml ├── org.test.Deprecated.MD5.archive.yaml ├── org.test.Deprecated.SHA1.file.yaml ├── org.test.Deprecated.SHA1.archive.yaml ├── module2.json ├── test-runtime.json ├── test-configure ├── Hello.appdata.xml ├── Hello-desktop.appdata.xml ├── org.test.Hello.appdata.xml ├── Hello.xml ├── org.test.Deprecated.MD5.file.json ├── org.test.Deprecated.MD5.archive.json ├── org.test.Deprecated.SHA1.file.json ├── org.test.Deprecated.SHA1.archive.json ├── module1.json ├── org.test.Hello.xml ├── org.flatpak.install_test.json ├── org.flatpak_builder.gui.json ├── org.test.Python2.json ├── make-test-bundles.sh ├── org.flatpak_builder.gui.metainfo.xml ├── org.flatpak.appstream_media.json ├── org.test.Python.json ├── test-builder-python.sh ├── make-test-app.sh ├── flatpak.supp ├── session.conf.in ├── test.yaml ├── make-test-runtime.sh ├── meson.build ├── test-builder-deprecated.sh ├── test.json ├── test-rename.json ├── test-rename-appdata.json ├── test-builder.sh └── 0001-Add-test-logo.patch ├── flatpak.png ├── .gitmodules ├── uncrustify.sh ├── subprojects ├── libglnx.wrap └── libyaml.wrap ├── .github ├── workflows │ ├── block-autosquash-commits.yml │ └── check.yml └── ISSUE_TEMPLATE │ ├── feature_template.yml │ └── bug_template.yml ├── doc ├── xmlto-config.xsl ├── flatpak-builder-docs.xml.in ├── docbook.css └── meson.build ├── src ├── builder-source-inline.h ├── builder-source-bzr.h ├── builder-source-dir.h ├── builder-source-git.h ├── builder-source-svn.h ├── builder-source-file.h ├── builder-source-patch.h ├── builder-source-shell.h ├── builder-source-script.h ├── builder-source-archive.h ├── builder-source-extra-data.h ├── builder-post-process.h ├── builder-sdk-config.h ├── meson.build ├── builder-extension.h ├── builder-git.h ├── builder-cache.h ├── builder-options.h ├── builder-source.h ├── builder-module.h ├── builder-sdk-config.c ├── builder-source-inline.c ├── builder-source-shell.c ├── builder-source-script.c ├── builder-manifest.h └── builder-source-extra-data.c ├── meson_options.txt ├── SECURITY.md ├── meson.build ├── .gitignore ├── MAINT.md ├── README.md └── uncrustify.cfg /tests/data1: -------------------------------------------------------------------------------- 1 | Some data1 2 | -------------------------------------------------------------------------------- /tests/data2: -------------------------------------------------------------------------------- 1 | some data2 2 | -------------------------------------------------------------------------------- /tests/importme.py: -------------------------------------------------------------------------------- 1 | import sys 2 | foo = "first " 3 | -------------------------------------------------------------------------------- /tests/importme2.py: -------------------------------------------------------------------------------- 1 | import sys 2 | foo = "modified" 3 | -------------------------------------------------------------------------------- /tests/hello.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "Hello world, from a sandbox" 3 | -------------------------------------------------------------------------------- /flatpak.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatpak/flatpak-builder/HEAD/flatpak.png -------------------------------------------------------------------------------- /tests/testpython.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python2 2 | 3 | import importme 4 | print importme.foo 5 | -------------------------------------------------------------------------------- /tests/hello.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatpak/flatpak-builder/HEAD/tests/hello.tar.xz -------------------------------------------------------------------------------- /tests/org.test.Hello.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatpak/flatpak-builder/HEAD/tests/org.test.Hello.png -------------------------------------------------------------------------------- /tests/org.test.Hello-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatpak/flatpak-builder/HEAD/tests/org.test.Hello-256.png -------------------------------------------------------------------------------- /tests/source1.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "shell", 3 | "commands": ["echo 'Hello, from source 1' > source1"] 4 | } 5 | -------------------------------------------------------------------------------- /tests/source2.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "shell", 3 | "commands": ["echo 'Hello, from source 2' > source2"] 4 | } 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libglnx"] 2 | path = subprojects/libglnx 3 | url = https://gitlab.gnome.org/GNOME/libglnx.git 4 | -------------------------------------------------------------------------------- /tests/test-keyring/pubring.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatpak/flatpak-builder/HEAD/tests/test-keyring/pubring.gpg -------------------------------------------------------------------------------- /tests/test-keyring/secring.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatpak/flatpak-builder/HEAD/tests/test-keyring/secring.gpg -------------------------------------------------------------------------------- /tests/test-keyring2/pubring.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatpak/flatpak-builder/HEAD/tests/test-keyring2/pubring.gpg -------------------------------------------------------------------------------- /tests/test-keyring2/secring.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flatpak/flatpak-builder/HEAD/tests/test-keyring2/secring.gpg -------------------------------------------------------------------------------- /uncrustify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | uncrustify -c uncrustify.cfg --no-backup `git ls-tree --name-only -r HEAD | grep \\\.[ch]$ | grep -v gvdb` 3 | -------------------------------------------------------------------------------- /tests/empty-configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat < Makefile 4 | all: 5 | echo Building 6 | 7 | install: 8 | echo Installing 9 | EOF 10 | -------------------------------------------------------------------------------- /subprojects/libglnx.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://gitlab.gnome.org/GNOME/libglnx.git 3 | revision = head 4 | 5 | [provide] 6 | libglnx = libglnx_dep 7 | -------------------------------------------------------------------------------- /tests/Hello.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Name=Hello 5 | Exec=hello2.sh 6 | Icon=Hello 7 | MimeType=x-test/Hello; 8 | Categories=Utility; -------------------------------------------------------------------------------- /tests/data1.patch: -------------------------------------------------------------------------------- 1 | --- data1 2017-04-24 09:24:02.861719643 +0200 2 | +++ data1.mod 2017-04-24 09:35:44.589157410 +0200 3 | @@ -1 +1 @@ 4 | -Some data1 5 | +Some modified data1 6 | -------------------------------------------------------------------------------- /tests/test-keyring/README: -------------------------------------------------------------------------------- 1 | These are completely random keys, which include the secret key. 2 | Use these for testing gpg signing, do *NOT* ever use these for any 3 | real application. 4 | -------------------------------------------------------------------------------- /tests/test-keyring2/README: -------------------------------------------------------------------------------- 1 | These are completely random keys, which include the secret key. 2 | Use these for testing gpg signing, do *NOT* ever use these for any 3 | real application. 4 | -------------------------------------------------------------------------------- /tests/data2.patch: -------------------------------------------------------------------------------- 1 | --- tests/data2 2017-04-24 09:31:18.793726921 +0200 2 | +++ tests/data2.mod 2017-04-24 09:36:26.485552769 +0200 3 | @@ -1 +1 @@ 4 | -some data2 5 | +some modified data2 6 | -------------------------------------------------------------------------------- /tests/tap.test.in: -------------------------------------------------------------------------------- 1 | [Test] 2 | Type=session 3 | Exec=env G_TEST_SRCDIR=@installed_testdir@ G_TEST_BUILDDIR=@installed_testdir@ @wrapper@ @installed_testdir@/@basename@ --tap 4 | Output=TAP 5 | -------------------------------------------------------------------------------- /tests/org.test.Hello.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Name=Hello 5 | Exec=hello2.sh 6 | Icon=org.test.Hello2 7 | MimeType=x-test/Hello; 8 | Categories=Utility; 9 | -------------------------------------------------------------------------------- /tests/org.flatpak_builder.gui.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Example 3 | GenericName=Example 4 | Comment=Example 5 | Exec=hello %U 6 | Icon=org.flatpak_builder.gui 7 | Type=Application 8 | Categories=Network; 9 | Version=1.1 10 | -------------------------------------------------------------------------------- /tests/test-keyring/meson.build: -------------------------------------------------------------------------------- 1 | if get_option('installed_tests') 2 | install_data( 3 | 'README', 4 | 'pubring.gpg', 5 | 'secring.gpg', 6 | 7 | install_dir : installed_testdir / 'test-keyring', 8 | install_mode : 'rw-r--r--', 9 | ) 10 | endif 11 | -------------------------------------------------------------------------------- /tests/test-keyring2/meson.build: -------------------------------------------------------------------------------- 1 | if get_option('installed_tests') 2 | install_data( 3 | 'README', 4 | 'pubring.gpg', 5 | 'secring.gpg', 6 | 7 | install_dir : installed_testdir / 'test-keyring2', 8 | install_mode : 'rw-r--r--', 9 | ) 10 | endif 11 | -------------------------------------------------------------------------------- /tests/module2.yaml: -------------------------------------------------------------------------------- 1 | name: module2 2 | buildsystem: simple 3 | ensure-writable: [ /modify_me ] 4 | build-commands: 5 | - 'echo module2 > /app/ran_module2' 6 | - 'echo module2 > /app/modify_me' 7 | sources: 8 | - type: file 9 | path: data2 10 | - type: patch 11 | path: data2.patch 12 | -------------------------------------------------------------------------------- /tests/module1.yaml: -------------------------------------------------------------------------------- 1 | name: module1 2 | modules: 3 | - name: module1-first 4 | buildsystem: simple 5 | build-commands: 6 | - 'echo module1 > /app/ran_module1' 7 | - 'echo module1 > /app/modify_me' 8 | sources: 9 | - type: file 10 | path: data1 11 | - type: patch 12 | strip-components: 0 13 | path: data1.patch 14 | - include2/module2.yaml 15 | -------------------------------------------------------------------------------- /.github/workflows/block-autosquash-commits.yml: -------------------------------------------------------------------------------- 1 | on: pull_request 2 | 3 | name: Pull Requests 4 | 5 | jobs: 6 | message-check: 7 | name: Block Autosquash Commits 8 | 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Block Autosquash Commits 13 | uses: xt0rted/block-autosquash-commits-action@v2.0.0 14 | with: 15 | repo-token: ${{ secrets.GITHUB_TOKEN }} 16 | -------------------------------------------------------------------------------- /tests/org.test.Deprecated.MD5.file.yaml: -------------------------------------------------------------------------------- 1 | app-id: org.test.Deprecated.MD5 2 | runtime: org.test.Platform 3 | sdk: org.test.Sdk 4 | command: hello.sh 5 | modules: 6 | - name: hello 7 | buildsystem: simple 8 | build-commands: 9 | - mkdir -p /app/bin 10 | - cp hello.sh /app/bin/hello.sh 11 | sources: 12 | - type: file 13 | path: hello.sh 14 | md5: 01b72b71479e0fd308e5129cfb8a2b2b 15 | -------------------------------------------------------------------------------- /tests/org.test.Deprecated.MD5.archive.yaml: -------------------------------------------------------------------------------- 1 | app-id: org.test.Deprecated.MD5 2 | runtime: org.test.Platform 3 | sdk: org.test.Sdk 4 | command: hello.sh 5 | modules: 6 | - name: hello 7 | buildsystem: simple 8 | build-commands: 9 | - mkdir -p /app/bin 10 | - cp hello.sh /app/bin/hello.sh 11 | sources: 12 | - type: archive 13 | path: hello.tar.xz 14 | md5: f5b8be5ff2fa2ed63006b5e9b14e1d13 15 | -------------------------------------------------------------------------------- /tests/org.test.Deprecated.SHA1.file.yaml: -------------------------------------------------------------------------------- 1 | app-id: org.test.Deprecated.SHA1 2 | runtime: org.test.Platform 3 | sdk: org.test.Sdk 4 | command: hello.sh 5 | modules: 6 | - name: hello 7 | buildsystem: simple 8 | build-commands: 9 | - mkdir -p /app/bin 10 | - cp hello.sh /app/bin/hello.sh 11 | sources: 12 | - type: file 13 | path: hello.sh 14 | sha1: e1f2618c8c35d282026ef57dce85c5cb6df1f27b 15 | -------------------------------------------------------------------------------- /tests/org.test.Deprecated.SHA1.archive.yaml: -------------------------------------------------------------------------------- 1 | app-id: org.test.Deprecated.SHA1 2 | runtime: org.test.Platform 3 | sdk: org.test.Sdk 4 | command: hello.sh 5 | modules: 6 | - name: hello 7 | buildsystem: simple 8 | build-commands: 9 | - mkdir -p /app/bin 10 | - cp hello.sh /app/bin/hello.sh 11 | sources: 12 | - type: archive 13 | path: hello.tar.xz 14 | sha1: 0d2bf9dcdc338fa1ce97ae628b96244411b8d326 15 | -------------------------------------------------------------------------------- /tests/module2.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module2", 3 | "buildsystem": "simple", 4 | "ensure-writable": [ "/modify_me"], 5 | "build-commands": [ 6 | "echo module2 > /app/ran_module2", 7 | "echo module2 > /app/modify_me" 8 | ], 9 | "sources": [ 10 | { 11 | "type": "file", 12 | "path": "data2" 13 | }, 14 | { 15 | "type": "patch", 16 | "path": "data2.patch" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /subprojects/libyaml.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = yaml-0.2.5 3 | source_url = https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz 4 | source_filename = yaml-0.2.5.tar.gz 5 | source_hash = c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4 6 | patch_filename = libyaml_0.2.5-1_patch.zip 7 | patch_url = https://wrapdb.mesonbuild.com/v2/libyaml_0.2.5-1/get_patch 8 | patch_hash = bf2e9b922be00b6b00c5fce29d9fb8dc83f0431c77239f3b73e8b254d3f3f5b5 9 | 10 | [provide] 11 | yaml-0.1 = yaml_dep 12 | 13 | -------------------------------------------------------------------------------- /tests/test-runtime.json: -------------------------------------------------------------------------------- 1 | { 2 | "build-runtime": true, 3 | "id": "org.test.Hello.Sdk", 4 | "id-platform": "org.test.Hello.Platform", 5 | "runtime": "org.test.Platform", 6 | "sdk": "org.test.Sdk", 7 | "tags": ["test"], 8 | "cleanup-commands": [ "fdghksdfjhsdfkg" ], 9 | "cleanup-platform-commands": [ "sdjfgkafyewgdbvhsail" ], 10 | "build-options": { 11 | "build-args": ["--help"] 12 | }, 13 | 14 | "modules": [ 15 | { 16 | "name": "empty" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /doc/xmlto-config.xsl: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | # 8 | 9 | 10 | -------------------------------------------------------------------------------- /tests/test-configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ x$2 != 'x--some-arg' ] ; then 4 | exit 2 5 | fi 6 | 7 | cat < Makefile 8 | all: 9 | echo Building 10 | if [ "x\$(CFLAGS)" != "x-O2 -g" ]; then exit 1; fi 11 | if [ "x\$(FOO)" != xbar ]; then exit 1; fi 12 | if [ "x\$(BAR)" != x2 ]; then exit 1; fi 13 | 14 | install: 15 | echo Installing 16 | if [ "x\$(FOO)" != xbar ]; then exit 1; fi 17 | if [ "x\$(BAR)" != x3 ]; then exit 1; fi 18 | mkdir -p /app/bin 19 | cp -a hello2.sh /app/bin/ 20 | mkdir -p /app/share 21 | cp -a app-data /app/share/ 22 | EOF 23 | -------------------------------------------------------------------------------- /tests/Hello.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello.desktop 4 | CC0-1.0 5 | CC0-1.0 6 | 7 | Hello 8 | Hello test app 9 | 10 |

Just a test app

11 |
12 | Hello.desktop 13 | 14 | 15 | 16 |
17 | -------------------------------------------------------------------------------- /tests/Hello-desktop.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello.desktop 4 | CC0-1.0 5 | CC0-1.0 6 | 7 | Hello 8 | Hello test app 9 | 10 |

Just a test app

11 |
12 | org.test.Hello2.desktop 13 | 14 | 15 | 16 |
17 | -------------------------------------------------------------------------------- /tests/org.test.Hello.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.test.Hello2 4 | CC0-1.0 5 | CC0-1.0 6 | 7 | Hello 8 | Hello test app 9 | 10 |

Just a test app

11 |
12 | org.test.Hello2.desktop 13 | 14 | 15 | 16 |
17 | -------------------------------------------------------------------------------- /tests/Hello.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello Document 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Goodbye Document 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/org.test.Deprecated.MD5.file.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id": "org.test.Deprecated.MD5", 3 | "runtime": "org.test.Platform", 4 | "sdk": "org.test.Sdk", 5 | "command": "hello.sh", 6 | "modules": [ 7 | { 8 | "name": "hello", 9 | "buildsystem": "simple", 10 | "build-commands": [ "mkdir -p /app/bin", "cp hello.sh /app/bin/hello.sh" ], 11 | "sources": [ 12 | { 13 | "type": "file", 14 | "path": "hello.sh", 15 | "md5": "01b72b71479e0fd308e5129cfb8a2b2b" 16 | } 17 | ] 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /tests/org.test.Deprecated.MD5.archive.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id": "org.test.Deprecated.MD5", 3 | "runtime": "org.test.Platform", 4 | "sdk": "org.test.Sdk", 5 | "command": "hello.sh", 6 | "modules": [ 7 | { 8 | "name": "hello", 9 | "buildsystem": "simple", 10 | "build-commands": [ "mkdir -p /app/bin", "cp hello.sh /app/bin/hello.sh" ], 11 | "sources": [ 12 | { 13 | "type": "archive", 14 | "path": "hello.tar.xz", 15 | "md5": "f5b8be5ff2fa2ed63006b5e9b14e1d13" 16 | } 17 | ] 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /tests/org.test.Deprecated.SHA1.file.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id": "org.test.Deprecated.SHA1", 3 | "runtime": "org.test.Platform", 4 | "sdk": "org.test.Sdk", 5 | "command": "hello.sh", 6 | "modules": [ 7 | { 8 | "name": "hello", 9 | "buildsystem": "simple", 10 | "build-commands": [ "mkdir -p /app/bin", "cp hello.sh /app/bin/hello.sh" ], 11 | "sources": [ 12 | { 13 | "type": "file", 14 | "path": "hello.sh", 15 | "sha1": "e1f2618c8c35d282026ef57dce85c5cb6df1f27b" 16 | } 17 | ] 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /tests/org.test.Deprecated.SHA1.archive.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id": "org.test.Deprecated.SHA1", 3 | "runtime": "org.test.Platform", 4 | "sdk": "org.test.Sdk", 5 | "command": "hello.sh", 6 | "modules": [ 7 | { 8 | "name": "hello", 9 | "buildsystem": "simple", 10 | "build-commands": [ "mkdir -p /app/bin", "cp hello.sh /app/bin/hello.sh" ], 11 | "sources": [ 12 | { 13 | "type": "archive", 14 | "path": "hello.tar.xz", 15 | "sha1": "0d2bf9dcdc338fa1ce97ae628b96244411b8d326" 16 | } 17 | ] 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /src/builder-source-inline.h: -------------------------------------------------------------------------------- 1 | #ifndef __BUILDER_SOURCE_INLINE_H__ 2 | #define __BUILDER_SOURCE_INLINE_H__ 3 | 4 | #include "builder-source.h" 5 | 6 | G_BEGIN_DECLS 7 | 8 | typedef struct BuilderSourceInline BuilderSourceInline; 9 | 10 | #define BUILDER_TYPE_SOURCE_INLINE (builder_source_inline_get_type ()) 11 | #define BUILDER_SOURCE_INLINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_INLINE, BuilderSourceInline)) 12 | #define BUILDER_IS_SOURCE_INLINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_INLINE)) 13 | 14 | GType builder_source_inline_get_type (void); 15 | 16 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceInline, g_object_unref) 17 | 18 | G_END_DECLS 19 | 20 | #endif /* __BUILDER_SOURCE_INLINE_H__ */ 21 | -------------------------------------------------------------------------------- /tests/module1.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module1", 3 | "modules": [ 4 | { 5 | "name": "module1-first", 6 | "buildsystem": "simple", 7 | "build-commands": [ 8 | "echo module1 > /app/ran_module1", 9 | "echo module1 > /app/modify_me" 10 | ], 11 | "sources": [ 12 | { 13 | "type": "file", 14 | "path": "data1" 15 | }, 16 | { 17 | "type": "patch", 18 | "strip-components": 0, 19 | "path": "data1.patch" 20 | } 21 | ] 22 | }, 23 | "include2/module2.json" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /tests/org.test.Hello.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello Document 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Goodbye Document 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option( 2 | 'yaml', 3 | type: 'feature', 4 | value: 'enabled', 5 | description: 'Whether to support YAML manifests' 6 | ) 7 | option( 8 | 'docs', 9 | type: 'feature', 10 | value: 'auto', 11 | description: 'Whether to build the DocBook documentation and man pages' 12 | ) 13 | option( 14 | 'installed_tests', 15 | type : 'boolean', 16 | description : 'install automated tests', 17 | value : false, 18 | ) 19 | option( 20 | 'tests', 21 | type: 'boolean', 22 | value: true, 23 | description: 'Whether to build and run unit tests' 24 | ) 25 | option( 26 | 'fuse', 27 | type: 'combo', 28 | choices: ['2', '3', 'compatible'], 29 | value: 'compatible', 30 | description: 'Target a specific version of FUSE for best performance or support multiple versions' 31 | ) 32 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security policy for Flatpak builder 2 | 3 | ## Supported versions 4 | 5 | Please see the [readme](https://github.com/flatpak/flatpak-builder/tree/main?tab=readme-ov-file#supported-versions). 6 | 7 | ## Reporting vulnerabilities 8 | 9 | Please DO NOT report security issues via public mediums such as 10 | GitHub issues, forums, public mailing lists or Matrix. 11 | 12 | Please report all security issues via an email to the private mailing list 13 | [flatpak-security@lists.freedesktop.org](mailto:flatpak-security@lists.freedesktop.org). 14 | 15 | ## Security announcements 16 | 17 | The [flatpak@lists.freedesktop.org](mailto:flatpak@lists.freedesktop.org) 18 | email list is used for messages about Flatpak security announcements. 19 | You can join the list [here](https://lists.freedesktop.org/mailman/listinfo/flatpak). 20 | Security issues may also be announced via GitHub security advisories. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_template.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Request a feature 3 | body: 4 | - type: checkboxes 5 | attributes: 6 | label: Checklist 7 | description: Please make sure you have read the following. 8 | options: 9 | - label: I agree to follow the [Code of Conduct](https://github.com/flatpak/flatpak/blob/master/CODE_OF_CONDUCT.md) that this project adheres to. 10 | required: true 11 | - label: I have searched the [issue tracker](https://www.github.com/flatpak/flatpak-builder/issues) for a feature request that matches the one I want to file, without success. 12 | required: true 13 | - type: textarea 14 | attributes: 15 | label: Suggestion 16 | description: A clear and concise description of what you would like to see in the upcoming releases. Afterwards, describe the specific use case(s) that would be helped by this enhancement. 17 | validations: 18 | required: true 19 | -------------------------------------------------------------------------------- /tests/org.flatpak.install_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "org.flatpak.install_test", 3 | "runtime": "org.test.Platform", 4 | "sdk": "org.test.Sdk", 5 | "command": "hello", 6 | "modules": [ 7 | { 8 | "name": "install_test", 9 | "buildsystem": "simple", 10 | "build-commands": [ 11 | "mkdir -p ${FLATPAK_DEST}/bin ${FLATPAK_DEST}/lib/debug ${FLATPAK_DEST}/share/locale/es", 12 | "cp -vf hello.sh ${FLATPAK_DEST}/bin/hello", 13 | "echo foo > ${FLATPAK_DEST}/lib/debug/hello.debug", 14 | "echo foo > ${FLATPAK_DEST}/share/locale/es/hello.mo" 15 | ], 16 | "sources": [ 17 | { 18 | "type": "script", 19 | "dest-filename": "hello.sh", 20 | "commands": [ 21 | "echo \"Hello world, from a sandbox\"" 22 | ] 23 | } 24 | ] 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /tests/org.flatpak_builder.gui.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "org.flatpak_builder.gui", 3 | "runtime": "org.test.Platform", 4 | "sdk": "org.test.Sdk", 5 | "command": "hello", 6 | "appstream-compose": false, 7 | "modules": [ 8 | { 9 | "name": "hello_gui", 10 | "buildsystem": "simple", 11 | "build-commands": [ 12 | "mkdir -p ${FLATPAK_DEST}/bin", 13 | "cp -vf hello.sh ${FLATPAK_DEST}/bin/hello", 14 | "DIR=\"${FLATPAK_DEST}/share/app-info/media/org/flatpak_builder/gui/foobar/icons/64x64\" && mkdir -p \"$DIR\" && cp -vf org.test.Hello.png \"$DIR\"" 15 | ], 16 | "sources": [ 17 | { 18 | "type": "script", 19 | "dest-filename": "hello.sh", 20 | "commands": [ 21 | "echo \"Hello world, from a sandbox\"" 22 | ] 23 | }, 24 | { 25 | "type": "file", 26 | "path": "org.test.Hello.png" 27 | } 28 | ] 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /doc/flatpak-builder-docs.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 5 | ]> 6 | 7 | 8 | Version @VERSION@ 9 | 10 | Flatpak Builder Command Reference 11 | 12 | 13 | The command reference is generated from the flatpak-builder repo; see 14 | 15 | 16 | 17 | 18 | Flatpak-builder is a tool to build flatpak applications. 19 | 20 | 21 | 22 | Executables 23 | 24 | 25 | 26 | File Formats 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/org.test.Python2.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id": "org.test.Python2", 3 | "runtime": "org.test.PythonPlatform", 4 | "sdk": "org.test.PythonSdk", 5 | "command": "testpython.py", 6 | "modules": [ 7 | { 8 | "name": "compiled-python", 9 | "post-install": [ 10 | "mkdir /app/bin", 11 | "cp testpython.py /app/bin", 12 | "cp importme.py /app/bin", 13 | /* Compile importme.py */ 14 | "/app/bin/testpython.py", 15 | /* Remove .py file, but keep .pyc */ 16 | "rm /app/bin/importme.py", 17 | /* Make sure it still works */ 18 | "/app/bin/testpython.py" 19 | ], 20 | "sources": [ 21 | { 22 | "type": "file", 23 | "path": "empty-configure", 24 | "dest-filename": "configure" 25 | }, 26 | { 27 | "type": "file", 28 | "path": "testpython.py" 29 | }, 30 | { 31 | "type": "file", 32 | "path": "importme.py" 33 | } 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /doc/docbook.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | font-family: sans-serif; 4 | } 5 | h1.title 6 | { 7 | } 8 | .permission 9 | { 10 | color: #ee0000; 11 | text-decoration: underline; 12 | } 13 | .synopsis, .classsynopsis 14 | { 15 | background: #eeeeee; 16 | border: solid 1px #aaaaaa; 17 | padding: 0.5em; 18 | } 19 | .programlisting 20 | { 21 | background: #eeeeff; 22 | border: solid 1px #aaaaff; 23 | padding: 0.5em; 24 | } 25 | .variablelist 26 | { 27 | padding: 4px; 28 | margin-left: 3em; 29 | } 30 | .variablelist td:first-child 31 | { 32 | vertical-align: top; 33 | } 34 | td.shortcuts 35 | { 36 | color: #770000; 37 | font-size: 80%; 38 | } 39 | div.refnamediv 40 | { 41 | margin-top: 2em; 42 | } 43 | div.toc 44 | { 45 | border: 2em; 46 | } 47 | a 48 | { 49 | text-decoration: none; 50 | } 51 | a:hover 52 | { 53 | text-decoration: underline; 54 | color: #FF0000; 55 | } 56 | 57 | div.table table 58 | { 59 | border-collapse: collapse; 60 | border-spacing: 0px; 61 | border-style: solid; 62 | border-color: #777777; 63 | border-width: 1px; 64 | } 65 | 66 | div.table table td, div.table table th 67 | { 68 | border-style: solid; 69 | border-color: #777777; 70 | border-width: 1px; 71 | padding: 3px; 72 | vertical-align: top; 73 | } 74 | 75 | div.table table th 76 | { 77 | background-color: #eeeeee; 78 | } 79 | -------------------------------------------------------------------------------- /tests/make-test-bundles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | set -x 5 | 6 | ./make-test-runtime.sh org.test.Platform bash ls cat echo readlink 7 | ./make-test-app.sh 8 | 9 | URL=file://`pwd`/repo 10 | 11 | REF=`(cd repo/refs/heads; echo app/org.test.Hello/*/master)` 12 | 13 | flatpak build-bundle repo hello.flatpak org.test.Hello 14 | flatpak build-bundle repo hello-key.flatpak --gpg-keys=test-keyring/pubring.gpg org.test.Hello 15 | flatpak build-bundle repo --repo-url=${URL} hello-origin.flatpak org.test.Hello 16 | flatpak build-bundle repo --repo-url=${URL} --gpg-keys=test-keyring/pubring.gpg hello-key-origin.flatpak org.test.Hello 17 | 18 | ostree gpg-sign --repo=repo --gpg-homedir=test-keyring ${REF} 7B0961FD 19 | 20 | flatpak build-bundle repo hello-signed.flatpak org.test.Hello 21 | flatpak build-bundle repo hello-key-signed.flatpak --gpg-keys=test-keyring/pubring.gpg org.test.Hello 22 | flatpak build-bundle repo --repo-url=${URL} hello-origin-signed.flatpak org.test.Hello 23 | flatpak build-bundle repo --repo-url=${URL} --gpg-keys=test-keyring/pubring.gpg hello-key-origin-signed.flatpak org.test.Hello 24 | 25 | REF=`(cd repo/refs/heads; echo runtime/org.test.Platform/*/master)` 26 | ostree gpg-sign --repo=repo --gpg-homedir=test-keyring ${REF} 7B0961FD 27 | flatpak build-bundle --runtime repo --repo-url=${URL} --gpg-keys=test-keyring/pubring.gpg platform.flatpak org.test.Platform 28 | 29 | gpg-connect-agent --homedir test-keyring killagent /bye || true 30 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project( 2 | 'flatpak-builder', 3 | 'c', 4 | license: 'LGPL-2.1-or-later', 5 | meson_version: '>= 0.56.2', 6 | version: '1.5.0', 7 | default_options: 'c_std=gnu99', 8 | ) 9 | 10 | cc = meson.get_compiler('c') 11 | 12 | project_c_args = [ 13 | '-Werror=empty-body', 14 | '-Werror=strict-prototypes', 15 | '-Werror=missing-prototypes', 16 | '-Werror=implicit-function-declaration', 17 | '-Werror=format=2', 18 | '-Werror=format-security', 19 | '-Werror=format-nonliteral', 20 | '-Werror=pointer-arith', 21 | '-Werror=init-self', 22 | '-Werror=missing-declarations', 23 | '-Werror=return-type', 24 | '-Werror=overflow', 25 | '-Werror=int-conversion', 26 | '-Werror=parentheses', 27 | '-Werror=incompatible-pointer-types', 28 | '-Werror=misleading-indentation', 29 | '-Werror=missing-include-dirs', 30 | # Necessary for non POSIX stuff in glibc like fallocate 31 | '-D_GNU_SOURCE', 32 | ] 33 | 34 | foreach arg : project_c_args 35 | if cc.has_argument(arg) 36 | add_project_arguments(arg, language: 'c') 37 | endif 38 | endforeach 39 | 40 | # The debugedit program is a hard dependency 41 | debugedit = find_program('debugedit', version: '>= 5.0') 42 | 43 | # Require appstream with compose plugin installed 44 | appstreamcli = find_program('appstreamcli', version: '>= 0.15.0') 45 | appstreamcli_compose = run_command(appstreamcli, ['compose', '--help'], check: true) 46 | 47 | subdir('src') 48 | subdir('doc') 49 | if get_option('tests') 50 | subdir('tests') 51 | endif 52 | -------------------------------------------------------------------------------- /src/builder-source-bzr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_BZR_H__ 22 | #define __BUILDER_SOURCE_BZR_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceBzr BuilderSourceBzr; 29 | 30 | #define BUILDER_TYPE_SOURCE_BZR (builder_source_bzr_get_type ()) 31 | #define BUILDER_SOURCE_BZR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_BZR, BuilderSourceBzr)) 32 | #define BUILDER_IS_SOURCE_BZR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_BZR)) 33 | 34 | GType builder_source_bzr_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceBzr, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_BZR_H__ */ 41 | -------------------------------------------------------------------------------- /src/builder-source-dir.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_DIR_H__ 22 | #define __BUILDER_SOURCE_DIR_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceDir BuilderSourceDir; 29 | 30 | #define BUILDER_TYPE_SOURCE_DIR (builder_source_dir_get_type ()) 31 | #define BUILDER_SOURCE_DIR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_DIR, BuilderSourceDir)) 32 | #define BUILDER_IS_SOURCE_DIR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_DIR)) 33 | 34 | GType builder_source_dir_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceDir, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_DIR_H__ */ 41 | -------------------------------------------------------------------------------- /src/builder-source-git.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_GIT_H__ 22 | #define __BUILDER_SOURCE_GIT_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceGit BuilderSourceGit; 29 | 30 | #define BUILDER_TYPE_SOURCE_GIT (builder_source_git_get_type ()) 31 | #define BUILDER_SOURCE_GIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_GIT, BuilderSourceGit)) 32 | #define BUILDER_IS_SOURCE_GIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_GIT)) 33 | 34 | GType builder_source_git_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceGit, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_GIT_H__ */ 41 | -------------------------------------------------------------------------------- /src/builder-source-svn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_SVN_H__ 22 | #define __BUILDER_SOURCE_SVN_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceSvn BuilderSourceSvn; 29 | 30 | #define BUILDER_TYPE_SOURCE_SVN (builder_source_svn_get_type ()) 31 | #define BUILDER_SOURCE_SVN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_SVN, BuilderSourceSvn)) 32 | #define BUILDER_IS_SOURCE_SVN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_SVN)) 33 | 34 | GType builder_source_svn_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceSvn, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_SVN_H__ */ 41 | -------------------------------------------------------------------------------- /src/builder-source-file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_FILE_H__ 22 | #define __BUILDER_SOURCE_FILE_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceFile BuilderSourceFile; 29 | 30 | #define BUILDER_TYPE_SOURCE_FILE (builder_source_file_get_type ()) 31 | #define BUILDER_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_FILE, BuilderSourceFile)) 32 | #define BUILDER_IS_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_FILE)) 33 | 34 | GType builder_source_file_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceFile, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_FILE_H__ */ 41 | -------------------------------------------------------------------------------- /src/builder-source-patch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_PATCH_H__ 22 | #define __BUILDER_SOURCE_PATCH_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourcePatch BuilderSourcePatch; 29 | 30 | #define BUILDER_TYPE_SOURCE_PATCH (builder_source_patch_get_type ()) 31 | #define BUILDER_SOURCE_PATCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_PATCH, BuilderSourcePatch)) 32 | #define BUILDER_IS_SOURCE_PATCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_PATCH)) 33 | 34 | GType builder_source_patch_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourcePatch, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_PATCH_H__ */ 41 | -------------------------------------------------------------------------------- /src/builder-source-shell.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_SHELL_H__ 22 | #define __BUILDER_SOURCE_SHELL_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceShell BuilderSourceShell; 29 | 30 | #define BUILDER_TYPE_SOURCE_SHELL (builder_source_shell_get_type ()) 31 | #define BUILDER_SOURCE_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_SHELL, BuilderSourceShell)) 32 | #define BUILDER_IS_SOURCE_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_SHELL)) 33 | 34 | GType builder_source_shell_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceShell, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_SHELL_H__ */ 41 | -------------------------------------------------------------------------------- /src/builder-source-script.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_SCRIPT_H__ 22 | #define __BUILDER_SOURCE_SCRIPT_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceScript BuilderSourceScript; 29 | 30 | #define BUILDER_TYPE_SOURCE_SCRIPT (builder_source_script_get_type ()) 31 | #define BUILDER_SOURCE_SCRIPT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_SCRIPT, BuilderSourceScript)) 32 | #define BUILDER_IS_SOURCE_SCRIPT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_SCRIPT)) 33 | 34 | GType builder_source_script_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceScript, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_SCRIPT_H__ */ 41 | -------------------------------------------------------------------------------- /src/builder-source-archive.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_ARCHIVE_H__ 22 | #define __BUILDER_SOURCE_ARCHIVE_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceArchive BuilderSourceArchive; 29 | 30 | #define BUILDER_TYPE_SOURCE_ARCHIVE (builder_source_archive_get_type ()) 31 | #define BUILDER_SOURCE_ARCHIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_ARCHIVE, BuilderSourceArchive)) 32 | #define BUILDER_IS_SOURCE_ARCHIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_ARCHIVE)) 33 | 34 | GType builder_source_archive_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceArchive, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_ARCHIVE_H__ */ 41 | -------------------------------------------------------------------------------- /tests/org.flatpak_builder.gui.metainfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.flatpak_builder.gui 4 | org.flatpak_builder.gui.desktop 5 | CC0-1.0 6 | GPL-2.0+ 7 | org.flatpak_builder.gui 8 | Flatpak 9 | Foo foo foo foo 10 | https://flatpak.org 11 | 12 |

An example desktop application

13 |
14 | 15 | 21 | 22 | An example screenshot 23 | https://raw.githubusercontent.com/flatpak/flatpak.github.io/0b56895e271bbcc7f86f9570933a96adff99e110/source/img/endless-apps.original.png 24 | 25 | 26 | An example screenshot 27 | https://docs.flathub.org/img/card.png 28 | 29 | 30 | https://flatpak.org 31 | 32 | 33 | 34 | 35 |
36 | -------------------------------------------------------------------------------- /src/builder-source-extra-data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_EXTRA_DATA_H__ 22 | #define __BUILDER_SOURCE_EXTRA_DATA_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceExtraData BuilderSourceExtraData; 29 | 30 | #define BUILDER_TYPE_SOURCE_EXTRA_DATA (builder_source_extra_data_get_type ()) 31 | #define BUILDER_SOURCE_EXTRA_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_EXTRA_DATA, BuilderSourceExtraData)) 32 | #define BUILDER_IS_SOURCE_EXTRA_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_EXTRA_DATA)) 33 | 34 | GType builder_source_extra_data_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceExtraData, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_EXTRA_DATA_H__ */ 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | flatpak 2 | flatpak-*.tar.xz 3 | flatpak-session-helper 4 | xdg-document-portal 5 | xdg-permission-store 6 | flatpak-builder 7 | flatpak-builder-debugedit 8 | testdb 9 | *~ 10 | profile/flatpak.sh 11 | flatpak-dbus.[ch] 12 | flatpak-systemd-dbus.[ch] 13 | flatpak-resources.[ch] 14 | flatpak-dbus-proxy 15 | permission-store-dbus.[ch] 16 | flatpak-system-helper 17 | xdg-desktop-portal 18 | *.service 19 | flatpak.conf 20 | flatpak.env 21 | flatpak.sh 22 | document-portal/xdp-dbus.[ch] 23 | document-portal/xdp-resources.[ch] 24 | .dirstamp 25 | test-suite*.log 26 | lib/flatpak-version-macros.h 27 | flatpak.pc 28 | lib/flatpak-enum-types.c 29 | lib/flatpak-enum-types.h 30 | test-libflatpak 31 | Flatpak-1.0.* 32 | /doc/reference/gtkdoc-check.log 33 | /doc/reference/gtkdoc-check.test 34 | /doc/reference/gtkdoc-check.trs 35 | /doc/reference/version.xml 36 | /doc/flatpak-builder-docs.html 37 | /doc/flatpak-builder-docs.xml 38 | /doc/*.1 39 | /doc/*.5 40 | /test-doc-portal 41 | /test-doc-portal.log 42 | /test-doc-portal.trs 43 | /testdb.log 44 | /testdb.trs 45 | /tests/test-keyring/.gpg-v21-migrated 46 | /tests/test-keyring/private-keys-v1.d/ 47 | /tests/test-keyring/trustdb.gpg 48 | /tests/test-keyring2/.gpg-v21-migrated 49 | /tests/test-keyring2/private-keys-v1.d/ 50 | /tests/test-keyring2/trustdb.gpg 51 | /tests/hello*.flatpak 52 | /tests/platform*.flatpak 53 | /tests/repo 54 | /tests/package_version.txt 55 | *.test 56 | /tests/*.sh.log 57 | /tests/*.sh.test 58 | /tests/*.sh.trs 59 | po/.intltool-merge-cache 60 | po/Flatpak.pot 61 | po/*.gmo 62 | po/*.sed 63 | po/*.header 64 | po/*.sin 65 | system-helper/org.freedesktop.Flatpak.policy 66 | system-helper/org.freedesktop.Flatpak.rules 67 | flatpak-bwrap 68 | py-compile 69 | libglnx-config.h 70 | -------------------------------------------------------------------------------- /src/builder-post-process.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_POST_PROCESS_H__ 22 | #define __BUILDER_POST_PROCESS_H__ 23 | 24 | #include "builder-cache.h" 25 | #include "builder-context.h" 26 | 27 | G_BEGIN_DECLS 28 | 29 | typedef enum { 30 | BUILDER_POST_PROCESS_FLAGS_NONE = 0, 31 | BUILDER_POST_PROCESS_FLAGS_PYTHON_TIMESTAMPS = 1<<0, 32 | BUILDER_POST_PROCESS_FLAGS_STRIP = 1<<1, 33 | BUILDER_POST_PROCESS_FLAGS_DEBUGINFO = 1<<2, 34 | BUILDER_POST_PROCESS_FLAGS_DEBUGINFO_COMPRESSION = 1<<3, 35 | } BuilderPostProcessFlags; 36 | 37 | gboolean builder_post_process (BuilderPostProcessFlags flags, 38 | GFile *app_dir, 39 | BuilderCache *cache, 40 | BuilderContext *context, 41 | GError **error); 42 | 43 | G_END_DECLS 44 | 45 | #endif /* __BUILDER_POST_PROCESS_H__ */ 46 | -------------------------------------------------------------------------------- /tests/org.flatpak.appstream_media.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "org.flatpak.appstream_media", 3 | "runtime": "org.test.Platform", 4 | "sdk": "org.test.Sdk", 5 | "rename-desktop-file": "org.flatpak_builder.gui.desktop", 6 | "rename-appdata-file": "org.flatpak_builder.gui.metainfo.xml", 7 | "rename-icon": "org.test.Hello-256", 8 | "command": "hello", 9 | "modules": [ 10 | { 11 | "name": "appstream_media", 12 | "buildsystem": "simple", 13 | "build-commands": [ 14 | "mkdir -p ${FLATPAK_DEST}/bin ${FLATPAK_DEST}/share/metainfo ${FLATPAK_DEST}/share/applications", 15 | "mkdir -p ${FLATPAK_DEST}/share/icons/hicolor/256x256/apps", 16 | "cp -vf hello.sh ${FLATPAK_DEST}/bin/hello", 17 | "cp -vf org.flatpak_builder.gui.metainfo.xml ${FLATPAK_DEST}/share/metainfo", 18 | "cp -vf org.flatpak_builder.gui.desktop ${FLATPAK_DEST}/share/applications", 19 | "cp -vf org.test.Hello-256.png ${FLATPAK_DEST}/share/icons/hicolor/256x256/apps" 20 | ], 21 | "sources": [ 22 | { 23 | "type": "script", 24 | "dest-filename": "hello.sh", 25 | "commands": [ 26 | "echo \"Hello world, from a sandbox\"" 27 | ] 28 | }, 29 | { 30 | "type": "file", 31 | "path": "org.flatpak_builder.gui.desktop" 32 | }, 33 | { 34 | "type": "file", 35 | "path": "org.flatpak_builder.gui.metainfo.xml" 36 | }, 37 | { 38 | "type": "file", 39 | "path": "org.test.Hello-256.png" 40 | } 41 | ] 42 | } 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /tests/org.test.Python.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id": "org.test.Python", 3 | "runtime": "org.test.PythonPlatform", 4 | "sdk": "org.test.PythonSdk", 5 | "command": "testpython.py", 6 | "modules": [ 7 | { 8 | "name": "compiled-python", 9 | "post-install": [ 10 | "mkdir /app/bin", 11 | "cp testpython.py /app/bin", 12 | "cp importme.py /app/bin", 13 | /* Compile importme.py */ 14 | "/app/bin/testpython.py" 15 | ], 16 | "sources": [ 17 | { 18 | "type": "file", 19 | "path": "empty-configure", 20 | "dest-filename": "configure" 21 | }, 22 | { 23 | "type": "file", 24 | "path": "testpython.py" 25 | }, 26 | { 27 | "type": "file", 28 | "path": "importme.py" 29 | } 30 | ] 31 | }, 32 | { 33 | "name": "modify-python", 34 | "post-install": [ 35 | "cp --remove-destination importme2.py /app/bin/importme.py" 36 | ], 37 | "sources": [ 38 | { 39 | "type": "file", 40 | "path": "empty-configure", 41 | "dest-filename": "configure" 42 | }, 43 | { 44 | "type": "file", 45 | "path": "importme2.py" 46 | } 47 | ] 48 | }, 49 | { 50 | "name": "recompile-modified-python", 51 | "post-install": [ 52 | "/app/bin/testpython.py" 53 | ], 54 | "sources": [ 55 | { 56 | "type": "file", 57 | "path": "empty-configure", 58 | "dest-filename": "configure" 59 | } 60 | ] 61 | } 62 | ] 63 | } 64 | -------------------------------------------------------------------------------- /src/builder-sdk-config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Codethink Limited 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Valentin David 19 | */ 20 | 21 | #ifndef __BUILDER_SDK_CONFIG_H__ 22 | #define __BUILDER_SDK_CONFIG_H__ 23 | 24 | #include 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | typedef struct BuilderSdkConfig BuilderSdkConfig; 30 | 31 | #define BUILDER_TYPE_SDK_CONFIG (builder_sdk_config_get_type ()) 32 | #define BUILDER_SDK_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SDK_CONFIG, BuilderSdkConfig)) 33 | 34 | GType builder_sdk_config_get_type (void); 35 | 36 | const char * builder_sdk_config_get_libdir (BuilderSdkConfig *self); 37 | const char * builder_sdk_config_get_cppflags (BuilderSdkConfig *self); 38 | const char * builder_sdk_config_get_cflags (BuilderSdkConfig *self); 39 | const char * builder_sdk_config_get_cxxflags (BuilderSdkConfig *self); 40 | const char * builder_sdk_config_get_ldflags (BuilderSdkConfig *self); 41 | 42 | BuilderSdkConfig *builder_sdk_config_from_file (GFile *file, 43 | GError **error); 44 | 45 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSdkConfig, g_object_unref) 46 | 47 | G_END_DECLS 48 | 49 | #endif /* __BUILDER_SDK_CONFIG_H__ */ 50 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_template.yml: -------------------------------------------------------------------------------- 1 | name: Bug report 2 | description: Report a bug in flatpak-builder 3 | body: 4 | - type: checkboxes 5 | attributes: 6 | label: Checklist 7 | description: Please make sure you have read the following. 8 | options: 9 | - label: I agree to follow the [Code of Conduct](https://github.com/flatpak/flatpak/blob/master/CODE_OF_CONDUCT.md) that this project adheres to. 10 | required: true 11 | - label: I have searched the [issue tracker](https://www.github.com/flatpak/flatpak-builder/issues) for a bug that matches the one I want to file, without success. 12 | required: true 13 | - type: input 14 | attributes: 15 | label: flatpak-builder version 16 | description: What version of flatpak-builder are you using? If unsure, run `flatpak-builder --version` in the terminal. 17 | placeholder: 1.2.0 18 | validations: 19 | required: true 20 | - type: input 21 | attributes: 22 | label: Flatpak version 23 | description: What version of Flatpak are you using? If unsure, run `flatpak --version` in the terminal. 24 | placeholder: 1.10.2 25 | validations: 26 | required: true 27 | - type: textarea 28 | attributes: 29 | label: How to reproduce 30 | description: A clear description of how to reproduce the problem. 31 | placeholder: | 32 | 1. Go to `...` 33 | 2. Click on `...` 34 | 3. Scroll down to `...` 35 | 4. See error 36 | validations: 37 | required: false 38 | - type: textarea 39 | attributes: 40 | label: Expected Behavior 41 | description: A clear and concise description of what you expected to happen. 42 | validations: 43 | required: true 44 | - type: textarea 45 | attributes: 46 | label: Actual Behavior 47 | description: A clear description of what actually happens. 48 | validations: 49 | required: true 50 | - type: textarea 51 | attributes: 52 | label: Additional Information 53 | description: If your problem needs further explanation, or if the issue you're seeing cannot be reproduced in a gist, please add more information here. 54 | -------------------------------------------------------------------------------- /tests/test-builder-python.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2011 Colin Walters 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the 17 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 | # Boston, MA 02111-1307, USA. 19 | 20 | set -euo pipefail 21 | 22 | . $(dirname $0)/libtest.sh 23 | 24 | skip_without_fuse 25 | skip_without_python2 26 | 27 | echo "1..2" 28 | 29 | setup_repo 30 | install_repo 31 | setup_python2_repo 32 | install_python2_repo 33 | 34 | # Need /var/tmp cwd for xattrs 35 | REPO=`pwd`/repo 36 | cd $TEST_DATA_DIR/ 37 | 38 | cp $(dirname $0)/org.test.Python.json . 39 | cp $(dirname $0)/org.test.Python2.json . 40 | cp -a $(dirname $0)/empty-configure . 41 | cp -a $(dirname $0)/testpython.py . 42 | cp $(dirname $0)/importme.py . 43 | cp $(dirname $0)/importme2.py . 44 | chmod u+w *.py 45 | flatpak-builder --force-clean appdir org.test.Python.json >&2 46 | 47 | assert_has_file appdir/files/bin/importme.pyc 48 | 49 | flatpak-builder --run appdir org.test.Python.json testpython.py > testpython.out 50 | 51 | assert_file_has_content testpython.out ^modified$ 52 | 53 | echo "ok handled pyc rewriting multiple times" 54 | 55 | flatpak-builder --force-clean appdir org.test.Python2.json >&2 56 | 57 | assert_not_has_file appdir/files/bin/importme.py 58 | assert_has_file appdir/files/bin/importme.pyc 59 | 60 | flatpak-builder --run appdir org.test.Python2.json testpython.py > testpython.out 61 | 62 | assert_file_has_content testpython.out "^first $" 63 | 64 | echo "ok handled .pyc without .py" 65 | -------------------------------------------------------------------------------- /doc/meson.build: -------------------------------------------------------------------------------- 1 | xsltproc = find_program('xsltproc', required: get_option('docs')) 2 | xmlto = find_program('xmlto', required: get_option('docs')) 3 | 4 | if xmlto.found() and xsltproc.found() 5 | 6 | # TODO: is the docbook DTD/XSL catalog check needed or does xsltproc take care of that? 7 | configured_xml = configure_file( 8 | configuration: { 9 | 'VERSION': meson.project_version(), 10 | # FIXME: that's not a good way of this it… 11 | 'srcdir': meson.current_source_dir(), 12 | }, 13 | input: 'flatpak-builder-docs.xml.in', 14 | # depend_files: 15 | output: 'flatpak-builder-docs.xml', 16 | ) 17 | 18 | man_pages = [ 19 | ['flatpak-builder', '1'], 20 | ['flatpak-manifest', '5'], 21 | ] 22 | foreach man_page : man_pages 23 | man_page_name = '@0@.@1@'.format(man_page[0], man_page[1]) 24 | custom_target(man_page[0] + '-man', 25 | command: [ 26 | xsltproc, 27 | '--nonet', 28 | '--stringparam', 'man.output.quietly', '1', 29 | '--stringparam', 'funcsynopsis.style', 'ansi', 30 | '--stringparam', 'man.th.extra1.suppress', '1', 31 | '--stringparam', 'man.authors.section.enabled', '0', 32 | '--stringparam', 'man.copyright.section.enabled', '0', 33 | '--output', '@OUTPUT@', 34 | 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl', 35 | '@INPUT@' 36 | ], 37 | input: man_page[0] + '.xml', 38 | output: man_page_name, 39 | install: true, 40 | install_dir: get_option('mandir') / 'man' + man_page[1], 41 | ) 42 | endforeach 43 | 44 | doc_dir = get_option('datadir') / 'doc' / meson.project_name() 45 | html = custom_target('docbook', 46 | command: [ 47 | xmlto, 48 | '--skip-validation', 49 | 'xhtml-nochunks', 50 | '-o', meson.current_build_dir(), 51 | '-m', files('xmlto-config.xsl'), 52 | '@INPUT@', 53 | ], 54 | input: configured_xml, 55 | output: 'flatpak-builder-docs.html', 56 | install: true, 57 | install_dir: doc_dir, 58 | ) 59 | 60 | install_data( 61 | files('docbook.css'), 62 | install_dir: doc_dir, 63 | ) 64 | 65 | endif 66 | -------------------------------------------------------------------------------- /tests/make-test-app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | DIR=`mktemp -d` 6 | 7 | REPONAME=$1 8 | shift 9 | COLLECTION_ID=$1 10 | shift 11 | 12 | EXTRA="${1-}" 13 | 14 | ARCH=`flatpak --default-arch` 15 | 16 | # Init dir 17 | cat > ${DIR}/metadata < ${DIR}/files/bin/hello.sh < ${DIR}/files/share/applications/org.test.Hello.desktop < ${DIR}/files/share/app-info/xmls/org.test.Hello.xml.gz < 53 | 54 | 55 | org.test.Hello.desktop 56 | Hello world test app 57 | Print a greeting 58 |

This is a test app.

59 | 60 | Utility 61 | 62 | 64x64/org.gnome.gedit.png 63 |
64 |
65 | EOF 66 | cp $(dirname $0)/org.test.Hello.png ${DIR}/files/share/app-info/icons/flatpak/64x64/ 67 | 68 | if [ x$COLLECTION_ID != x ]; then 69 | collection_args=--collection-id=${COLLECTION_ID} 70 | else 71 | collection_args= 72 | fi 73 | 74 | flatpak build-finish --command=hello.sh ${DIR} 75 | mkdir -p repos 76 | flatpak build-export ${collection_args} ${GPGARGS-} repos/${REPONAME} ${DIR} 77 | rm -rf ${DIR} 78 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | flatpak_builder_sources = files( 2 | 'builder-cache.c', 3 | 'builder-context.c', 4 | 'builder-extension.c', 5 | 'builder-flatpak-utils.c', 6 | 'builder-git.c', 7 | 'builder-main.c', 8 | 'builder-manifest.c', 9 | 'builder-module.c', 10 | 'builder-options.c', 11 | 'builder-post-process.c', 12 | 'builder-sdk-config.c', 13 | 'builder-source.c', 14 | 'builder-source-archive.c', 15 | 'builder-source-bzr.c', 16 | 'builder-source-dir.c', 17 | 'builder-source-extra-data.c', 18 | 'builder-source-file.c', 19 | 'builder-source-git.c', 20 | 'builder-source-inline.c', 21 | 'builder-source-patch.c', 22 | 'builder-source-script.c', 23 | 'builder-source-shell.c', 24 | 'builder-source-svn.c', 25 | 'builder-utils.c', 26 | ) 27 | 28 | yaml_dep = dependency('yaml-0.1', required: get_option('yaml')) 29 | 30 | config_data = configuration_data() 31 | config_data.set('FLATPAK_BUILDER_ENABLE_YAML', yaml_dep.found()) 32 | config_data.set_quoted('DEBUGEDIT', debugedit.full_path()) 33 | config_data.set_quoted('GETTEXT_PACKAGE', meson.project_name()) 34 | config_data.set_quoted('PACKAGE_VERSION', meson.project_version()) 35 | config_data.set_quoted('PACKAGE_STRING', '@0@-@1@'.format(meson.project_name(), meson.project_version())) 36 | config_data.set('GLIB_VERSION_MAX_ALLOWED', 'GLIB_VERSION_2_70') 37 | config_data.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_66') 38 | 39 | # We support targeting specific fuse versions to optimize performance. 40 | # Currently only fuse2 has optimizations but this allows for future fuse3 41 | # optimizations. 42 | config_data.set('ASSUME_FUSE_2', get_option('fuse') == '2') 43 | 44 | config_h = configure_file( 45 | configuration: config_data, 46 | output: 'config.h', 47 | ) 48 | 49 | glib_req = '>= 2.66' 50 | flatpak_builder_deps = [ 51 | dependency('glib-2.0', version: glib_req), 52 | dependency('gio-2.0', version: glib_req), 53 | dependency('gio-unix-2.0', version: glib_req), 54 | dependency('json-glib-1.0'), 55 | dependency('libcurl'), 56 | dependency('libelf', version: '>= 0.8.12'), 57 | dependency('libglnx', default_options: ['tests=false']), 58 | dependency('libxml-2.0', version: '>= 2.4'), 59 | dependency('ostree-1', version: '>= 2017.14'), 60 | yaml_dep, 61 | ] 62 | 63 | flatpak_builder = executable( 64 | 'flatpak-builder', 65 | flatpak_builder_sources, 66 | dependencies: flatpak_builder_deps, 67 | install: true, 68 | ) 69 | 70 | -------------------------------------------------------------------------------- /MAINT.md: -------------------------------------------------------------------------------- 1 | ## Maintainance notes 2 | 3 | - Please see the [versioning policy](https://github.com/flatpak/flatpak-builder/tree/main?tab=readme-ov-file#supported-versions). 4 | - Stable branches will only get bugfixes and non-breaking enhancements. 5 | - Everything is merged to `main` and from time to time suitable changes 6 | are backported to the stable `flatpak-builder-1.EVEN_MINOR.x` 7 | branches. GitHub milestone can be used for tracking which PRs should 8 | be backported. 9 | - Stable tags are created from `flatpak-builder-1.EVEN_MINOR.x` branch. 10 | - Unstable tags are created from the `main` branch. 11 | - The first release of a new stable release line eg. `1.6.0` 12 | is tagged from `main`. After that the `flatpak-builder-1.6.x` branch 13 | is to be created and the `1.6.1` is made from that branch. During this 14 | time `main` should not receive breaking changes until the new 15 | stable branch is created. 16 | 17 | ## Releasing 18 | 19 | - Update the `NEWS` 20 | - Update version number in `meson.build`. 21 | - Open a PR titled "Release $VERSION" with the above to see if CI passes. 22 | - Merge the PR to the target branch. 23 | - Check out the target branch, pull the above change locally and make 24 | sure the submodules are correct and checked out. 25 | - Build with `meson`, with all options enabled. 26 | - Create a tarball with `meson dist --include-subprojects -C builddir`. 27 | The tarball is created from a clean checkout. It is produced as 28 | `builddir/meson-dist/flatpak-builder-$VERSION.tar.xz`. 29 | - Verify the project is buildable using the tarball. The tarball MUST 30 | contain the submodule files. 31 | 32 | ## Tagging 33 | 34 | - The tags are created in the `MAJOR.MINOR.PATCH` format eg. `1.4.6` 35 | (WITHOUT the `v*` prefix). 36 | - Ideally the tags should be signed and annotated tags. Optionally 37 | git-evtag can be used. 38 | - The tag message should have the changelog and the checksum of the 39 | tarball that will be attached to GitHub releases. 40 | - Once the tag is pushed, a GitHub release from that tag is to be 41 | created. 42 | 43 | The release tag is the new tag, the title is `VERSION` and the release 44 | body is the message from the tag. Additional notifications and details 45 | can be documented to the release body. 46 | 47 | Then the `flatpak-builder-$VERSION.tar.xz` tarball is to be attahced. 48 | This is the primary way downstreams consume Flatpak builder. 49 | 50 | 51 | NOTE: GitHub releases are set as _immutable_, so please be careful. 52 | -------------------------------------------------------------------------------- /tests/flatpak.supp: -------------------------------------------------------------------------------- 1 | # Use this to suppress "possibly lost" for global statics 2 | { 3 | handle_reflink 4 | Memcheck:Param 5 | ioctl(generic) 6 | fun:ioctl 7 | fun:btrfs_reflink_with_progress 8 | fun:file_copy_fallback 9 | } 10 | 11 | # https://github.com/ostreedev/ostree/issues/533 12 | { 13 | ignore_static_delta_uninitialized 14 | Memcheck:Cond 15 | ... 16 | fun:_ostree_lzma_compressor_convert 17 | fun:write_internal 18 | fun:g_output_stream_real_splice 19 | fun:g_output_stream_splice 20 | fun:ostree_repo_static_delta_generate 21 | } 22 | 23 | # There seem to be some leaks in "ostree pull", lets just ignore them for now 24 | { 25 | ignore_ostree_pull1 26 | Memcheck:Leak 27 | fun:malloc 28 | ... 29 | fun:ostree_fetcher_session_thread 30 | } 31 | { 32 | ignore_ostree_pull2 33 | Memcheck:Leak 34 | fun:realloc 35 | ... 36 | fun:ostree_fetcher_session_thread 37 | } 38 | { 39 | ignore_ostree_pull3 40 | Memcheck:Leak 41 | fun:malloc 42 | ... 43 | fun:ostree_repo_write_metadata_async 44 | } 45 | { 46 | ignore_ostree_pull4 47 | Memcheck:Leak 48 | fun:calloc 49 | ... 50 | fun:ostree_repo_write_metadata_async 51 | } 52 | { 53 | ignore_ostree_pull5 54 | Memcheck:Leak 55 | fun:malloc 56 | ... 57 | fun:write_metadata_thread 58 | } 59 | { 60 | ignore_ostree_pull6 61 | Memcheck:Leak 62 | fun:calloc 63 | ... 64 | fun:write_metadata_thread 65 | } 66 | # static delta generation seem to leak too... 67 | { 68 | ignore_ostree_delta1 69 | Memcheck:Leak 70 | fun:malloc 71 | ... 72 | fun:generate_delta_thread 73 | } 74 | { 75 | ignore_ostree_delta2 76 | Memcheck:Leak 77 | fun:calloc 78 | ... 79 | fun:generate_delta_thread 80 | } 81 | { 82 | ignore_ostree_delta3 83 | Memcheck:Leak 84 | fun:realloc 85 | ... 86 | fun:generate_delta_thread 87 | } 88 | # writing content... 89 | { 90 | ignore_ostree_write_content1 91 | Memcheck:Leak 92 | fun:g_type_create_instance 93 | ... 94 | fun:write_content_thread 95 | } 96 | { 97 | ignore_ostree_write_content2 98 | Memcheck:Leak 99 | fun:malloc 100 | ... 101 | fun:write_content_thread 102 | } 103 | { 104 | ignore_ostree_write_content3 105 | Memcheck:Leak 106 | fun:malloc 107 | ... 108 | fun:ostree_repo_write_content_async 109 | } 110 | 111 | # Some glib threadpool issue? 112 | { 113 | ignore_gthreadpool1 114 | Memcheck:Leak 115 | fun:calloc 116 | ... 117 | fun:g_idle_source_new 118 | ... 119 | fun:g_thread_pool_thread_proxy 120 | } 121 | -------------------------------------------------------------------------------- /src/builder-extension.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2017 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_EXTENSION_H__ 22 | #define __BUILDER_EXTENSION_H__ 23 | 24 | #include 25 | 26 | #include "builder-context.h" 27 | #include "builder-cache.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef struct BuilderExtension BuilderExtension; 32 | 33 | #define BUILDER_TYPE_EXTENSION (builder_extension_get_type ()) 34 | #define BUILDER_EXTENSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_EXTENSION, BuilderExtension)) 35 | #define BUILDER_IS_EXTENSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_EXTENSION)) 36 | 37 | /* Bump this if format changes in incompatible ways to force rebuild */ 38 | #define BUILDER_EXTENSION_CHECKSUM_VERSION "1" 39 | 40 | GType builder_extension_get_type (void); 41 | 42 | void builder_extension_set_name (BuilderExtension *self, 43 | const char *name); 44 | const char * builder_extension_get_name (BuilderExtension *self); 45 | const char * builder_extension_get_version (BuilderExtension *self); 46 | 47 | gboolean builder_extension_is_bundled (BuilderExtension *self); 48 | const char * builder_extension_get_directory (BuilderExtension *self); 49 | 50 | void builder_extension_add_remove_args (BuilderExtension *self, 51 | GPtrArray *args); 52 | void builder_extension_add_finish_args (BuilderExtension *self, 53 | GPtrArray *args); 54 | void builder_extension_checksum (BuilderExtension *self, 55 | BuilderCache *cache, 56 | BuilderContext *context); 57 | 58 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderExtension, g_object_unref) 59 | 60 | G_END_DECLS 61 | 62 | #endif /* __BUILDER_EXTENSION_H__ */ 63 | -------------------------------------------------------------------------------- /tests/session.conf.in: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | session 6 | 7 | 9 | 10 | 11 | unix:tmpdir=/tmp 12 | 13 | @testdir@/services 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | contexts/dbus_contexts 30 | 31 | 38 | 39 | 40 | 1000000000 41 | 250000000 42 | 1000000000 43 | 250000000 44 | 1000000000 45 | 4096 46 | 120000 47 | 240000 48 | 100000 49 | 10000 50 | 100000 51 | 10000 52 | 50000 53 | 50000 54 | 50000 55 | 56 | 57 | -------------------------------------------------------------------------------- /tests/test.yaml: -------------------------------------------------------------------------------- 1 | app-id: org.test.Hello2 2 | runtime: org.test.Platform 3 | sdk: org.test.Sdk 4 | command: hello2.sh 5 | tags: [test] 6 | token-type: 0 7 | finish-args: 8 | - --share=network 9 | build-options: 10 | cflags: -O2 -g 11 | cxxflags: -O2 -g 12 | env: 13 | FOO: bar 14 | V: '1' 15 | cleanup: [/cleanup, '*.cleanup'] 16 | cleanup-commands: [touch /app/cleaned_up] 17 | modules: 18 | - include1/module1.yaml 19 | - name: root 20 | modules: 21 | - name: test 22 | config-opts: [--some-arg] 23 | post-install: 24 | - touch /app/bin/file.cleanup 25 | - mkdir -p /app/share/icons/hicolor/64x64/apps/ 26 | - mkdir -p /app/share/icons/hicolor/64x64/mimetypes/ 27 | - cp org.test.Hello.png /app/share/icons/hicolor/64x64/apps/$FLATPAK_ID.png 28 | - cp org.test.Hello.png /app/share/icons/hicolor/64x64/mimetypes/$FLATPAK_ID.application-x-hello.png 29 | - cp org.test.Hello.png /app/share/icons/hicolor/64x64/mimetypes/$FLATPAK_ID.application-x-goodbye.png 30 | - mkdir -p /app/share/applications 31 | - cp org.test.Hello.desktop /app/share/applications/$FLATPAK_ID.desktop 32 | - mkdir -p /app/share/mime/packages 33 | - cp org.test.Hello.xml /app/share/mime/packages/$FLATPAK_ID.xml 34 | - mkdir -p /app/share/appdata 35 | - cp org.test.Hello.appdata.xml /app/share/appdata/$FLATPAK_ID.appdata.xml 36 | make-args: [BAR=2] 37 | make-install-args: [BAR=3] 38 | build-commands: ['echo foo > /app/out'] 39 | license-files: ['mytest/LICENSE'] 40 | sources: 41 | - type: file 42 | path: test-configure 43 | dest-filename: configure 44 | sha256: 675a1ac2feec4d4f54e581b4b01bc3cfd2c1cf31aa5963574d31228c8a11b7e7 45 | - type: file 46 | path: app-data 47 | - type: script 48 | dest-filename: hello2.sh 49 | commands: ['echo "Hello world2, from a sandbox"'] 50 | - type: file 51 | path: org.test.Hello.desktop 52 | - type: file 53 | path: org.test.Hello.appdata.xml 54 | - type: file 55 | path: org.test.Hello.xml 56 | - type: file 57 | path: LICENSE 58 | dest: mytest 59 | - type: shell 60 | commands: 61 | - mkdir /app/cleanup/ 62 | - touch /app/cleanup/a_file 63 | - type: patch 64 | path: 0001-Add-test-logo.patch 65 | use-git: true 66 | - name: test2 67 | build-commands: 68 | - echo foo2 > /app/out2 69 | - cp source[12] /app 70 | buildsystem: simple 71 | sources: 72 | - type: file 73 | path: app-data 74 | - include1/source1.json 75 | - include1/include2/source2.json 76 | - name: empty 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Flatpak icon 3 |

4 | 5 | `flatpak-builder` is a tool for building [flatpaks](https://flatpak.org) from sources. 6 | 7 | It reads a JSON or YAML based manifest to automatically download, build, and install projects which eventually get exported into a flatpak. 8 | 9 | For information on the manifest format see `man flatpak-manifest`. A JSON Schema for this format is [available here](https://github.com/flatpak/flatpak-builder/blob/main/data/flatpak-manifest.schema.json). 10 | 11 | To use the JSON schema, in [an editor with support](https://code.visualstudio.com/docs/languages/json) for schemas, you can include this line in your manifest: 12 | 13 | ```json 14 | "$schema": "https://raw.githubusercontent.com/flatpak/flatpak-builder/main/data/flatpak-manifest.schema.json" 15 | ``` 16 | 17 | For information on the command-line tool see `man flatpak-builder` or the [online documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html). 18 | 19 | # Installation 20 | 21 | Flatpak-builder uses the [Meson build system](https://mesonbuild.com/). To build just do: 22 | ```sh 23 | meson setup _build 24 | meson install -C _build 25 | ``` 26 | 27 | Configure arguments are documented in `meson_options.txt`. 28 | 29 | # Versioning Policy 30 | 31 | Flatpak Builder, like Flatpak, follows the GLib-style versioning policy, 32 | where the version is formatted as `MAJOR.MINOR.PATCH`. The `MAJOR` 33 | version is currently set to `1`. 34 | 35 | - Odd `MINOR` versions indicate an unstable release. 36 | - Even `MINOR` versions indicate a stable release. 37 | 38 | Stable releases are limited to bug fixes and minor, non-breaking 39 | improvements. Each stable release line is maintained on a dedicated 40 | `flatpak-builder-1.MINOR.x` branch. 41 | 42 | At any given time, only one unstable release line and only one stable 43 | release line are supported. 44 | 45 | ## Supported versions 46 | 47 | The currently supported release lines are: 48 | 49 | | Release line | Supported | Status | 50 | | -------------| ------------------ | --------------------| 51 | | 1.5.x | Yes | Development branch | 52 | | 1.4.x | Yes | Stable branch | 53 | 54 | ## Runtime dependencies 55 | 56 | The `flatpak-builder` tool requires `flatpak` being available on the host to 57 | function. Depending on the manifest used it also requires some commands be available on 58 | the host. 59 | 60 | Very commonly used: 61 | 62 | * sh 63 | * patch 64 | * tar 65 | * cp 66 | * git 67 | * 7z 68 | * bsdunzip (libarchive) 69 | * git-lfs 70 | 71 | Rarely used: 72 | 73 | * rpm2cpio & cpio 74 | * svn 75 | * bzr 76 | 77 | # Maintainance docs 78 | 79 | Please see the [maintainance docs](https://github.com/flatpak/flatpak-builder/blob/main/MAINT.md). 80 | -------------------------------------------------------------------------------- /src/builder-git.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_GIT_H__ 22 | #define __BUILDER_GIT_H__ 23 | 24 | #include "builder-context.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef enum { 29 | FLATPAK_GIT_MIRROR_FLAGS_UPDATE = 1 << 0, 30 | FLATPAK_GIT_MIRROR_FLAGS_MIRROR_SUBMODULES = 1 << 1, 31 | FLATPAK_GIT_MIRROR_FLAGS_DISABLE_FSCK = 1 << 2, 32 | FLATPAK_GIT_MIRROR_FLAGS_DISABLE_SHALLOW = 1 << 3, 33 | FLATPAK_GIT_MIRROR_FLAGS_WILL_FETCH_FROM = 1 << 4, 34 | FLATPAK_GIT_MIRROR_FLAGS_DISABLE_LFS = 1 << 5, 35 | } FlatpakGitMirrorFlags; 36 | 37 | gboolean builder_git_mirror_repo (const char *repo_location, 38 | const char *destination_path, 39 | FlatpakGitMirrorFlags flags, 40 | const char *ref, 41 | BuilderContext *context, 42 | GError **error); 43 | char * builder_git_get_current_commit (const char *repo_location, 44 | const char *branch, 45 | gboolean ensure_commit, 46 | BuilderContext *context, 47 | GError **error); 48 | gboolean builder_git_checkout (const char *repo_location, 49 | const char *branch, 50 | GFile *dest, 51 | BuilderContext *context, 52 | FlatpakGitMirrorFlags mirror_flags, 53 | GError **error); 54 | gboolean builder_git_shallow_mirror_ref (const char *repo_location, 55 | const char *destination_path, 56 | FlatpakGitMirrorFlags flags, 57 | const char *ref, 58 | BuilderContext *context, 59 | GError **error); 60 | char * builder_git_get_default_branch (const char *repo_location); 61 | 62 | G_END_DECLS 63 | 64 | #endif /* __BUILDER_GIT_H__ */ 65 | -------------------------------------------------------------------------------- /.github/workflows/check.yml: -------------------------------------------------------------------------------- 1 | name: Flatpak-builder CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - 'flatpak-builder-1.*.x' 8 | pull_request: 9 | branches: 10 | - main 11 | - 'flatpak-builder-1.*.x' 12 | 13 | env: 14 | DEBIAN_FRONTEND: noninteractive 15 | TESTS_TIMEOUT: 10 # in minutes 16 | 17 | permissions: 18 | contents: read 19 | 20 | jobs: 21 | check-meson: 22 | name: Ubuntu meson build 23 | runs-on: ${{ matrix.os }} 24 | strategy: 25 | matrix: 26 | os: ['ubuntu-22.04', 'ubuntu-24.04'] 27 | compiler: ['gcc', 'clang'] 28 | 29 | env: 30 | CC: ${{ matrix.compiler }} 31 | BASE_CFLAGS: -Wp,-D_FORTIFY_SOURCE=2 32 | BUILDDIR: builddir 33 | CONFIG_OPTS: -Dinstalled_tests=true 34 | 35 | steps: 36 | - name: Install Dependencies 37 | run: | 38 | sudo apt-get update 39 | sudo apt-get install -y \ 40 | ${{ matrix.compiler }} \ 41 | attr \ 42 | automake \ 43 | autopoint \ 44 | appstream-compose \ 45 | bison \ 46 | debugedit \ 47 | dbus \ 48 | desktop-file-utils \ 49 | elfutils \ 50 | flatpak \ 51 | gettext \ 52 | git \ 53 | gobject-introspection \ 54 | gtk-doc-tools \ 55 | libappstream-dev \ 56 | libarchive-dev \ 57 | libattr1-dev \ 58 | libcap-dev \ 59 | libcurl4-gnutls-dev \ 60 | libdconf-dev \ 61 | libdw-dev \ 62 | libelf-dev \ 63 | libflatpak-dev \ 64 | libfuse-dev \ 65 | libgirepository1.0-dev \ 66 | libglib2.0-dev \ 67 | libgpgme11-dev \ 68 | libjson-glib-dev \ 69 | libostree-dev \ 70 | libpolkit-agent-1-dev \ 71 | libpolkit-gobject-1-dev \ 72 | libseccomp-dev \ 73 | libsystemd-dev \ 74 | libxml2-utils \ 75 | libyaml-dev \ 76 | meson \ 77 | ostree \ 78 | patch \ 79 | shared-mime-info \ 80 | socat \ 81 | libarchive-tools \ 82 | docbook-xsl \ 83 | xmlto \ 84 | xsltproc \ 85 | git-lfs 86 | 87 | - name: Check out flatpak-builder 88 | uses: actions/checkout@v4 89 | 90 | - name: Configure flatpak-builder 91 | run: meson setup --wrap-mode nodownload ${CONFIG_OPTS} ${BUILDDIR} . 92 | 93 | - name: Build flatpak-builder with Meson 94 | run: meson compile -C ${BUILDDIR} 95 | 96 | - name: Upload docs 97 | uses: actions/upload-artifact@v4 98 | with: 99 | if-no-files-found: error 100 | overwrite: true 101 | name: docs 102 | path: | 103 | builddir/doc/ 104 | 105 | - name: Run tests with Meson 106 | run: timeout --signal=KILL -v ${TESTS_TIMEOUT}m meson test -C ${BUILDDIR} --verbose 107 | 108 | - name: Upload test logs 109 | uses: actions/upload-artifact@v4 110 | if: failure() || cancelled() 111 | with: 112 | name: test logs 113 | path: | 114 | builddir/meson-logs/testlog.txt 115 | installed-test-logs/ 116 | 117 | - name: Configure flatpak-builder with Meson wraps 118 | run: meson setup --wrap-mode=forcefallback ${CONFIG_OPTS} ${BUILDDIR}_wrap . 119 | 120 | - name: Build flatpak-builder with Meson wraps 121 | run: meson compile -C ${BUILDDIR}_wrap 122 | -------------------------------------------------------------------------------- /tests/make-test-runtime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # Don't inherit the -x from the testsuite 6 | set +x 7 | 8 | DIR=`mktemp -d` 9 | 10 | REPONAME=$1 11 | shift 12 | ID=$1 13 | shift 14 | COLLECTION_ID=$1 15 | shift 16 | 17 | mkdir ${DIR}/files 18 | mkdir ${DIR}/usr 19 | cat > ${DIR}/metadata <> $BINS 51 | 52 | # Add library dependencies 53 | (ldd "${f}" | sed "s/.* => //" | awk '{ print $1}' | grep ^/ | sort -u -o $LIBS $LIBS -) || true 54 | 55 | local shebang=$(sed -n '1s/^#!\([^ ]*\).*/\1/p' "${f}") 56 | if [ x$shebang != x ]; then 57 | add_bin "$shebang" 58 | fi 59 | } 60 | 61 | for i in $@; do 62 | I=`which $i` 63 | add_bin $I 64 | if test $i == python2; then 65 | mkdir -p ${DIR}/usr/lib/python2.7/lib-dynload 66 | # This is a hardcoded minimal set of modules we need in the current tests. 67 | # Pretty hacky stuff. Add modules as needed. 68 | PYDIR=/usr/lib/python2.7 69 | if test -d /usr/lib64/python2.7; then PYDIR=/usr/lib64/python2.7; fi 70 | for py in site os stat posixpath genericpath warnings \ 71 | linecache types UserDict abc _abcoll \ 72 | _weakrefset copy_reg traceback sysconfig \ 73 | re sre_compile sre_parse sre_constants \ 74 | _sysconfigdata ; do 75 | cp ${PYDIR}/$py.py ${DIR}/usr/lib/python2.7 76 | done 77 | # These might not exist, depending how Python was configured; and the 78 | # part after ${so} might be "module" or ".x86_64-linux-gnu" or 79 | # something else 80 | for so in _locale strop ; do 81 | cp ${PYDIR}/lib-dynload/${so}*.so ${DIR}/usr/lib/python2.7/lib-dynload || : 82 | done 83 | for plat in $( cd ${PYDIR} && echo plat-* ); do 84 | test -e ${PYDIR}/${plat} || continue 85 | mkdir -p ${DIR}/usr/lib/python2.7/${plat} 86 | cp ${PYDIR}/${plat}/*.py ${DIR}/usr/lib/python2.7/${plat}/ 87 | done 88 | fi 89 | done 90 | for i in `cat $BINS`; do 91 | echo Adding binary $i 1>&2 92 | cp "$i" ${DIR}/usr/bin/ 93 | done 94 | for i in `cat $LIBS`; do 95 | echo Adding library $i 1>&2 96 | cp "$i" ${DIR}/usr/lib/ 97 | done 98 | ln -s bash ${DIR}/usr/bin/sh 99 | 100 | # We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but 101 | # the real en_US locale is often not available, because its in the 102 | # local archive. 103 | mkdir -p ${DIR}/usr/lib/locale/ 104 | cp -r /usr/lib/locale/C.* ${DIR}/usr/lib/locale/en_US 105 | 106 | if [ x$COLLECTION_ID != x ]; then 107 | collection_args=--collection-id=${COLLECTION_ID} 108 | else 109 | collection_args= 110 | fi 111 | 112 | mkdir -p repos 113 | flatpak build-export ${collection_args} --runtime ${GPGARGS-} repos/${REPONAME} ${DIR} 114 | rm -rf ${DIR} 115 | -------------------------------------------------------------------------------- /tests/meson.build: -------------------------------------------------------------------------------- 1 | installed_testdir = get_option('prefix') / get_option('libexecdir') / 'installed-tests' / 'flatpak-builder' 2 | installed_tests_metadir = get_option('prefix') / get_option('datadir') / 'installed-tests' / 'flatpak-builder' 3 | 4 | test_env = environment() 5 | test_env.set('FLATPAK_TESTS_DEBUG', '1') 6 | test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) 7 | test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) 8 | test_env.prepend('PATH', meson.current_build_dir() / '..' / 'src', separator: ':') 9 | 10 | test_names = [ 11 | 'test-builder', 12 | 'test-builder-deprecated', 13 | 'test-builder-python', 14 | ] 15 | 16 | tap_test = find_program( 17 | files(meson.project_source_root() / 'buildutil/tap-test'), 18 | ) 19 | 20 | foreach test_name : test_names 21 | filename = test_name + '.sh' 22 | 23 | test( 24 | test_name, 25 | tap_test, 26 | args: [files(filename)], 27 | env: test_env, 28 | depends: flatpak_builder, 29 | protocol: 'tap', 30 | workdir: meson.current_build_dir(), 31 | ) 32 | 33 | if get_option('installed_tests') 34 | install_data( 35 | filename, 36 | install_dir : installed_testdir, 37 | install_mode : 'rwxr-xr-x', 38 | ) 39 | configure_file( 40 | input: 'tap.test.in', 41 | output: filename + '.test', 42 | configuration: { 43 | # After dropping Autotools we could use test_name here (avoiding the 44 | # redudant .sh), but for now include the .sh to keep the installed 45 | # files easier to compare with Autotools 46 | 'basename': filename, 47 | 'installed_testdir': installed_testdir, 48 | 'wrapper': '', 49 | }, 50 | install_dir: installed_tests_metadir, 51 | ) 52 | endif 53 | endforeach 54 | 55 | if get_option('installed_tests') 56 | install_data( 57 | 'empty-configure', 58 | 'make-test-app.sh', 59 | 'make-test-bundles.sh', 60 | 'make-test-runtime.sh', 61 | 'test-configure', 62 | 'testpython.py', 63 | 64 | install_dir: installed_testdir, 65 | install_mode: 'rwxr-xr-x', 66 | ) 67 | install_data( 68 | '0001-Add-test-logo.patch', 69 | 'data1', 70 | 'data1.patch', 71 | 'data2', 72 | 'data2.patch', 73 | 'hello.sh', 74 | 'hello.tar.xz', 75 | 'importme.py', 76 | 'importme2.py', 77 | 'libtest.sh', 78 | 'module1.json', 79 | 'module1.yaml', 80 | 'module2.json', 81 | 'module2.yaml', 82 | 'org.test.Deprecated.MD5.archive.json', 83 | 'org.test.Deprecated.MD5.archive.yaml', 84 | 'org.test.Deprecated.MD5.file.json', 85 | 'org.test.Deprecated.MD5.file.yaml', 86 | 'org.test.Deprecated.SHA1.archive.json', 87 | 'org.test.Deprecated.SHA1.archive.yaml', 88 | 'org.test.Deprecated.SHA1.file.json', 89 | 'org.test.Deprecated.SHA1.file.yaml', 90 | 'org.test.Hello.png', 91 | 'org.test.Hello.desktop', 92 | 'org.test.Hello.appdata.xml', 93 | 'Hello.desktop', 94 | 'org.test.Hello.xml', 95 | 'Hello.xml', 96 | 'Hello.appdata.xml', 97 | 'Hello-desktop.appdata.xml', 98 | 'org.test.Python.json', 99 | 'org.test.Python2.json', 100 | 'session.conf.in', 101 | 'source1.json', 102 | 'source2.json', 103 | 'test-rename.json', 104 | 'test-rename-appdata.json', 105 | 'test-runtime.json', 106 | 'test.json', 107 | 'test.yaml', 108 | 'org.flatpak_builder.gui.desktop', 109 | 'org.flatpak_builder.gui.json', 110 | 'org.flatpak_builder.gui.metainfo.xml', 111 | 'org.flatpak.appstream_media.json', 112 | 'org.test.Hello-256.png', 113 | 'org.flatpak.install_test.json', 114 | 115 | install_dir: installed_testdir, 116 | install_mode: 'rw-r--r--', 117 | ) 118 | endif 119 | 120 | subdir('test-keyring') 121 | subdir('test-keyring2') 122 | -------------------------------------------------------------------------------- /src/builder-cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_CACHE_H__ 22 | #define __BUILDER_CACHE_H__ 23 | 24 | #include 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | typedef struct BuilderCache BuilderCache; 30 | typedef struct BuilderContext BuilderContext; 31 | 32 | #define BUILDER_TYPE_CACHE (builder_cache_get_type ()) 33 | #define BUILDER_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_CACHE, BuilderCache)) 34 | #define BUILDER_IS_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_CACHE)) 35 | 36 | GType builder_cache_get_type (void); 37 | 38 | BuilderCache *builder_cache_new (BuilderContext *context, 39 | GFile *app_dir, 40 | const char *branch); 41 | void builder_cache_disable_lookups (BuilderCache *self); 42 | gboolean builder_cache_open (BuilderCache *self, 43 | GError **error); 44 | GChecksum * builder_cache_get_checksum (BuilderCache *self); 45 | gboolean builder_cache_lookup (BuilderCache *self, 46 | const char *stage); 47 | void builder_cache_ensure_checkout (BuilderCache *self); 48 | gboolean builder_cache_has_checkout (BuilderCache *self); 49 | gboolean builder_cache_commit (BuilderCache *self, 50 | const char *body, 51 | GError **error); 52 | gboolean builder_cache_get_outstanding_changes (BuilderCache *self, 53 | GPtrArray **changed_out, 54 | GError **error); 55 | GPtrArray *builder_cache_get_files (BuilderCache *self, 56 | GError **error); 57 | GPtrArray *builder_cache_get_changes (BuilderCache *self, 58 | GError **error); 59 | GPtrArray *builder_cache_get_all_changes (BuilderCache *self, 60 | GError **error); 61 | gboolean builder_gc (BuilderCache *self, 62 | gboolean prune_unused_stages, 63 | GError **error); 64 | 65 | void builder_cache_checksum_str (BuilderCache *self, 66 | const char *str); 67 | void builder_cache_checksum_compat_str (BuilderCache *self, 68 | const char *str); 69 | void builder_cache_checksum_strv (BuilderCache *self, 70 | char **strv); 71 | void builder_cache_checksum_compat_strv (BuilderCache *self, 72 | char **strv); 73 | void builder_cache_checksum_boolean (BuilderCache *self, 74 | gboolean val); 75 | void builder_cache_checksum_compat_boolean (BuilderCache *self, 76 | gboolean val); 77 | void builder_cache_checksum_uint32 (BuilderCache *self, 78 | guint32 val); 79 | void builder_cache_checksum_uint64 (BuilderCache *self, 80 | guint64 val); 81 | void builder_cache_checksum_data (BuilderCache *self, 82 | guint8 *data, 83 | gsize len); 84 | void builder_cache_checksum_random (BuilderCache *self); 85 | 86 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderCache, g_object_unref) 87 | 88 | G_END_DECLS 89 | 90 | #endif /* __BUILDER_CACHE_H__ */ 91 | -------------------------------------------------------------------------------- /tests/test-builder-deprecated.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright © 2022 Red Hat, Inc. 4 | # 5 | # This file is free software; you can redistribute it and/or modify it 6 | # under the terms of the GNU Lesser General Public License as 7 | # published by the Free Software Foundation; either version 2.1 of the 8 | # License, or (at your option) any later version. 9 | # 10 | # This file is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public License 16 | # along with this program. If not, see . 17 | 18 | set -euo pipefail 19 | 20 | srcdir=$(dirname "$0") 21 | . "$srcdir"/libtest.sh 22 | 23 | skip_without_fuse 24 | 25 | echo "1..8" 26 | 27 | setup_repo 28 | install_repo 29 | setup_sdk_repo 30 | install_sdk_repo 31 | 32 | cd "$TEST_DATA_DIR" 33 | 34 | cp "$srcdir"/org.test.Deprecated.MD5.archive.json . 35 | cp "$srcdir"/org.test.Deprecated.MD5.archive.yaml . 36 | cp "$srcdir"/org.test.Deprecated.MD5.file.json . 37 | cp "$srcdir"/org.test.Deprecated.MD5.file.yaml . 38 | cp "$srcdir"/org.test.Deprecated.SHA1.archive.json . 39 | cp "$srcdir"/org.test.Deprecated.SHA1.archive.yaml . 40 | cp "$srcdir"/org.test.Deprecated.SHA1.file.json . 41 | cp "$srcdir"/org.test.Deprecated.SHA1.file.yaml . 42 | cp "$srcdir"/hello.sh . 43 | cp "$srcdir"/hello.tar.xz . 44 | 45 | ${FLATPAK_BUILDER} --force-clean appdir org.test.Deprecated.MD5.archive.json >&2 2> build-error-log 46 | assert_file_has_content build-error-log 'The "md5" source property is deprecated due to the weakness of MD5 hashes.' 47 | assert_file_has_content build-error-log 'Use the "sha256" property for the more secure SHA256 hash.' 48 | 49 | echo "ok deprecated MD5 hash for archive in JSON" 50 | 51 | ${FLATPAK_BUILDER} --force-clean appdir org.test.Deprecated.MD5.archive.yaml >&2 2> build-error-log 52 | assert_file_has_content build-error-log 'The "md5" source property is deprecated due to the weakness of MD5 hashes.' 53 | assert_file_has_content build-error-log 'Use the "sha256" property for the more secure SHA256 hash.' 54 | 55 | echo "ok deprecated MD5 hash for archive in YAML" 56 | 57 | ${FLATPAK_BUILDER} --force-clean appdir org.test.Deprecated.MD5.file.json >&2 2> build-error-log 58 | assert_file_has_content build-error-log 'The "md5" source property is deprecated due to the weakness of MD5 hashes.' 59 | assert_file_has_content build-error-log 'Use the "sha256" property for the more secure SHA256 hash.' 60 | 61 | echo "ok deprecated MD5 hash for file in JSON" 62 | 63 | ${FLATPAK_BUILDER} --force-clean appdir org.test.Deprecated.MD5.file.yaml >&2 2> build-error-log 64 | assert_file_has_content build-error-log 'The "md5" source property is deprecated due to the weakness of MD5 hashes.' 65 | assert_file_has_content build-error-log 'Use the "sha256" property for the more secure SHA256 hash.' 66 | 67 | echo "ok deprecated MD5 hash for file in YAML" 68 | 69 | ${FLATPAK_BUILDER} --force-clean appdir org.test.Deprecated.SHA1.archive.json >&2 2> build-error-log 70 | assert_file_has_content build-error-log 'The "sha1" source property is deprecated due to the weakness of SHA1 hashes.' 71 | assert_file_has_content build-error-log 'Use the "sha256" property for the more secure SHA256 hash.' 72 | 73 | echo "ok deprecated SHA1 hash for archive in JSON" 74 | 75 | ${FLATPAK_BUILDER} --force-clean appdir org.test.Deprecated.SHA1.archive.yaml >&2 2> build-error-log 76 | assert_file_has_content build-error-log 'The "sha1" source property is deprecated due to the weakness of SHA1 hashes.' 77 | assert_file_has_content build-error-log 'Use the "sha256" property for the more secure SHA256 hash.' 78 | 79 | echo "ok deprecated SHA1 hash for archive in YAML" 80 | 81 | ${FLATPAK_BUILDER} --force-clean appdir org.test.Deprecated.SHA1.file.json >&2 2> build-error-log 82 | assert_file_has_content build-error-log 'The "sha1" source property is deprecated due to the weakness of SHA1 hashes.' 83 | assert_file_has_content build-error-log 'Use the "sha256" property for the more secure SHA256 hash.' 84 | 85 | echo "ok deprecated SHA1 hash for file in JSON" 86 | 87 | ${FLATPAK_BUILDER} --force-clean appdir org.test.Deprecated.SHA1.file.yaml >&2 2> build-error-log 88 | assert_file_has_content build-error-log 'The "sha1" source property is deprecated due to the weakness of SHA1 hashes.' 89 | assert_file_has_content build-error-log 'Use the "sha256" property for the more secure SHA256 hash.' 90 | 91 | echo "ok deprecated SHA1 hash for file in YAML" 92 | -------------------------------------------------------------------------------- /src/builder-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_OPTIONS_H__ 22 | #define __BUILDER_OPTIONS_H__ 23 | 24 | #include 25 | #include "builder-cache.h" 26 | 27 | G_BEGIN_DECLS 28 | 29 | typedef struct BuilderOptions BuilderOptions; 30 | 31 | #define BUILDER_TYPE_OPTIONS (builder_options_get_type ()) 32 | #define BUILDER_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_OPTIONS, BuilderOptions)) 33 | #define BUILDER_IS_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_OPTIONS)) 34 | 35 | /* Bump this if format changes in incompatible ways to force rebuild */ 36 | #define BUILDER_OPTION_CHECKSUM_VERSION "1" 37 | 38 | GType builder_options_get_type (void); 39 | 40 | char *builder_options_get_cflags (BuilderOptions *self, 41 | BuilderContext *context); 42 | char *builder_options_get_cxxflags (BuilderOptions *self, 43 | BuilderContext *context); 44 | char *builder_options_get_cppflags (BuilderOptions *self, 45 | BuilderContext *context); 46 | char *builder_options_get_ldflags (BuilderOptions *self, 47 | BuilderContext *context); 48 | const char *builder_options_get_prefix (BuilderOptions *self, 49 | BuilderContext *context); 50 | const char *builder_options_get_libdir (BuilderOptions *self, 51 | BuilderContext *context); 52 | char ** builder_options_get_env (BuilderOptions *self, 53 | BuilderContext *context); 54 | char ** builder_options_get_build_args (BuilderOptions *self, 55 | BuilderContext *context, 56 | GError **error); 57 | char ** builder_options_get_test_args (BuilderOptions *self, 58 | BuilderContext *context, 59 | GError **error); 60 | char ** builder_options_get_config_opts (BuilderOptions *self, 61 | BuilderContext *context, 62 | char **base_opts); 63 | char ** builder_options_get_secret_opts (BuilderOptions *self, 64 | BuilderContext *context, 65 | char **base_opts); 66 | char ** builder_options_get_secret_env (BuilderOptions *self, 67 | BuilderContext *context, 68 | char **base_opts); 69 | char ** builder_options_get_make_args (BuilderOptions *self, 70 | BuilderContext *context, 71 | char **base_args); 72 | char ** builder_options_get_make_install_args (BuilderOptions *self, 73 | BuilderContext *context, 74 | char **base_args); 75 | void builder_options_checksum (BuilderOptions *self, 76 | BuilderCache *cache, 77 | BuilderContext *context); 78 | gboolean builder_options_get_no_debuginfo (BuilderOptions *self, 79 | BuilderContext *context); 80 | gboolean builder_options_get_no_debuginfo_compression (BuilderOptions *self, 81 | BuilderContext *context); 82 | gboolean builder_options_get_strip (BuilderOptions *self, 83 | BuilderContext *context); 84 | gboolean builder_options_build_has_network (char **build_args); 85 | 86 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderOptions, g_object_unref) 87 | 88 | G_END_DECLS 89 | 90 | #endif /* __BUILDER_OPTIONS_H__ */ 91 | -------------------------------------------------------------------------------- /tests/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id": "org.test.Hello2", 3 | "runtime": "org.test.Platform", 4 | "sdk": "org.test.Sdk", 5 | "command": "hello2.sh", 6 | "tags": ["test"], 7 | "token-type": 0, 8 | "finish-args": [ 9 | "--share=network" 10 | ], 11 | "build-options" : { 12 | "cflags": "-O2 -g", 13 | "cxxflags": "-O2 -g", 14 | "env": { 15 | "FOO": "bar", 16 | "V": "1" 17 | } 18 | }, 19 | "cleanup": ["/cleanup", "*.cleanup"], 20 | "cleanup-commands": [ "touch /app/cleaned_up" ], 21 | "modules": [ 22 | "include1/module1.json", 23 | { 24 | "name": "root", 25 | "modules": [ 26 | { 27 | "name": "test", 28 | "config-opts": ["--some-arg"], 29 | "post-install": [ 30 | "touch /app/bin/file.cleanup", 31 | "mkdir -p /app/share/icons/hicolor/64x64/apps/", 32 | "mkdir -p /app/share/icons/hicolor/64x64/mimetypes/", 33 | "cp org.test.Hello.png /app/share/icons/hicolor/64x64/apps/$FLATPAK_ID.png", 34 | "cp org.test.Hello.png /app/share/icons/hicolor/64x64/mimetypes/$FLATPAK_ID.application-x-hello.png", 35 | "cp org.test.Hello.png /app/share/icons/hicolor/64x64/mimetypes/$FLATPAK_ID.application-x-goodbye.png", 36 | "mkdir -p /app/share/applications", 37 | "cp org.test.Hello.desktop /app/share/applications/$FLATPAK_ID.desktop", 38 | "mkdir -p /app/share/mime/packages", 39 | "cp org.test.Hello.xml /app/share/mime/packages/$FLATPAK_ID.xml", 40 | "mkdir -p /app/share/appdata", 41 | "cp org.test.Hello.appdata.xml /app/share/appdata/$FLATPAK_ID.appdata.xml" 42 | ], 43 | "make-args": ["BAR=2" ], 44 | "make-install-args": ["BAR=3" ], 45 | "build-commands": [ "echo foo > /app/out" ], 46 | "sources": [ 47 | { 48 | "type": "file", 49 | "path": "test-configure", 50 | "dest-filename": "configure", 51 | "sha256": "675a1ac2feec4d4f54e581b4b01bc3cfd2c1cf31aa5963574d31228c8a11b7e7" 52 | }, 53 | { 54 | "type": "file", 55 | "path": "app-data" 56 | }, 57 | { 58 | "type": "script", 59 | "dest-filename": "hello2.sh", 60 | "commands": [ "echo \"Hello world2, from a sandbox\"" ] 61 | }, 62 | { 63 | "type": "file", 64 | "path": "org.test.Hello.desktop" 65 | }, 66 | { 67 | "type": "file", 68 | "path": "org.test.Hello.appdata.xml" 69 | }, 70 | { 71 | "type": "file", 72 | "path": "org.test.Hello.xml" 73 | }, 74 | { 75 | "type": "file", 76 | "path": "LICENSE" 77 | }, 78 | { 79 | "type": "shell", 80 | "commands": [ 81 | "mkdir /app/cleanup/", 82 | "touch /app/cleanup/a_file" 83 | ] 84 | }, 85 | { 86 | "type": "patch", 87 | "path": "0001-Add-test-logo.patch", 88 | "use-git": true 89 | } 90 | ] 91 | }, 92 | { 93 | "name": "test2", 94 | "build-commands": [ 95 | "echo foo2 > /app/out2", 96 | "cp source[12] /app" 97 | ], 98 | "buildsystem": "simple", 99 | "sources": [ 100 | { 101 | "type": "file", 102 | "path": "app-data" 103 | }, 104 | "include1/source1.json", 105 | "include1/include2/source2.json" 106 | ] 107 | }, 108 | { 109 | "name": "empty" 110 | } 111 | ] 112 | } 113 | ] 114 | } 115 | -------------------------------------------------------------------------------- /uncrustify.cfg: -------------------------------------------------------------------------------- 1 | newlines lf 2 | 3 | input_tab_size 8 4 | output_tab_size 8 5 | 6 | string_escape_char 92 7 | string_escape_char2 0 8 | 9 | # indenting 10 | indent_columns 2 11 | indent_with_tabs 0 12 | indent_align_string True 13 | indent_brace 2 14 | indent_braces false 15 | indent_braces_no_func True 16 | indent_func_call_param false 17 | indent_func_def_param false 18 | indent_func_proto_param false 19 | indent_switch_case 0 20 | indent_case_brace 2 21 | indent_paren_close 1 22 | 23 | # spacing 24 | sp_arith Add 25 | sp_assign Add 26 | sp_enum_assign Add 27 | sp_bool Add 28 | sp_compare Add 29 | sp_inside_paren Remove 30 | sp_inside_fparens Remove 31 | sp_func_def_paren Force 32 | sp_func_proto_paren Force 33 | sp_paren_paren Remove 34 | sp_balance_nested_parens False 35 | sp_paren_brace Remove 36 | sp_before_square Remove 37 | sp_before_squares Remove 38 | sp_inside_square Remove 39 | sp_before_ptr_star Add 40 | sp_between_ptr_star Remove 41 | sp_after_comma Add 42 | sp_before_comma Remove 43 | sp_after_cast Add 44 | sp_sizeof_paren Add 45 | sp_not Remove 46 | sp_inv Remove 47 | sp_addr Remove 48 | sp_member Remove 49 | sp_deref Remove 50 | sp_sign Remove 51 | sp_incdec Remove 52 | sp_attribute_paren remove 53 | sp_macro Force 54 | sp_func_call_paren Force 55 | sp_func_call_user_paren Remove 56 | set func_call_user _ N_ C_ g_autoptr g_auto 57 | sp_brace_typedef add 58 | sp_cond_colon add 59 | sp_cond_question add 60 | sp_defined_paren remove 61 | 62 | # alignment 63 | align_keep_tabs False 64 | align_with_tabs False 65 | align_on_tabstop False 66 | align_number_left True 67 | align_func_params True 68 | align_var_def_span 0 69 | align_var_def_amp_style 1 70 | align_var_def_colon true 71 | align_enum_equ_span 0 72 | align_var_struct_span 2 73 | align_var_def_star_style 2 74 | align_var_def_amp_style 2 75 | align_typedef_span 2 76 | align_typedef_func 0 77 | align_typedef_star_style 2 78 | align_typedef_amp_style 2 79 | 80 | # newlines 81 | nl_assign_leave_one_liners True 82 | nl_enum_leave_one_liners False 83 | nl_func_leave_one_liners False 84 | nl_if_leave_one_liners False 85 | nl_end_of_file Add 86 | nl_assign_brace Remove 87 | nl_func_var_def_blk 1 88 | nl_fcall_brace Add 89 | nl_enum_brace Remove 90 | nl_struct_brace Force 91 | nl_union_brace Force 92 | nl_if_brace Force 93 | nl_brace_else Force 94 | nl_elseif_brace Force 95 | nl_else_brace Add 96 | nl_for_brace Force 97 | nl_while_brace Force 98 | nl_do_brace Force 99 | nl_brace_while Force 100 | nl_switch_brace Force 101 | nl_before_case True 102 | nl_after_case False 103 | nl_func_type_name Force 104 | nl_func_proto_type_name Remove 105 | nl_func_paren Remove 106 | nl_func_decl_start Remove 107 | nl_func_decl_args Force 108 | nl_func_decl_end Remove 109 | nl_fdef_brace Force 110 | nl_after_return False 111 | nl_define_macro False 112 | nl_create_if_one_liner False 113 | nl_create_for_one_liner False 114 | nl_create_while_one_liner False 115 | nl_after_semicolon True 116 | nl_multi_line_cond true 117 | 118 | # mod 119 | # I'd like these to be remove, but that removes brackets in if { if { foo } }, which i dislike 120 | # Not clear what to do about that... 121 | mod_full_brace_for Remove 122 | mod_full_brace_if Remove 123 | mod_full_brace_if_chain True 124 | mod_full_brace_while Remove 125 | mod_full_brace_do Remove 126 | mod_full_brace_nl 3 127 | mod_paren_on_return Remove 128 | 129 | # line splitting 130 | #code_width = 78 131 | ls_for_split_full True 132 | ls_func_split_full True 133 | 134 | # positioning 135 | pos_bool Trail 136 | pos_conditional Trail 137 | -------------------------------------------------------------------------------- /tests/test-rename.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id": "org.test.Hello2", 3 | "runtime": "org.test.Platform", 4 | "sdk": "org.test.Sdk", 5 | "command": "hello2.sh", 6 | "tags": ["test"], 7 | "token-type": 0, 8 | "finish-args": [ 9 | "--share=network" 10 | ], 11 | "rename-icon": "Hello", 12 | "rename-appdata-file": "Hello.appdata.xml", 13 | "rename-desktop-file": "Hello.desktop", 14 | "rename-mime-file": "Hello.xml", 15 | "rename-mime-icons": [ 16 | "application-x-hello", 17 | "application-x-goodbye" 18 | ], 19 | "build-options" : { 20 | "cflags": "-O2 -g", 21 | "cxxflags": "-O2 -g", 22 | "env": { 23 | "FOO": "bar", 24 | "V": "1" 25 | } 26 | }, 27 | "cleanup": ["/cleanup", "*.cleanup"], 28 | "cleanup-commands": [ "touch /app/cleaned_up" ], 29 | "modules": [ 30 | "include1/module1.json", 31 | { 32 | "name": "root", 33 | "modules": [ 34 | { 35 | "name": "test", 36 | "config-opts": ["--some-arg"], 37 | "post-install": [ 38 | "touch /app/bin/file.cleanup", 39 | "mkdir -p /app/share/icons/hicolor/64x64/apps/", 40 | "mkdir -p /app/share/icons/hicolor/64x64/mimetypes/", 41 | "cp org.test.Hello.png /app/share/icons/hicolor/64x64/apps/Hello.png", 42 | "cp org.test.Hello.png /app/share/icons/hicolor/64x64/mimetypes/application-x-hello.png", 43 | "cp org.test.Hello.png /app/share/icons/hicolor/64x64/mimetypes/application-x-goodbye.png", 44 | "mkdir -p /app/share/applications", 45 | "cp Hello.desktop /app/share/applications/", 46 | "mkdir -p /app/share/mime/packages", 47 | "cp Hello.xml /app/share/mime/packages/", 48 | "mkdir -p /app/share/appdata", 49 | "cp Hello.appdata.xml /app/share/appdata" 50 | ], 51 | "make-args": ["BAR=2" ], 52 | "make-install-args": ["BAR=3" ], 53 | "build-commands": [ "echo foo > /app/out" ], 54 | "sources": [ 55 | { 56 | "type": "file", 57 | "path": "test-configure", 58 | "dest-filename": "configure", 59 | "sha256": "675a1ac2feec4d4f54e581b4b01bc3cfd2c1cf31aa5963574d31228c8a11b7e7" 60 | }, 61 | { 62 | "type": "file", 63 | "path": "app-data" 64 | }, 65 | { 66 | "type": "file", 67 | "path": "Hello.desktop" 68 | }, 69 | { 70 | "type": "file", 71 | "path": "Hello.appdata.xml" 72 | }, 73 | { 74 | "type": "file", 75 | "path": "Hello.xml" 76 | }, 77 | { 78 | "type": "file", 79 | "path": "LICENSE" 80 | }, 81 | { 82 | "type": "script", 83 | "dest-filename": "hello2.sh", 84 | "commands": [ "echo \"Hello world2, from a sandbox\"" ] 85 | }, 86 | { 87 | "type": "shell", 88 | "commands": [ 89 | "mkdir /app/cleanup/", 90 | "touch /app/cleanup/a_file" 91 | ] 92 | }, 93 | { 94 | "type": "patch", 95 | "path": "0001-Add-test-logo.patch", 96 | "use-git": true 97 | } 98 | ] 99 | }, 100 | { 101 | "name": "test2", 102 | "build-commands": [ 103 | "echo foo2 > /app/out2", 104 | "cp source[12] /app" 105 | ], 106 | "buildsystem": "simple", 107 | "sources": [ 108 | { 109 | "type": "file", 110 | "path": "app-data" 111 | }, 112 | "include1/source1.json", 113 | "include1/include2/source2.json" 114 | ] 115 | }, 116 | { 117 | "name": "empty" 118 | } 119 | ] 120 | } 121 | ] 122 | } 123 | -------------------------------------------------------------------------------- /tests/test-rename-appdata.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id": "org.test.Hello2", 3 | "runtime": "org.test.Platform", 4 | "sdk": "org.test.Sdk", 5 | "command": "hello2.sh", 6 | "tags": ["test"], 7 | "token-type": 0, 8 | "finish-args": [ 9 | "--share=network" 10 | ], 11 | "rename-icon": "Hello", 12 | "rename-appdata-file": "Hello.appdata.xml", 13 | "rename-mime-file": "Hello.xml", 14 | "rename-mime-icons": [ 15 | "application-x-hello", 16 | "application-x-goodbye" 17 | ], 18 | "build-options" : { 19 | "cflags": "-O2 -g", 20 | "cxxflags": "-O2 -g", 21 | "env": { 22 | "FOO": "bar", 23 | "V": "1" 24 | } 25 | }, 26 | "cleanup": ["/cleanup", "*.cleanup"], 27 | "cleanup-commands": [ "touch /app/cleaned_up" ], 28 | "modules": [ 29 | "include1/module1.json", 30 | { 31 | "name": "root", 32 | "modules": [ 33 | { 34 | "name": "test", 35 | "config-opts": ["--some-arg"], 36 | "post-install": [ 37 | "touch /app/bin/file.cleanup", 38 | "mkdir -p /app/share/icons/hicolor/64x64/apps/", 39 | "mkdir -p /app/share/icons/hicolor/64x64/mimetypes/", 40 | "cp org.test.Hello.png /app/share/icons/hicolor/64x64/apps/Hello.png", 41 | "cp org.test.Hello.png /app/share/icons/hicolor/64x64/mimetypes/application-x-hello.png", 42 | "cp org.test.Hello.png /app/share/icons/hicolor/64x64/mimetypes/application-x-goodbye.png", 43 | "mkdir -p /app/share/applications", 44 | "cp org.test.Hello.desktop /app/share/applications/${FLATPAK_ID}.desktop", 45 | "mkdir -p /app/share/mime/packages", 46 | "cp Hello.xml /app/share/mime/packages/", 47 | "mkdir -p /app/share/appdata", 48 | "cp Hello-desktop.appdata.xml /app/share/appdata/Hello.appdata.xml" 49 | ], 50 | "make-args": ["BAR=2" ], 51 | "make-install-args": ["BAR=3" ], 52 | "build-commands": [ "echo foo > /app/out" ], 53 | "sources": [ 54 | { 55 | "type": "file", 56 | "path": "test-configure", 57 | "dest-filename": "configure", 58 | "sha256": "675a1ac2feec4d4f54e581b4b01bc3cfd2c1cf31aa5963574d31228c8a11b7e7" 59 | }, 60 | { 61 | "type": "file", 62 | "path": "app-data" 63 | }, 64 | { 65 | "type": "file", 66 | "path": "org.test.Hello.desktop" 67 | }, 68 | { 69 | "type": "file", 70 | "path": "Hello-desktop.appdata.xml" 71 | }, 72 | { 73 | "type": "file", 74 | "path": "Hello.xml" 75 | }, 76 | { 77 | "type": "file", 78 | "path": "LICENSE" 79 | }, 80 | { 81 | "type": "script", 82 | "dest-filename": "hello2.sh", 83 | "commands": [ "echo \"Hello world2, from a sandbox\"" ] 84 | }, 85 | { 86 | "type": "shell", 87 | "commands": [ 88 | "mkdir /app/cleanup/", 89 | "touch /app/cleanup/a_file" 90 | ] 91 | }, 92 | { 93 | "type": "patch", 94 | "path": "0001-Add-test-logo.patch", 95 | "use-git": true 96 | } 97 | ] 98 | }, 99 | { 100 | "name": "test2", 101 | "build-commands": [ 102 | "echo foo2 > /app/out2", 103 | "cp source[12] /app" 104 | ], 105 | "buildsystem": "simple", 106 | "sources": [ 107 | { 108 | "type": "file", 109 | "path": "app-data" 110 | }, 111 | "include1/source1.json", 112 | "include1/include2/source2.json" 113 | ] 114 | }, 115 | { 116 | "name": "empty" 117 | } 118 | ] 119 | } 120 | ] 121 | } 122 | -------------------------------------------------------------------------------- /src/builder-source.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_H__ 22 | #define __BUILDER_SOURCE_H__ 23 | 24 | #include 25 | 26 | #include "builder-context.h" 27 | #include "builder-cache.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef struct BuilderSource BuilderSource; 32 | 33 | #define BUILDER_TYPE_SOURCE (builder_source_get_type ()) 34 | #define BUILDER_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE, BuilderSource)) 35 | #define BUILDER_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUILDER_TYPE_SOURCE, BuilderSourceClass)) 36 | #define BUILDER_IS_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE)) 37 | #define BUILDER_IS_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BUILDER_TYPE_SOURCE)) 38 | #define BUILDER_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BUILDER_TYPE_SOURCE, BuilderSourceClass)) 39 | 40 | struct BuilderSource 41 | { 42 | GObject parent; 43 | 44 | GFile *base_dir; 45 | char *dest; 46 | char **only_arches; 47 | char **skip_arches; 48 | }; 49 | 50 | typedef struct 51 | { 52 | GObjectClass parent_class; 53 | 54 | gboolean (* show_deps)(BuilderSource *self, 55 | GError **error); 56 | gboolean (* download)(BuilderSource *self, 57 | gboolean update_vcs, 58 | BuilderContext *context, 59 | GError **error); 60 | gboolean (* extract)(BuilderSource *self, 61 | GFile *dest, 62 | GFile *source_dir, 63 | BuilderOptions *build_options, 64 | BuilderContext *context, 65 | GError **error); 66 | gboolean (* bundle)(BuilderSource *self, 67 | BuilderContext *context, 68 | GError **error); 69 | gboolean (* update)(BuilderSource *self, 70 | BuilderContext *context, 71 | GError **error); 72 | void (* checksum)(BuilderSource *self, 73 | BuilderCache *cache, 74 | BuilderContext *context); 75 | void (* finish)(BuilderSource *self, 76 | GPtrArray *args, 77 | BuilderContext *context); 78 | gboolean (* validate)(BuilderSource *self, 79 | GError **error); 80 | } BuilderSourceClass; 81 | 82 | GType builder_source_get_type (void); 83 | 84 | BuilderSource * builder_source_from_json (JsonNode *node); 85 | JsonNode * builder_source_to_json (BuilderSource *self); 86 | 87 | 88 | void builder_source_set_base_dir (BuilderSource *self, 89 | GFile *base_dir); 90 | 91 | gboolean builder_source_show_deps (BuilderSource *self, 92 | GError **error); 93 | gboolean builder_source_download (BuilderSource *self, 94 | gboolean update_vcs, 95 | BuilderContext *context, 96 | GError **error); 97 | gboolean builder_source_extract (BuilderSource *self, 98 | GFile *source_dir, 99 | BuilderOptions *build_options, 100 | BuilderContext *context, 101 | GError **error); 102 | gboolean builder_source_bundle (BuilderSource *self, 103 | BuilderContext *context, 104 | GError **error); 105 | gboolean builder_source_update (BuilderSource *self, 106 | BuilderContext *context, 107 | GError **error); 108 | 109 | void builder_source_checksum (BuilderSource *self, 110 | BuilderCache *cache, 111 | BuilderContext *context); 112 | void builder_source_finish (BuilderSource *self, 113 | GPtrArray *args, 114 | BuilderContext *context); 115 | gboolean builder_source_validate (BuilderSource *self, 116 | GError **error); 117 | 118 | gboolean builder_source_is_enabled (BuilderSource *self, 119 | BuilderContext *context); 120 | 121 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSource, g_object_unref) 122 | 123 | G_END_DECLS 124 | 125 | #endif /* __BUILDER_SOURCE_H__ */ 126 | -------------------------------------------------------------------------------- /src/builder-module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_MODULE_H__ 22 | #define __BUILDER_MODULE_H__ 23 | 24 | #include 25 | 26 | #include "builder-source.h" 27 | #include "builder-options.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef struct BuilderModule BuilderModule; 32 | 33 | #define BUILDER_TYPE_MODULE (builder_module_get_type ()) 34 | #define BUILDER_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_MODULE, BuilderModule)) 35 | #define BUILDER_IS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_MODULE)) 36 | 37 | /* Bump this if format changes in incompatible ways to force rebuild */ 38 | #define BUILDER_MODULE_CHECKSUM_VERSION "1" 39 | 40 | GType builder_module_get_type (void); 41 | 42 | const char * builder_module_get_name (BuilderModule *self); 43 | void builder_module_set_name (BuilderModule *self, 44 | const char *name); 45 | gboolean builder_module_is_enabled (BuilderModule *self, 46 | BuilderContext *context); 47 | gboolean builder_module_get_disabled (BuilderModule *self); 48 | gboolean builder_module_should_build (BuilderModule *self); 49 | GList * builder_module_get_sources (BuilderModule *self); 50 | GList * builder_module_get_modules (BuilderModule *self); 51 | void builder_module_set_json_path (BuilderModule *self, 52 | const char *json_path); 53 | void builder_module_set_base_dir (BuilderModule *self, 54 | GFile* base_dir); 55 | GPtrArray * builder_module_get_changes (BuilderModule *self); 56 | void builder_module_set_changes (BuilderModule *self, 57 | GPtrArray *changes); 58 | 59 | gboolean builder_module_show_deps (BuilderModule *self, 60 | BuilderContext *context, 61 | GError **error); 62 | gboolean builder_module_download_sources (BuilderModule *self, 63 | gboolean update_vcs, 64 | BuilderContext *context, 65 | GError **error); 66 | gboolean builder_module_extract_sources (BuilderModule *self, 67 | GFile *dest, 68 | BuilderContext *context, 69 | GError **error); 70 | gboolean builder_module_bundle_sources (BuilderModule *self, 71 | BuilderContext *context, 72 | GError **error); 73 | void builder_module_finish_sources (BuilderModule *self, 74 | GPtrArray *args, 75 | BuilderContext *context); 76 | gboolean builder_module_ensure_writable (BuilderModule *self, 77 | BuilderCache *cache, 78 | BuilderContext *context, 79 | GError **error); 80 | gboolean builder_module_build (BuilderModule *self, 81 | const char *id, 82 | BuilderCache *cache, 83 | BuilderContext *context, 84 | gboolean run_shell, 85 | GError **error); 86 | gboolean builder_module_update (BuilderModule *self, 87 | BuilderContext *context, 88 | GError **error); 89 | void builder_module_checksum (BuilderModule *self, 90 | BuilderCache *cache, 91 | BuilderContext *context); 92 | void builder_module_checksum_for_cleanup (BuilderModule *self, 93 | BuilderCache *cache, 94 | BuilderContext *context); 95 | void builder_module_checksum_for_platform_cleanup (BuilderModule *self, 96 | BuilderCache *cache, 97 | BuilderContext *context); 98 | void builder_module_cleanup_collect (BuilderModule *self, 99 | gboolean platform, 100 | BuilderContext *context, 101 | GHashTable *to_remove_ht); 102 | 103 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderModule, g_object_unref) 104 | 105 | G_END_DECLS 106 | 107 | #endif /* __BUILDER_MODULE_H__ */ 108 | -------------------------------------------------------------------------------- /src/builder-sdk-config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2018 Codethink Limited 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Valentin David 19 | */ 20 | 21 | #include "builder-sdk-config.h" 22 | 23 | #include 24 | 25 | struct BuilderSdkConfig { 26 | GObject parent; 27 | 28 | char *libdir; 29 | char *cppflags; 30 | char *cflags; 31 | char *cxxflags; 32 | char *ldflags; 33 | }; 34 | 35 | typedef struct 36 | { 37 | GObjectClass parent_class; 38 | } BuilderSdkConfigClass; 39 | 40 | G_DEFINE_TYPE (BuilderSdkConfig, builder_sdk_config, G_TYPE_OBJECT) 41 | 42 | static void 43 | builder_sdk_config_finalize (GObject *object) 44 | { 45 | BuilderSdkConfig *self = (BuilderSdkConfig *) object; 46 | 47 | g_free (self->libdir); 48 | g_free (self->cppflags); 49 | g_free (self->cflags); 50 | g_free (self->cxxflags); 51 | g_free (self->ldflags); 52 | 53 | G_OBJECT_CLASS (builder_sdk_config_parent_class)->finalize (object); 54 | } 55 | 56 | enum { 57 | PROP_0, 58 | PROP_LIBDIR, 59 | PROP_CPPFLAGS, 60 | PROP_CFLAGS, 61 | PROP_CXXFLAGS, 62 | PROP_LDFLAGS, 63 | LAST_PROP 64 | }; 65 | 66 | static void 67 | builder_sdk_config_get_property (GObject *object, 68 | guint prop_id, 69 | GValue *value, 70 | GParamSpec *pspec) 71 | { 72 | BuilderSdkConfig *self = BUILDER_SDK_CONFIG (object); 73 | 74 | switch (prop_id) 75 | { 76 | case PROP_LIBDIR: 77 | g_value_set_string (value, self->libdir); 78 | break; 79 | 80 | case PROP_CPPFLAGS: 81 | g_value_set_string (value, self->cppflags); 82 | break; 83 | 84 | case PROP_CFLAGS: 85 | g_value_set_string (value, self->cflags); 86 | break; 87 | 88 | case PROP_CXXFLAGS: 89 | g_value_set_string (value, self->cxxflags); 90 | break; 91 | 92 | case PROP_LDFLAGS: 93 | g_value_set_string (value, self->ldflags); 94 | break; 95 | 96 | default: 97 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 98 | } 99 | } 100 | 101 | static void 102 | builder_sdk_config_set_property (GObject *object, 103 | guint prop_id, 104 | const GValue *value, 105 | GParamSpec *pspec) 106 | { 107 | BuilderSdkConfig *self = BUILDER_SDK_CONFIG (object); 108 | 109 | switch (prop_id) 110 | { 111 | case PROP_LIBDIR: 112 | g_free (self->libdir); 113 | self->libdir = g_value_dup_string(value); 114 | break ; 115 | 116 | case PROP_CPPFLAGS: 117 | g_free (self->cppflags); 118 | self->cppflags = g_value_dup_string(value); 119 | break ; 120 | 121 | case PROP_CFLAGS: 122 | g_free (self->cflags); 123 | self->cflags = g_value_dup_string(value); 124 | break ; 125 | 126 | case PROP_CXXFLAGS: 127 | g_free (self->cxxflags); 128 | self->cxxflags = g_value_dup_string(value); 129 | break ; 130 | 131 | case PROP_LDFLAGS: 132 | g_free (self->ldflags); 133 | self->ldflags = g_value_dup_string(value); 134 | break ; 135 | default: 136 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 137 | } 138 | } 139 | 140 | static void 141 | builder_sdk_config_class_init (BuilderSdkConfigClass *klass) 142 | { 143 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 144 | 145 | object_class->finalize = builder_sdk_config_finalize; 146 | object_class->get_property = builder_sdk_config_get_property; 147 | object_class->set_property = builder_sdk_config_set_property; 148 | 149 | g_object_class_install_property (object_class, 150 | PROP_LIBDIR, 151 | g_param_spec_string ("libdir", 152 | "", 153 | "", 154 | NULL, 155 | G_PARAM_READWRITE)); 156 | g_object_class_install_property (object_class, 157 | PROP_CPPFLAGS, 158 | g_param_spec_string ("cppflags", 159 | "", 160 | "", 161 | NULL, 162 | G_PARAM_READWRITE)); 163 | g_object_class_install_property (object_class, 164 | PROP_CFLAGS, 165 | g_param_spec_string ("cflags", 166 | "", 167 | "", 168 | NULL, 169 | G_PARAM_READWRITE)); 170 | g_object_class_install_property (object_class, 171 | PROP_CXXFLAGS, 172 | g_param_spec_string ("cxxflags", 173 | "", 174 | "", 175 | NULL, 176 | G_PARAM_READWRITE)); 177 | g_object_class_install_property (object_class, 178 | PROP_LDFLAGS, 179 | g_param_spec_string ("ldflags", 180 | "", 181 | "", 182 | NULL, 183 | G_PARAM_READWRITE)); 184 | } 185 | 186 | static void 187 | builder_sdk_config_init (BuilderSdkConfig *self) 188 | { 189 | } 190 | 191 | 192 | const char * 193 | builder_sdk_config_get_libdir (BuilderSdkConfig *self) 194 | { 195 | return self->libdir; 196 | } 197 | 198 | const char * 199 | builder_sdk_config_get_cppflags (BuilderSdkConfig *self) 200 | { 201 | return self->cppflags; 202 | } 203 | 204 | const char * 205 | builder_sdk_config_get_cflags (BuilderSdkConfig *self) 206 | { 207 | return self->cflags; 208 | } 209 | 210 | const char * 211 | builder_sdk_config_get_cxxflags (BuilderSdkConfig *self) 212 | { 213 | return self->cxxflags; 214 | } 215 | 216 | const char * 217 | builder_sdk_config_get_ldflags (BuilderSdkConfig *self) 218 | { 219 | return self->ldflags; 220 | } 221 | 222 | BuilderSdkConfig * 223 | builder_sdk_config_from_file (GFile *file, 224 | GError **error) 225 | { 226 | g_autofree gchar *config_contents = NULL; 227 | gsize config_size; 228 | 229 | if (!g_file_load_contents (file, NULL, &config_contents, &config_size, NULL, error)) 230 | return NULL; 231 | 232 | return (BuilderSdkConfig*) json_gobject_from_data (BUILDER_TYPE_SDK_CONFIG, 233 | config_contents, 234 | config_size, 235 | error); 236 | } 237 | -------------------------------------------------------------------------------- /src/builder-source-inline.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "builder-flatpak-utils.h" 10 | #include "builder-utils.h" 11 | #include "builder-source-inline.h" 12 | 13 | struct BuilderSourceInline 14 | { 15 | BuilderSource parent; 16 | 17 | char *contents; 18 | gboolean base64; 19 | char *dest_filename; 20 | }; 21 | 22 | typedef struct 23 | { 24 | BuilderSourceClass parent_class; 25 | } BuilderSourceInlineClass; 26 | 27 | G_DEFINE_TYPE (BuilderSourceInline, builder_source_inline, BUILDER_TYPE_SOURCE); 28 | 29 | enum { 30 | PROP_0, 31 | PROP_CONTENTS, 32 | PROP_BASE64, 33 | PROP_DEST_FILENAME, 34 | LAST_PROP 35 | }; 36 | 37 | static void 38 | builder_source_inline_finalize (GObject *object) 39 | { 40 | BuilderSourceInline *self = (BuilderSourceInline *) object; 41 | 42 | g_free (self->contents); 43 | g_free (self->dest_filename); 44 | 45 | G_OBJECT_CLASS (builder_source_inline_parent_class)->finalize (object); 46 | } 47 | 48 | static void 49 | builder_source_inline_get_property (GObject *object, 50 | guint prop_id, 51 | GValue *value, 52 | GParamSpec *pspec) 53 | { 54 | BuilderSourceInline *self = BUILDER_SOURCE_INLINE (object); 55 | 56 | switch (prop_id) 57 | { 58 | case PROP_CONTENTS: 59 | g_value_set_string (value, self->contents); 60 | break; 61 | 62 | case PROP_BASE64: 63 | g_value_set_boolean (value, self->base64); 64 | break; 65 | 66 | case PROP_DEST_FILENAME: 67 | g_value_set_string (value, self->dest_filename); 68 | break; 69 | 70 | default: 71 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 72 | } 73 | } 74 | 75 | static void 76 | builder_source_inline_set_property (GObject *object, 77 | guint prop_id, 78 | const GValue *value, 79 | GParamSpec *pspec) 80 | { 81 | BuilderSourceInline *self = BUILDER_SOURCE_INLINE (object); 82 | 83 | switch (prop_id) 84 | { 85 | case PROP_CONTENTS: 86 | g_free (self->contents); 87 | self->contents = g_value_dup_string (value); 88 | break; 89 | 90 | case PROP_BASE64: 91 | self->base64 = g_value_get_boolean (value); 92 | break; 93 | 94 | case PROP_DEST_FILENAME: 95 | g_free (self->dest_filename); 96 | self->dest_filename = g_value_dup_string (value); 97 | break; 98 | 99 | default: 100 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 101 | } 102 | } 103 | 104 | static gboolean 105 | builder_source_inline_validate (BuilderSource *source, 106 | GError **error) 107 | { 108 | BuilderSourceInline *self = BUILDER_SOURCE_INLINE (source); 109 | 110 | if (self->dest_filename != NULL && 111 | strchr (self->dest_filename, '/') != NULL) 112 | return flatpak_fail (error, "No slashes allowed in dest-filename, use dest property for directory"); 113 | 114 | return TRUE; 115 | } 116 | 117 | static gboolean 118 | builder_source_inline_download (BuilderSource *source, 119 | gboolean update_vcs, 120 | BuilderContext *context, 121 | GError **error) 122 | { 123 | return TRUE; 124 | } 125 | 126 | static gboolean 127 | builder_source_inline_extract (BuilderSource *source, 128 | GFile *dest, 129 | GFile *source_dir, 130 | BuilderOptions *build_options, 131 | BuilderContext *context, 132 | GError **error) 133 | { 134 | BuilderSourceInline *self = BUILDER_SOURCE_INLINE (source); 135 | 136 | g_autoptr(GFile) dest_file = NULL; 137 | g_autoptr(GFileOutputStream) out = NULL; 138 | gsize size = 0; 139 | 140 | if (self->dest_filename == NULL) 141 | { 142 | g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED, "Property \"dest-filename\" must be set"); 143 | return FALSE; 144 | } 145 | 146 | dest_file = g_file_get_child (dest, self->dest_filename); 147 | 148 | out = g_file_replace (dest_file, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, error); 149 | if (out == NULL) 150 | return FALSE; 151 | 152 | if (self->contents == NULL) 153 | return TRUE; 154 | 155 | if (self->base64) 156 | { 157 | g_autofree guchar *contents = NULL; 158 | contents = g_base64_decode (self->contents, &size); 159 | if (!g_output_stream_write_all (G_OUTPUT_STREAM (out), contents, size, NULL, NULL, error)) 160 | return FALSE; 161 | } 162 | else 163 | { 164 | size = strlen (self->contents); 165 | if (!g_output_stream_write_all (G_OUTPUT_STREAM (out), self->contents, size, NULL, NULL, error)) 166 | return FALSE; 167 | } 168 | 169 | return TRUE; 170 | } 171 | 172 | static gboolean 173 | builder_source_inline_bundle (BuilderSource *source, 174 | BuilderContext *context, 175 | GError **error) 176 | { 177 | /* no need to bundle anything here as this part 178 | can be reconstructed from the manifest */ 179 | return TRUE; 180 | } 181 | 182 | static void 183 | builder_source_inline_checksum (BuilderSource *source, 184 | BuilderCache *cache, 185 | BuilderContext *context) 186 | { 187 | BuilderSourceInline *self = BUILDER_SOURCE_INLINE (source); 188 | 189 | builder_cache_checksum_str (cache, self->contents); 190 | builder_cache_checksum_str (cache, self->dest_filename); 191 | } 192 | 193 | static void 194 | builder_source_inline_class_init (BuilderSourceInlineClass *klass) 195 | { 196 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 197 | BuilderSourceClass *source_class = BUILDER_SOURCE_CLASS (klass); 198 | 199 | object_class->finalize = builder_source_inline_finalize; 200 | object_class->get_property = builder_source_inline_get_property; 201 | object_class->set_property = builder_source_inline_set_property; 202 | 203 | source_class->download = builder_source_inline_download; 204 | source_class->extract = builder_source_inline_extract; 205 | source_class->bundle = builder_source_inline_bundle; 206 | source_class->checksum = builder_source_inline_checksum; 207 | source_class->validate = builder_source_inline_validate; 208 | 209 | g_object_class_install_property (object_class, 210 | PROP_CONTENTS, 211 | g_param_spec_string ("contents", 212 | "", 213 | "", 214 | NULL, 215 | G_PARAM_READWRITE)); 216 | g_object_class_install_property (object_class, 217 | PROP_BASE64, 218 | g_param_spec_boolean ("base64", 219 | "", 220 | "", 221 | FALSE, 222 | G_PARAM_READWRITE)); 223 | g_object_class_install_property (object_class, 224 | PROP_DEST_FILENAME, 225 | g_param_spec_string ("dest-filename", 226 | "", 227 | "", 228 | NULL, 229 | G_PARAM_READWRITE)); 230 | } 231 | 232 | static void 233 | builder_source_inline_init (BuilderSourceInline *self) 234 | { 235 | } 236 | -------------------------------------------------------------------------------- /src/builder-source-shell.c: -------------------------------------------------------------------------------- 1 | /* builder-source-shell.c 2 | * 3 | * Copyright (C) 2015 Red Hat, Inc 4 | * 5 | * This file is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU Lesser General Public License as 7 | * published by the Free Software Foundation; either version 2 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This file is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * Authors: 19 | * Alexander Larsson 20 | */ 21 | 22 | #include "config.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "builder-flatpak-utils.h" 31 | #include "builder-utils.h" 32 | #include "builder-source-shell.h" 33 | 34 | struct BuilderSourceShell 35 | { 36 | BuilderSource parent; 37 | 38 | char **commands; 39 | }; 40 | 41 | typedef struct 42 | { 43 | BuilderSourceClass parent_class; 44 | } BuilderSourceShellClass; 45 | 46 | G_DEFINE_TYPE (BuilderSourceShell, builder_source_shell, BUILDER_TYPE_SOURCE); 47 | 48 | enum { 49 | PROP_0, 50 | PROP_COMMANDS, 51 | LAST_PROP 52 | }; 53 | 54 | static void 55 | builder_source_shell_finalize (GObject *object) 56 | { 57 | BuilderSourceShell *self = (BuilderSourceShell *) object; 58 | 59 | g_strfreev (self->commands); 60 | 61 | G_OBJECT_CLASS (builder_source_shell_parent_class)->finalize (object); 62 | } 63 | 64 | static void 65 | builder_source_shell_get_property (GObject *object, 66 | guint prop_id, 67 | GValue *value, 68 | GParamSpec *pspec) 69 | { 70 | BuilderSourceShell *self = BUILDER_SOURCE_SHELL (object); 71 | 72 | switch (prop_id) 73 | { 74 | case PROP_COMMANDS: 75 | g_value_set_boxed (value, self->commands); 76 | break; 77 | 78 | default: 79 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 80 | } 81 | } 82 | 83 | static void 84 | builder_source_shell_set_property (GObject *object, 85 | guint prop_id, 86 | const GValue *value, 87 | GParamSpec *pspec) 88 | { 89 | BuilderSourceShell *self = BUILDER_SOURCE_SHELL (object); 90 | gchar **tmp; 91 | 92 | switch (prop_id) 93 | { 94 | case PROP_COMMANDS: 95 | tmp = self->commands; 96 | self->commands = g_strdupv (g_value_get_boxed (value)); 97 | g_strfreev (tmp); 98 | break; 99 | 100 | default: 101 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 102 | } 103 | } 104 | 105 | static gboolean 106 | builder_source_shell_download (BuilderSource *source, 107 | gboolean update_vcs, 108 | BuilderContext *context, 109 | GError **error) 110 | { 111 | return TRUE; 112 | } 113 | 114 | static gboolean 115 | run_script (BuilderContext *context, 116 | BuilderOptions *build_options, 117 | GFile *source_dir, 118 | const gchar *script, 119 | GError **error) 120 | { 121 | GFile *app_dir = builder_context_get_app_dir (context); 122 | g_autoptr(GPtrArray) args = NULL; 123 | g_autofree char *source_dir_path = g_file_get_path (source_dir); 124 | g_autofree char *source_dir_path_canonical = NULL; 125 | g_autoptr(GFile) source_dir_path_canonical_file = NULL; 126 | g_auto(GStrv) build_args = NULL; 127 | g_auto(GStrv) env = NULL; 128 | int i; 129 | 130 | env = builder_options_get_env (build_options, context); 131 | 132 | args = g_ptr_array_new_with_free_func (g_free); 133 | g_ptr_array_add (args, g_strdup ("flatpak")); 134 | g_ptr_array_add (args, g_strdup ("build")); 135 | g_ptr_array_add (args, g_strdup ("--die-with-parent")); 136 | 137 | source_dir_path_canonical = realpath (source_dir_path, NULL); 138 | 139 | g_ptr_array_add (args, g_strdup ("--nofilesystem=host:reset")); 140 | g_ptr_array_add (args, g_strdup_printf ("--filesystem=%s", source_dir_path_canonical)); 141 | 142 | if (env) 143 | { 144 | for (i = 0; env[i] != NULL; i++) 145 | g_ptr_array_add (args, g_strdup_printf ("--env=%s", env[i])); 146 | } 147 | 148 | build_args = builder_options_get_build_args (build_options, context, error); 149 | if (build_args == NULL) 150 | return FALSE; 151 | 152 | for (i = 0; build_args[i] != NULL; i++) 153 | g_ptr_array_add (args, g_strdup (build_args[i])); 154 | 155 | g_ptr_array_add (args, g_file_get_path (app_dir)); 156 | g_ptr_array_add (args, g_strdup ("/bin/sh")); 157 | g_ptr_array_add (args, g_strdup ("-c")); 158 | g_ptr_array_add (args, g_strdup (script)); 159 | g_ptr_array_add (args, NULL); 160 | 161 | source_dir_path_canonical_file = g_file_new_for_path (source_dir_path_canonical); 162 | 163 | return builder_maybe_host_spawnv (source_dir_path_canonical_file, NULL, 0, error, (const char * const *)args->pdata, NULL); 164 | } 165 | 166 | 167 | static gboolean 168 | builder_source_shell_extract (BuilderSource *source, 169 | GFile *dest, 170 | GFile *source_dir, 171 | BuilderOptions *build_options, 172 | BuilderContext *context, 173 | GError **error) 174 | { 175 | BuilderSourceShell *self = BUILDER_SOURCE_SHELL (source); 176 | int i; 177 | 178 | if (self->commands) 179 | { 180 | for (i = 0; self->commands[i] != NULL; i++) 181 | { 182 | if (!run_script (context, build_options, 183 | dest, self->commands[i], error)) 184 | return FALSE; 185 | } 186 | } 187 | 188 | 189 | return TRUE; 190 | } 191 | 192 | static gboolean 193 | builder_source_shell_bundle (BuilderSource *source, 194 | BuilderContext *context, 195 | GError **error) 196 | { 197 | /* no need to bundle anything here as this part 198 | can be reconstructed from the manifest */ 199 | return TRUE; 200 | } 201 | 202 | static void 203 | builder_source_shell_checksum (BuilderSource *source, 204 | BuilderCache *cache, 205 | BuilderContext *context) 206 | { 207 | BuilderSourceShell *self = BUILDER_SOURCE_SHELL (source); 208 | 209 | builder_cache_checksum_strv (cache, self->commands); 210 | } 211 | 212 | static void 213 | builder_source_shell_class_init (BuilderSourceShellClass *klass) 214 | { 215 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 216 | BuilderSourceClass *source_class = BUILDER_SOURCE_CLASS (klass); 217 | 218 | object_class->finalize = builder_source_shell_finalize; 219 | object_class->get_property = builder_source_shell_get_property; 220 | object_class->set_property = builder_source_shell_set_property; 221 | 222 | source_class->download = builder_source_shell_download; 223 | source_class->extract = builder_source_shell_extract; 224 | source_class->bundle = builder_source_shell_bundle; 225 | source_class->checksum = builder_source_shell_checksum; 226 | 227 | g_object_class_install_property (object_class, 228 | PROP_COMMANDS, 229 | g_param_spec_boxed ("commands", 230 | "", 231 | "", 232 | G_TYPE_STRV, 233 | G_PARAM_READWRITE)); 234 | } 235 | 236 | static void 237 | builder_source_shell_init (BuilderSourceShell *self) 238 | { 239 | } 240 | -------------------------------------------------------------------------------- /tests/test-builder.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2011 Colin Walters 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the 17 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 | # Boston, MA 02111-1307, USA. 19 | 20 | set -euo pipefail 21 | 22 | . $(dirname $0)/libtest.sh 23 | 24 | skip_without_fuse 25 | 26 | echo "1..11" 27 | 28 | setup_repo 29 | install_repo 30 | setup_sdk_repo 31 | install_sdk_repo 32 | 33 | # Need /var/tmp cwd for xattrs 34 | REPO=`pwd`/repos/test 35 | cd $TEST_DATA_DIR/ 36 | 37 | cp -a $(dirname $0)/test-configure . 38 | echo "version1" > app-data 39 | cp $(dirname $0)/test-rename.json . 40 | cp $(dirname $0)/test-rename-appdata.json . 41 | cp $(dirname $0)/test.json . 42 | cp $(dirname $0)/test.yaml . 43 | cp $(dirname $0)/test-runtime.json . 44 | cp $(dirname $0)/0001-Add-test-logo.patch . 45 | cp $(dirname $0)/Hello.desktop . 46 | cp $(dirname $0)/Hello.xml . 47 | cp $(dirname $0)/Hello.appdata.xml . 48 | cp $(dirname $0)/Hello-desktop.appdata.xml . 49 | cp $(dirname $0)/org.test.Hello.desktop . 50 | cp $(dirname $0)/org.test.Hello.xml . 51 | cp $(dirname $0)/org.test.Hello.appdata.xml . 52 | cp $(dirname $0)/org.flatpak_builder.gui.desktop . 53 | cp $(dirname $0)/org.flatpak_builder.gui.json . 54 | cp $(dirname $0)/org.flatpak_builder.gui.metainfo.xml . 55 | cp $(dirname $0)/org.test.Hello.png . 56 | cp $(dirname $0)/org.test.Hello-256.png . 57 | cp $(dirname $0)/org.flatpak.appstream_media.json . 58 | cp $(dirname $0)/org.flatpak.install_test.json . 59 | mkdir include1 60 | cp $(dirname $0)/module1.json include1/ 61 | cp $(dirname $0)/module1.yaml include1/ 62 | cp $(dirname $0)/source1.json include1/ 63 | cp $(dirname $0)/data1 include1/ 64 | cp $(dirname $0)/data1.patch include1/ 65 | mkdir include1/include2 66 | cp $(dirname $0)/module2.json include1/include2/ 67 | cp $(dirname $0)/module2.yaml include1/include2/ 68 | cp $(dirname $0)/source2.json include1/include2/ 69 | cp $(dirname $0)/data2 include1/include2/ 70 | cp $(dirname $0)/data2.patch include1/include2/ 71 | echo "MY LICENSE" > ./LICENSE 72 | 73 | for MANIFEST in test.json test.yaml test-rename.json test-rename-appdata.json ; do 74 | echo "building manifest $MANIFEST" >&2 75 | ${FLATPAK_BUILDER} --repo=$REPO $FL_GPGARGS --force-clean appdir $MANIFEST >&2 76 | 77 | assert_file_has_content appdir/files/share/app-data version1 78 | assert_file_has_content appdir/metadata shared=network; 79 | assert_file_has_content appdir/metadata tags=test; 80 | assert_file_has_content appdir/files/ran_module1 module1 81 | assert_file_has_content appdir/files/ran_module2 module2 82 | 83 | assert_not_has_file appdir/files/cleanup/a_filee 84 | assert_not_has_file appdir/files/bin/file.cleanup 85 | 86 | assert_has_file appdir/files/cleaned_up > out 87 | assert_has_file appdir/files/share/icons/hicolor/64x64/apps/org.test.Hello2.png 88 | assert_has_file appdir/files/share/icons/hicolor/64x64/mimetypes/org.test.Hello2.application-x-hello.png 89 | assert_has_file appdir/files/share/icons/hicolor/64x64/mimetypes/org.test.Hello2.application-x-goodbye.png 90 | assert_has_file appdir/files/share/applications/org.test.Hello2.desktop 91 | assert_has_file appdir/files/share/metainfo/org.test.Hello2.metainfo.xml 92 | xmllint --noout appdir/files/share/metainfo/org.test.Hello2.metainfo.xml >&2 93 | grep -qs "org.test.Hello2" appdir/files/share/metainfo/org.test.Hello2.metainfo.xml 94 | 95 | assert_has_file appdir/files/share/mime/packages/org.test.Hello2.xml 96 | xmllint --noout appdir/files/share/mime/packages/org.test.Hello2.xml >&2 97 | 98 | assert_file_has_content appdir/files/out '^foo$' 99 | assert_file_has_content appdir/files/out2 '^foo2$' 100 | 101 | assert_file_has_content appdir/files/source1 'Hello, from source 1' 102 | assert_file_has_content appdir/files/source2 'Hello, from source 2' 103 | 104 | ${FLATPAK} build appdir /app/bin/hello2.sh > hello_out2 105 | assert_file_has_content hello_out2 '^Hello world2, from a sandbox$' 106 | 107 | assert_file_has_content appdir/files/share/licenses/org.test.Hello2/test/LICENSE '^MY LICENSE$' 108 | 109 | echo "ok build" 110 | done 111 | 112 | ${FLATPAK} ${U} install -y test-repo org.test.Hello2 master >&2 113 | run org.test.Hello2 > hello_out3 114 | assert_file_has_content hello_out3 '^Hello world2, from a sandbox$' 115 | 116 | run --command=cat org.test.Hello2 /app/share/app-data > app_data_1 117 | assert_file_has_content app_data_1 version1 118 | 119 | echo "ok install+run" 120 | 121 | echo "version2" > app-data 122 | ${FLATPAK_BUILDER} $FL_GPGARGS --repo=$REPO --force-clean appdir test.json >&2 123 | assert_file_has_content appdir/files/share/app-data version2 124 | ${FLATPAK_BUILDER} $FL_GPGARGS --repo=$REPO --force-clean appdir test.yaml >&2 125 | assert_file_has_content appdir/files/share/app-data version2 126 | 127 | ${FLATPAK} ${U} update -y org.test.Hello2 master >&2 128 | 129 | run --command=cat org.test.Hello2 /app/share/app-data > app_data_2 130 | assert_file_has_content app_data_2 version2 131 | 132 | echo "ok update" 133 | 134 | # The build-args of --help should prevent the faulty cleanup and 135 | # platform-cleanup commands from executing 136 | ${FLATPAK_BUILDER} $FL_GPGARGS --repo=$REPO --force-clean runtimedir \ 137 | test-runtime.json >&2 138 | 139 | echo "ok runtime build cleanup with build-args" 140 | 141 | # test screenshot ref commit 142 | ${FLATPAK_BUILDER} --repo=$REPO/repo_sc --force-clean builddir_sc \ 143 | --mirror-screenshots-url=https://example.org/media \ 144 | org.flatpak_builder.gui.json >&2 145 | ostree --repo=$REPO/repo_sc refs|grep -Eq "^screenshots/$(flatpak --default-arch)$" 146 | ostree checkout --repo=$REPO/repo_sc -U screenshots/$(flatpak --default-arch) outdir_sc 147 | find outdir_sc -path "*/icons/64x64/org.test.Hello.png" -type f | grep -q . 148 | 149 | echo "ok screenshot ref commit" 150 | 151 | # test compose partial url policy 152 | ${FLATPAK_BUILDER} --force-clean builddir_sc \ 153 | --mirror-screenshots-url=https://example.org/media \ 154 | --state-dir .fp-compose-url-policy-partial \ 155 | --compose-url-policy=partial \ 156 | org.flatpak.appstream_media.json >&2 157 | # we test for the icon tag instead of screenshot 158 | # the former works offline the latter does not 159 | gzip -cdq builddir_sc/files/share/app-info/xmls/org.flatpak.appstream_media.xml.gz|grep -Eq '>org/flatpak/appstream_media/[^/]+/icons/128x128/org.flatpak.appstream_media.png' 160 | 161 | echo "ok compose partial url policy" 162 | 163 | # test compose full url policy 164 | if appstream_has_version 0 16 3; then 165 | ${FLATPAK_BUILDER} --force-clean builddir_sc \ 166 | --mirror-screenshots-url=https://example.org/media \ 167 | --state-dir .fp-compose-url-policy-full \ 168 | --compose-url-policy=full \ 169 | org.flatpak.appstream_media.json >&2 170 | 171 | gzip -cdq builddir_sc/files/share/app-info/xmls/org.flatpak.appstream_media.xml.gz|grep -Eq '>https://example.org/media/org/flatpak/appstream_media/[^/]+/icons/128x128/org.flatpak.appstream_media.png' 172 | 173 | echo "ok compose full url policy" 174 | else 175 | echo "ok # Skip AppStream < 0.16.3" 176 | fi 177 | 178 | # test install 179 | ${FLATPAK_BUILDER} --user --install \ 180 | --force-clean builddir org.flatpak.install_test.json >&2 181 | REFS=$(flatpak list --all --columns=ref 2>/dev/null) 182 | echo "$REFS" | grep -q "org\.flatpak\.install_test" 183 | echo "$REFS" | grep -q "org\.flatpak\.install_test\.Debug" 184 | echo "$REFS" | grep -q "org\.flatpak\.install_test\.Locale" 185 | 186 | echo "ok install" 187 | -------------------------------------------------------------------------------- /src/builder-source-script.c: -------------------------------------------------------------------------------- 1 | /* builder-source-script.c 2 | * 3 | * Copyright (C) 2015 Red Hat, Inc 4 | * 5 | * This script is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU Lesser General Public License as 7 | * published by the Free Software Foundation; either version 2 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This script is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * Authors: 19 | * Alexander Larsson 20 | */ 21 | 22 | #include "config.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "builder-flatpak-utils.h" 31 | #include "builder-utils.h" 32 | #include "builder-source-script.h" 33 | 34 | struct BuilderSourceScript 35 | { 36 | BuilderSource parent; 37 | 38 | char **commands; 39 | char *dest_filename; 40 | }; 41 | 42 | typedef struct 43 | { 44 | BuilderSourceClass parent_class; 45 | } BuilderSourceScriptClass; 46 | 47 | G_DEFINE_TYPE (BuilderSourceScript, builder_source_script, BUILDER_TYPE_SOURCE); 48 | 49 | enum { 50 | PROP_0, 51 | PROP_COMMANDS, 52 | PROP_DEST_FILENAME, 53 | LAST_PROP 54 | }; 55 | 56 | static void 57 | builder_source_script_finalize (GObject *object) 58 | { 59 | BuilderSourceScript *self = (BuilderSourceScript *) object; 60 | 61 | g_strfreev (self->commands); 62 | g_free (self->dest_filename); 63 | 64 | G_OBJECT_CLASS (builder_source_script_parent_class)->finalize (object); 65 | } 66 | 67 | static void 68 | builder_source_script_get_property (GObject *object, 69 | guint prop_id, 70 | GValue *value, 71 | GParamSpec *pspec) 72 | { 73 | BuilderSourceScript *self = BUILDER_SOURCE_SCRIPT (object); 74 | 75 | switch (prop_id) 76 | { 77 | case PROP_COMMANDS: 78 | g_value_set_boxed (value, self->commands); 79 | break; 80 | 81 | case PROP_DEST_FILENAME: 82 | g_value_set_string (value, self->dest_filename); 83 | break; 84 | 85 | default: 86 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 87 | } 88 | } 89 | 90 | static void 91 | builder_source_script_set_property (GObject *object, 92 | guint prop_id, 93 | const GValue *value, 94 | GParamSpec *pspec) 95 | { 96 | BuilderSourceScript *self = BUILDER_SOURCE_SCRIPT (object); 97 | gchar **tmp; 98 | 99 | switch (prop_id) 100 | { 101 | case PROP_COMMANDS: 102 | tmp = self->commands; 103 | self->commands = g_strdupv (g_value_get_boxed (value)); 104 | g_strfreev (tmp); 105 | break; 106 | 107 | case PROP_DEST_FILENAME: 108 | g_free (self->dest_filename); 109 | self->dest_filename = g_value_dup_string (value); 110 | break; 111 | 112 | default: 113 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 114 | } 115 | } 116 | 117 | static gboolean 118 | builder_source_script_validate (BuilderSource *source, 119 | GError **error) 120 | { 121 | BuilderSourceScript *self = BUILDER_SOURCE_SCRIPT (source); 122 | 123 | if (self->dest_filename != NULL && 124 | strchr (self->dest_filename, '/') != NULL) 125 | return flatpak_fail (error, "No slashes allowed in dest-filename, use dest property for directory"); 126 | 127 | return TRUE; 128 | } 129 | 130 | static gboolean 131 | builder_source_script_download (BuilderSource *source, 132 | gboolean update_vcs, 133 | BuilderContext *context, 134 | GError **error) 135 | { 136 | return TRUE; 137 | } 138 | 139 | static gboolean 140 | builder_source_script_extract (BuilderSource *source, 141 | GFile *dest, 142 | GFile *source_dir, 143 | BuilderOptions *build_options, 144 | BuilderContext *context, 145 | GError **error) 146 | { 147 | BuilderSourceScript *self = BUILDER_SOURCE_SCRIPT (source); 148 | 149 | g_autoptr(GFile) dest_script = NULL; 150 | const char *dest_filename; 151 | g_autoptr(GString) script = NULL; 152 | int i; 153 | guint32 perms; 154 | 155 | script = g_string_new ("#!/bin/sh\n"); 156 | 157 | if (self->commands) 158 | { 159 | for (i = 0; self->commands[i] != NULL; i++) 160 | { 161 | g_string_append (script, self->commands[i]); 162 | g_string_append_c (script, '\n'); 163 | } 164 | } 165 | 166 | if (self->dest_filename) 167 | dest_filename = self->dest_filename; 168 | else 169 | dest_filename = "autogen.sh"; 170 | 171 | dest_script = g_file_get_child (dest, dest_filename); 172 | 173 | if (!g_file_set_contents (flatpak_file_get_path_cached (dest_script), 174 | script->str, 175 | script->len, 176 | error)) 177 | return FALSE; 178 | 179 | perms = 0755; 180 | if (!g_file_set_attribute (dest_script, 181 | G_FILE_ATTRIBUTE_UNIX_MODE, 182 | G_FILE_ATTRIBUTE_TYPE_UINT32, 183 | &perms, 184 | G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, 185 | NULL, error)) 186 | return FALSE; 187 | 188 | return TRUE; 189 | } 190 | 191 | static gboolean 192 | builder_source_script_bundle (BuilderSource *source, 193 | BuilderContext *context, 194 | GError **error) 195 | { 196 | /* no need to bundle anything here as this part 197 | can be reconstructed from the manifest */ 198 | return TRUE; 199 | } 200 | 201 | static void 202 | builder_source_script_checksum (BuilderSource *source, 203 | BuilderCache *cache, 204 | BuilderContext *context) 205 | { 206 | BuilderSourceScript *self = BUILDER_SOURCE_SCRIPT (source); 207 | 208 | builder_cache_checksum_strv (cache, self->commands); 209 | builder_cache_checksum_str (cache, self->dest_filename); 210 | } 211 | 212 | static void 213 | builder_source_script_class_init (BuilderSourceScriptClass *klass) 214 | { 215 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 216 | BuilderSourceClass *source_class = BUILDER_SOURCE_CLASS (klass); 217 | 218 | object_class->finalize = builder_source_script_finalize; 219 | object_class->get_property = builder_source_script_get_property; 220 | object_class->set_property = builder_source_script_set_property; 221 | 222 | source_class->download = builder_source_script_download; 223 | source_class->extract = builder_source_script_extract; 224 | source_class->bundle = builder_source_script_bundle; 225 | source_class->checksum = builder_source_script_checksum; 226 | source_class->validate = builder_source_script_validate; 227 | 228 | g_object_class_install_property (object_class, 229 | PROP_COMMANDS, 230 | g_param_spec_boxed ("commands", 231 | "", 232 | "", 233 | G_TYPE_STRV, 234 | G_PARAM_READWRITE)); 235 | g_object_class_install_property (object_class, 236 | PROP_DEST_FILENAME, 237 | g_param_spec_string ("dest-filename", 238 | "", 239 | "", 240 | NULL, 241 | G_PARAM_READWRITE)); 242 | } 243 | 244 | static void 245 | builder_source_script_init (BuilderSourceScript *self) 246 | { 247 | } 248 | -------------------------------------------------------------------------------- /src/builder-manifest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * Copyright © 2023 GNOME Foundation Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library. If not, see . 17 | * 18 | * Authors: 19 | * Alexander Larsson 20 | * Hubert Figuière 21 | */ 22 | 23 | #ifndef __BUILDER_MANIFEST_H__ 24 | #define __BUILDER_MANIFEST_H__ 25 | 26 | #include 27 | 28 | #include "builder-flatpak-utils.h" 29 | #include "builder-options.h" 30 | #include "builder-module.h" 31 | #include "builder-cache.h" 32 | #include "builder-extension.h" 33 | 34 | G_BEGIN_DECLS 35 | 36 | typedef struct BuilderManifest BuilderManifest; 37 | 38 | #define BUILDER_TYPE_MANIFEST (builder_manifest_get_type ()) 39 | #define BUILDER_MANIFEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_MANIFEST, BuilderManifest)) 40 | #define BUILDER_IS_MANIFEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_MANIFEST)) 41 | 42 | /* Bump this if format changes in incompatible ways to force rebuild */ 43 | #define BUILDER_MANIFEST_CHECKSUM_VERSION "5" 44 | #define BUILDER_MANIFEST_CHECKSUM_CLEANUP_VERSION "1" 45 | #define BUILDER_MANIFEST_CHECKSUM_FINISH_VERSION "3" 46 | #define BUILDER_MANIFEST_CHECKSUM_BUNDLE_SOURCES_VERSION "1" 47 | #define BUILDER_MANIFEST_CHECKSUM_PLATFORM_VERSION "1" 48 | 49 | GType builder_manifest_get_type (void); 50 | 51 | void builder_manifest_set_demarshal_base_dir (GFile *dir); 52 | GFile *builder_manifest_get_demarshal_base_dir (void); 53 | 54 | const char * builder_manifest_get_id (BuilderManifest *self); 55 | char * builder_manifest_get_locale_id (BuilderManifest *self); 56 | char * builder_manifest_get_debug_id (BuilderManifest *self); 57 | char * builder_manifest_get_sources_id (BuilderManifest *self); 58 | const char * builder_manifest_get_id_platform (BuilderManifest *self); 59 | char * builder_manifest_get_locale_id_platform (BuilderManifest *self); 60 | BuilderOptions *builder_manifest_get_build_options (BuilderManifest *self); 61 | GList * builder_manifest_get_modules (BuilderManifest *self); 62 | GList * builder_manifest_get_add_extensions (BuilderManifest *self); 63 | GList * builder_manifest_get_add_build_extensions (BuilderManifest *self); 64 | const char * builder_manifest_get_branch (BuilderManifest *self, 65 | BuilderContext *context); 66 | const char * builder_manifest_get_collection_id (BuilderManifest *self); 67 | gint32 builder_manifest_get_token_type (BuilderManifest *self); 68 | const char * builder_manifest_get_extension_tag (BuilderManifest *self); 69 | void builder_manifest_set_default_collection_id (BuilderManifest *self, 70 | const char *default_collection_id); 71 | void builder_manifest_set_default_token_type (BuilderManifest *self, 72 | gint32 default_token_type); 73 | 74 | void builder_manifest_add_tags (BuilderManifest *self, 75 | const char **add_tags); 76 | void builder_manifest_remove_tags (BuilderManifest *self, 77 | const char **remove_tags); 78 | 79 | 80 | char ** builder_manifest_get_exclude_dirs (BuilderManifest *self); 81 | 82 | gboolean builder_manifest_start (BuilderManifest *self, 83 | gboolean download_only, 84 | gboolean allow_missing_runtimes, 85 | BuilderContext *context, 86 | GError **error); 87 | gboolean builder_manifest_init_app_dir (BuilderManifest *self, 88 | BuilderCache *cache, 89 | BuilderContext *context, 90 | GError **error); 91 | gboolean builder_manifest_download (BuilderManifest *self, 92 | gboolean update_vcs, 93 | const char *only_module, 94 | BuilderContext *context, 95 | GError **error); 96 | gboolean builder_manifest_build_shell (BuilderManifest *self, 97 | BuilderContext *context, 98 | const char *modulename, 99 | GError **error); 100 | gboolean builder_manifest_build (BuilderManifest *self, 101 | BuilderCache *cache, 102 | BuilderContext *context, 103 | GError **error); 104 | gboolean builder_manifest_install_deps (BuilderManifest *self, 105 | BuilderContext *context, 106 | char * const *remotes, 107 | gboolean opt_user, 108 | const char *opt_installation, 109 | gboolean opt_yes, 110 | GError **error); 111 | gboolean builder_manifest_run (BuilderManifest *self, 112 | BuilderContext *context, 113 | FlatpakContext *arg_context, 114 | char **argv, 115 | int argc, 116 | gboolean log_session_bus, 117 | gboolean log_system_bus, 118 | GError **error); 119 | gboolean builder_manifest_show_deps (BuilderManifest *self, 120 | BuilderContext *context, 121 | GError **error); 122 | void builder_manifest_checksum (BuilderManifest *self, 123 | BuilderCache *cache, 124 | BuilderContext *context); 125 | gboolean builder_manifest_cleanup (BuilderManifest *self, 126 | BuilderCache *cache, 127 | BuilderContext *context, 128 | GError **error); 129 | gboolean builder_manifest_finish (BuilderManifest *self, 130 | BuilderCache *cache, 131 | BuilderContext *context, 132 | GError **error); 133 | gboolean builder_manifest_bundle_sources (BuilderManifest *self, 134 | const char *json, 135 | BuilderCache *cache, 136 | BuilderContext *context, 137 | GError **error); 138 | gboolean builder_manifest_create_platform (BuilderManifest *self, 139 | BuilderCache *cache, 140 | BuilderContext *context, 141 | GError **error); 142 | char * builder_manifest_serialize (BuilderManifest *self); 143 | 144 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderManifest, g_object_unref) 145 | 146 | G_END_DECLS 147 | 148 | #endif /* __BUILDER_MANIFEST_H__ */ 149 | -------------------------------------------------------------------------------- /src/builder-source-extra-data.c: -------------------------------------------------------------------------------- 1 | /* builder-source-extra_data.c 2 | * 3 | * Copyright (C) 2015 Red Hat, Inc 4 | * 5 | * This file is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU Lesser General Public License as 7 | * published by the Free Software Foundation; either version 2 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This file is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * Authors: 19 | * Alexander Larsson 20 | */ 21 | 22 | #include "config.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "builder-flatpak-utils.h" 31 | #include "builder-utils.h" 32 | #include "builder-source-extra-data.h" 33 | 34 | struct BuilderSourceExtraData 35 | { 36 | BuilderSource parent; 37 | 38 | char *filename; 39 | char *url; 40 | char *sha256; 41 | guint64 size; 42 | guint64 installed_size; 43 | }; 44 | 45 | typedef struct 46 | { 47 | BuilderSourceClass parent_class; 48 | } BuilderSourceExtraDataClass; 49 | 50 | G_DEFINE_TYPE (BuilderSourceExtraData, builder_source_extra_data, BUILDER_TYPE_SOURCE); 51 | 52 | enum { 53 | PROP_0, 54 | PROP_FILENAME, 55 | PROP_URL, 56 | PROP_SHA256, 57 | PROP_SIZE, 58 | PROP_INSTALLED_SIZE, 59 | LAST_PROP 60 | }; 61 | 62 | static void 63 | builder_source_extra_data_finalize (GObject *object) 64 | { 65 | BuilderSourceExtraData *self = (BuilderSourceExtraData *) object; 66 | 67 | g_free (self->filename); 68 | g_free (self->url); 69 | g_free (self->sha256); 70 | 71 | G_OBJECT_CLASS (builder_source_extra_data_parent_class)->finalize (object); 72 | } 73 | 74 | static void 75 | builder_source_extra_data_get_property (GObject *object, 76 | guint prop_id, 77 | GValue *value, 78 | GParamSpec *pspec) 79 | { 80 | BuilderSourceExtraData *self = BUILDER_SOURCE_EXTRA_DATA (object); 81 | 82 | switch (prop_id) 83 | { 84 | case PROP_FILENAME: 85 | g_value_set_string (value, self->filename); 86 | break; 87 | 88 | case PROP_URL: 89 | g_value_set_string (value, self->url); 90 | break; 91 | 92 | case PROP_SHA256: 93 | g_value_set_string (value, self->sha256); 94 | break; 95 | 96 | case PROP_SIZE: 97 | g_value_set_uint64 (value, self->size); 98 | break; 99 | 100 | case PROP_INSTALLED_SIZE: 101 | g_value_set_uint64 (value, self->installed_size); 102 | break; 103 | 104 | default: 105 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 106 | } 107 | } 108 | 109 | static void 110 | builder_source_extra_data_set_property (GObject *object, 111 | guint prop_id, 112 | const GValue *value, 113 | GParamSpec *pspec) 114 | { 115 | BuilderSourceExtraData *self = BUILDER_SOURCE_EXTRA_DATA (object); 116 | 117 | switch (prop_id) 118 | { 119 | case PROP_FILENAME: 120 | g_free (self->filename); 121 | self->filename = g_value_dup_string (value); 122 | break; 123 | 124 | case PROP_URL: 125 | g_free (self->url); 126 | self->url = g_value_dup_string (value); 127 | break; 128 | 129 | case PROP_SHA256: 130 | g_free (self->sha256); 131 | self->sha256 = g_value_dup_string (value); 132 | break; 133 | 134 | case PROP_SIZE: 135 | self->size = g_value_get_uint64 (value); 136 | break; 137 | 138 | case PROP_INSTALLED_SIZE: 139 | self->installed_size = g_value_get_uint64 (value); 140 | break; 141 | 142 | default: 143 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 144 | } 145 | } 146 | 147 | static gboolean 148 | builder_source_extra_data_download (BuilderSource *source, 149 | gboolean update_vcs, 150 | BuilderContext *context, 151 | GError **error) 152 | { 153 | BuilderSourceExtraData *self = BUILDER_SOURCE_EXTRA_DATA (source); 154 | 155 | if (self->filename == NULL) 156 | return flatpak_fail (error, "No filename specified for extra data source"); 157 | 158 | if (self->url == NULL) 159 | return flatpak_fail (error, "No url specified for extra data source"); 160 | 161 | if (self->sha256 == NULL) 162 | return flatpak_fail (error, "No sha256 specified for extra data source"); 163 | 164 | if (self->size == 0) 165 | return flatpak_fail (error, "No size specified for extra data source"); 166 | 167 | return TRUE; 168 | } 169 | 170 | 171 | static gboolean 172 | builder_source_extra_data_extract (BuilderSource *source, 173 | GFile *dest, 174 | GFile *source_dir, 175 | BuilderOptions *build_options, 176 | BuilderContext *context, 177 | GError **error) 178 | { 179 | return TRUE; 180 | } 181 | 182 | static gboolean 183 | builder_source_extra_data_bundle (BuilderSource *source, 184 | BuilderContext *context, 185 | GError **error) 186 | { 187 | return TRUE; 188 | } 189 | 190 | static void 191 | builder_source_extra_data_checksum (BuilderSource *source, 192 | BuilderCache *cache, 193 | BuilderContext *context) 194 | { 195 | BuilderSourceExtraData *self = BUILDER_SOURCE_EXTRA_DATA (source); 196 | 197 | builder_cache_checksum_str (cache, self->filename); 198 | builder_cache_checksum_str (cache, self->url); 199 | builder_cache_checksum_str (cache, self->sha256); 200 | builder_cache_checksum_uint64 (cache, self->size); 201 | builder_cache_checksum_uint64 (cache, self->installed_size); 202 | } 203 | 204 | static void 205 | builder_source_extra_data_finish (BuilderSource *source, 206 | GPtrArray *args, 207 | BuilderContext *context) 208 | { 209 | BuilderSourceExtraData *self = BUILDER_SOURCE_EXTRA_DATA (source); 210 | char *arg; 211 | g_autofree char *installed_size = NULL; 212 | 213 | if (self->installed_size != 0) 214 | installed_size = g_strdup_printf ("%" G_GUINT64_FORMAT, self->installed_size); 215 | else 216 | installed_size = g_strdup (""); 217 | 218 | arg = g_strdup_printf ("--extra-data=%s:%s:%"G_GUINT64_FORMAT":%s:%s", 219 | self->filename, 220 | self->sha256, 221 | self->size, 222 | installed_size, 223 | self->url); 224 | 225 | g_ptr_array_add (args, arg); 226 | } 227 | 228 | static void 229 | builder_source_extra_data_class_init (BuilderSourceExtraDataClass *klass) 230 | { 231 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 232 | BuilderSourceClass *source_class = BUILDER_SOURCE_CLASS (klass); 233 | 234 | object_class->finalize = builder_source_extra_data_finalize; 235 | object_class->get_property = builder_source_extra_data_get_property; 236 | object_class->set_property = builder_source_extra_data_set_property; 237 | 238 | source_class->download = builder_source_extra_data_download; 239 | source_class->extract = builder_source_extra_data_extract; 240 | source_class->bundle = builder_source_extra_data_bundle; 241 | source_class->checksum = builder_source_extra_data_checksum; 242 | source_class->finish = builder_source_extra_data_finish; 243 | 244 | g_object_class_install_property (object_class, 245 | PROP_URL, 246 | g_param_spec_string ("url", 247 | "", 248 | "", 249 | NULL, 250 | G_PARAM_READWRITE)); 251 | g_object_class_install_property (object_class, 252 | PROP_FILENAME, 253 | g_param_spec_string ("filename", 254 | "", 255 | "", 256 | NULL, 257 | G_PARAM_READWRITE)); 258 | g_object_class_install_property (object_class, 259 | PROP_SHA256, 260 | g_param_spec_string ("sha256", 261 | "", 262 | "", 263 | NULL, 264 | G_PARAM_READWRITE)); 265 | g_object_class_install_property (object_class, 266 | PROP_SIZE, 267 | g_param_spec_uint64 ("size", 268 | "", 269 | "", 270 | 0, G_MAXUINT64, 271 | 0, 272 | G_PARAM_READWRITE)); 273 | g_object_class_install_property (object_class, 274 | PROP_INSTALLED_SIZE, 275 | g_param_spec_uint64 ("installed-size", 276 | "", 277 | "", 278 | 0, G_MAXUINT64, 279 | 0, 280 | G_PARAM_READWRITE)); 281 | } 282 | 283 | static void 284 | builder_source_extra_data_init (BuilderSourceExtraData *self) 285 | { 286 | } 287 | -------------------------------------------------------------------------------- /tests/0001-Add-test-logo.patch: -------------------------------------------------------------------------------- 1 | From 0217f4780557e67c55518161f28aa7848f7009c9 Mon Sep 17 00:00:00 2001 2 | From: Bastien Nocera 3 | Date: Tue, 28 Jun 2016 14:03:39 +0200 4 | Subject: [PATCH] Add test logo 5 | 6 | --- 7 | org.test.Hello.png | Bin 0 -> 7416 bytes 8 | 1 file changed, 0 insertions(+), 0 deletions(-) 9 | create mode 100644 org.test.Hello.png 10 | 11 | diff --git a/org.test.Hello.png b/org.test.Hello.png 12 | new file mode 100644 13 | index 0000000000000000000000000000000000000000..751ddbdb11c88d5e45da6940966cddc116d35983 14 | GIT binary patch 15 | literal 7416 16 | zcmVPx#32;bRa{vGvuK)lWuK`{fksJU300(qQO+^RT2Nn++58fp}#sB~S24YJ`L;(K) 18 | z{{a7>y{D4^033KpL_t(|0qj--m^C{RP10#y^d0;CHlMk+ZQHi(-A`-VHlD5DwlThQ 19 | z-ArdsWo>(FrkzSvopY+b%l>cwxBuJ!v{~#w$Hdd0{`C2MeSM`vhYoe{oU^}!arU2K 20 | z{`=nd{wKO#<>fOoHIFfM&CK-aFDzfa*tzwVTWRjCtLZDF1ec#uP({U6>(;Fkwr%s9Z@yXW-o5*mvV7=6AIjFQUCWhHY;0^yKlQ0kWq-`H*6bkDAFDs9krq;a*D;`XizRKm(mss 26 | z7R=vPtrj@Z6B{?&ay8<$FTM0q1yEb4HKIj^G&V~&eUiLdQSF2S) 32 | zHZ?V+mMvRm0QlesKWO#z^mwaQt#TWUX5pIawvI{BUg0|S-B+(!b4S!tQkfF2=efDc 33 | zI5}CC%qAu#cGm0lFIkRrspEQ6zF%;KCFJDzL_B%=)VhJek>}3Lwr*3c)+Gwnwk?_K 34 | z$a;T&ch+jPZi=Jk&Y;r&;#$3K(~L*q+;Lp)LHa0!LE0Li+2oDvqc`5$PAeFthcb2Vpra`FMTQ-12H 37 | z)6;>WmgSnl5sL@__xu-wjzBSUgUm1ZqF5-J-X}G}bdn^x-R`JHv(0cXEI4_dPyRU+ 38 | zq#KPEOEYD4cLf3jP);b4>G6r_6H^lh&fynccp*Rc+;bf`xXV|qabs+F_`tqACpV`&*&T0 41 | zq3|?6H9nzQ?KZJ5Ko+%%j^dcW;b9yLVr|@Wo%stFF1&l1#)VR;6cF3(Rtszt7y)49Cb-U&qTVt9 43 | zC|r{`F+H2BoYo93#I+bGuLCP@3Io4amGS7`lY=G0P(SaJ4gAnX(ahgTQ0RV)|%nJA$xN%o3%JI>zekChi 45 | zJ$G8Nc+ndwmCF2Ps~N+Q#;qO2iRkYiilr1BY`RpeQifHUy(~!;vqa8}+F^!uWd;&c 46 | z2$rSF#1dTcI8ptbkUs_AL4+-Xpd=JnHm;0oEi~2%?8iCzLR7j`@f@mQo7rx!SP>S}E0V 53 | zGz4TSBS~vgWSqnRQJTicbp}9kqYe;j+7XI0^U3oti#lO)_|W0qKmPF*ub&v-v*BxB 54 | zdxMtfe~*|${fvMIY20;OW_LT9CNTzwK{D4Vr{c3rnVz)`6E?G?O+(25K=PMTF&ppG 55 | zc53<#s~Hl&ch?L@uBmOfX(Nfk7?+qA8Q8H||3E+PQ{HHWS_p0YJ06pmAmp^tb%!v~wIJfosXWtwD6Mgf40Q33(xxTc@XGqDmyNGt~PT9d5dFBlCi 58 | zkcc((Ju-ff4v}U0kpMKxa!8^Xi=z~vXcSihgPFE08xppOeVR);j3bSGxNSRpcDBms 59 | zdv9+Kj(*;N>`#tYH2`2PfMOIgj(H3ph*b;^4b5A%a@ljYY}wkv?~{-Gln}G%b6mTE 60 | z_?0bt46++TkD2*x0^2ZiKEQmDY=g57^ESK*KZZ@1X|R8tp$3!WR$n{yFG~~7)BI$Z 61 | zmUZu`b52zqsXFG6N-C3ad24$suEs1Xp{cd#_oE9^BPI8LYrGTV_- 63 | z&@NfX1!$4yGCSiSwNTZ;Ma%_7I6j(_Qnv}~Y;C@xErn>$W<_uRVEmv=R;+zasy;0` 64 | zYSMDm*D$bIQ+@!pRM^N{Ek*)?&8JPS<$D!_`dZhjpA1UCjB3*?0vKEeQA(|7pQ<+l 65 | zr$OMmCp~?pbRp7iXWbGj^F@2nJ`gL6?@BvTf@%W>g5%LBtPh9Fez)y)OQ}##vS^Od 66 | z{bUKkY&Ok*{G%U#?V$(nE<$yrV*lqgYJRBK>)w#2Y_PD69Q6C%*zrpGSOc1dsPkr?tph(F$Vic|Hr)-1PLt!w4STlsy;r*NhY&mX0uj`)V}eJZ=cq1 71 | z_x+0(FMi>Pr=I-8JKp}LOV2<5e7FX{Ti)`Pypg7V9F0ahWsE~DzutnfwFLsPG$uiT 72 | z*KBXiXY;Uc9TXb_D7d3?gVByo_YAVVVSiNcZg=Py9V8z-+5(X8S-U*|v7xfnwXXm) 73 | zuj6ZdT|y$NBt$Bd{hGib^56aDx96UC^4U{Go_xBK 75 | zQjuy(JPH6J 77 | z84ANJbKj4r3RD}N6;apb+C-s^0v0CMedyM}yJ!6q0-^2lu7T9zT=Nf`jk1KW;vc^2 78 | zv~alhgG=4|JSWI#nJpubxy`DIU2)FN&V@hRdFL(rU;gq(WB4CO%1o`Z)aOGnHsdS( 79 | zjOk$)715OBiA}iw2`Ddee?J(Fl&KgF4(DjS0*{ieMHpmV^9ODYdDK1iTgxBpZ{Ao~ 80 | z3NThJDvFA*bVj$;!Wj*apMt~OAb0$Zs>%kLD=-;eZ^ar`pU3Gpmm!z$}&7rgXmLQnylg 82 | zVoL+c!n?sRM;v2Nq~E#TOJ;R6pOSVUpaa-|LH0RJz^U$SYrRsYx%OxMZ$YAM<_p>s 83 | z8KpHU1&eEG+S+)@r^3VGa3OM=j;B)%6zi{3OLQbnFzU4+>sg=S0*=%*6)1j8WpeAd 84 | z%)4Qr&4fUPO=ABbQ3L4!Oj?m_>+^I{U=XPk`-WJb$BeL$X1fBw)#Cu$mA$6VQ7iUX 85 | z@Zhm(FDFky$^QOGZt*k^X#XbwPdxEN(1Ve(owm-;%eX6VFgbsIr;tnRp$I%ou%0UO 86 | zsRE&AS;Qr3y=@XaW``c9)G-~XK;E^HEa{6@IZsl74W|iW$0!t}B%Muz+nO0R%OBdhmkhuo^w~tA&*0?fnm=y4L 89 | z{CZ*1T!z=Y_6^~&#~uwg-gsxY`KG(V_1E8_A7C+})nN)_L+I#4|24Lk#`NAH! 90 | zRzz;Fc}~E)l%+i!4(^{!$N6>FUH@0L^W?Pd`(FXz_}u3{A71;~$77-CYPhy`oo@W_ 91 | zAj@vi8VwdHD^0dcEn!?TR#<{if+8>N$YOM5IO8@pI#=1GU7BQ4@9nU$IZ!EYYE;g` 92 | z&wl=Myk_8e%Fs~2!=K0KHI3tY+5v&-@*hM$% 93 | z_a8nSjb>Y$o4m1-d$3YOZP?!k=VAzg&eeNQnFhq? 99 | zf}9J23Vi2k|HW!e9RWmWq#z*h`lTo+uRvC^9u9v9VP`XT9$-=D(qVT0WYkm_!esS8 100 | zt>mFrvuJH|LaSyvr_r8bG4fIZ;3Nb>=TJtuZ?#mx 102 | zAMi1J7;t$-&?_nY*sHkULG#FAF9}NL`NIY 103 | zai9fM2+%T*nnWkWAu}r#!C(M&`?piKOGIoP6uXaDFe+P$K#(Hs+<7Qoy#U7O5CTCF 104 | z6|sOfBm&{xka1!f`2TYXRjLhcwNmQ#`TWPktmxQ|9XrC`pMWmzx#u1V;ENXgvbg|2 105 | z9CwR4r?+!k+6`IP*^5pGRa)H^*6Zon=AcGKt&H_~>TNc4Lh_{C_=w%_`Ob=r;-evf 106 | z)5)U@T9w*YBNdBWCbu%)%Y@ZVhbtT(6-d!&)vCDozNHR(OEY1(H2ayRsOsuCZ*ESe 107 | zrm3lVw}*0ltX8{(>Crn;uBuz66?3Gvu_jj|Cq=S|1clSacNn8Wp3jQf6J#n?1S_F! 108 | ze3-ZKJh9fBJkE^1p@V^dzm5^4EgLp$5PtRRaJRf?Mg4{i$Z2c|G#^;>^2YiT`OE8C 109 | z)Wxa&RGW&;k^HH`=BBhn=|c?`zP7NSsZVox=`*Q4rO#U8hBwHy(Pg3b_BX{`^v+QC 110 | z4F8!{MqqvVJ3q8c1cV(SHW2y 111 | z+cPsYs(f$$rtCo(N5oF+(u~yjjTUVm_gT9nKVD*;U+U@=?G%)p5AxUgMAMJTg{0bm 112 | zwin&Gdf%RP%U-hX+rLvl7c71ORTRf1BNQD{rL;8lrI6PfeYvfcTaQ~D>$ 113 | zV`=b}mv3kUuwdHbn+t}{na#ZTz}p=$Swei@bmOVl@0>SL!jkcJuh+QL!=}eDyr|U_ 114 | zY>Cm!BBOhzIZ{&MvNIiR@xp|_^ju`_jg^|cA_R=YOS?Bv%S`H^|MpEi9y*z9dz$-=RPvgJX 123 | zXs+%D#|LHj(j~7PI;oP0`h0TtCDHr#*W~DRm@gJX=JBFHEW%NL5Sx5{cs#zq$k-_6 124 | zgJ4j+(qzI_S}m?r$Z@?=fyh7*)?g4v`~hrXS=8R~{OUQU%g>J4_|`e2va({nJ+IXO 125 | zya0H7zh6HEEcotvLTt5(ivrF*5Ujii3#@fZtEqI}${MnWLr;dI> 128 | zZ|rjpy2v|c+5@S>QnT?bRlAwvOd8R;=!^|NjW6>0yy~YuH!SB{77j!z4;S*WXr 131 | zS|Y(1J}gKHbv55|`%IA}3b$}DT@mKdV6)M+dXH~mq>Kgw0o1cBx^3HA>>WHa`{s;X 132 | zqk6-J&G`a_ASOuKviIegzi4kU}TvEs?UMwWhKV 133 | z-z6-0a8fb=C%z<#dw7fxa%&kDXZ2d-@?lB!-0`_QKRWmE<1HWewmH2{KaXo=a#_@6 134 | zvxkl2c^vTs@U}vZIbu0Gy>Duac+J*ATXwp#kx~Q*f#!w_&a4-Rbv 136 | zX6!gxq%Y-F_fOEVtK(ygPe`SBxLX{iRn_28yA{vNwTRPe{14sv>JrJ(9Xpn9S+Sxl 137 | zp*uO+ZpLA)21f%yG)g6~B=*FSuEkt`%oNbxGa26qeIER-uY=cKmyPd{Gj-CrGq27| 138 | zi!dnrWTg?`*)u5i1yQ$h*|AqQSDA;6%8W-K7$8ao?$Jdc*NY$uOBmS$9BZ>;p1w0T3!-&#p 146 | zFwE^igIEIcW+M;|L!;Fo$!tZDl7pQULF{nifX9d1LISSvdN7A$(E3NO0fM=F@nLkK 147 | zOt^9Q$kF|$MaViIR3-Qk=bS@meFMA##iZycJQ1Nm0w=}+iw$opRUi@;Bn)JUC5Ul4 148 | zu~Mss@!o6@5sO%n2-N4rQmqClAs&oMi9EFuZ+kt+5Q|XPyEozS8?gAb7^bh&=Eu>U 149 | zhs}QTt^$0I&6_Fu_Cr5D3@t;DzyOWmFdlKbu)*SjB|;9);R5;WQ@C^UU;{v%2XhPc^ae*yHiQS=)kXGsY1Q 152 | ze!$@Zs_PMpr3`}c_Z#t(S+T}rYB 153 | zLoby;?)1RxGQ%-xG70^GQ{azh0RRC$5d($a2?>70_16;$z=GcagTDz^JK`e^80&PQ 154 | zB~0-P`~woO&q5iw3>UK^aD?D!lpdKYR?vS>0#Jrtu`#&TV#7j*2aA