~martijnbraam/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH createaport v2] Implement buildsystem == 'cargo'

Details
Message ID
<20230305205954.28141-1-hugo@whynothugo.nl>
DKIM signature
missing
Download raw message
Patch: +14 -0
---
Sorry, previously committed the wrong lines.
 createaport/aport.py       | 7 +++++++
 createaport/buildsystem.py | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/createaport/aport.py b/createaport/aport.py
index c69e4be..407561a 100644
--- a/createaport/aport.py
+++ b/createaport/aport.py
@@ -67,6 +67,9 @@ class Aport:
            apkbuild += '\tautomake --add-missing\n'
            apkbuild += '\t./configure\n'
            apkbuild += '\tmake\n'
        elif self.buildsystem == 'cargo':
            apkbuild += "\tdefault_prepare\n\n"
            apkbuild += "\tcargo build --release --frozen\n"
        else:
            apkbuild += '\t# Cannot autogenerate "' + str(self.buildsystem) + '" buildsystem yet\n'
        apkbuild += '}\n\n'
@@ -81,6 +84,8 @@ class Aport:
            apkbuild += '\tCTEST_OUTPUT_ON_FAILURE=TRUE ctest\n'
        elif self.buildsystem == 'setup.py':
            apkbuild += "\tpython3 setup.py test\n"
        elif self.buildsystem == 'cargo':
            apkbuild += '\tcargo test --frozen\n'
        else:
            apkbuild += '\t# Cannot autogenerate "' + str(self.buildsystem) + '" buildsystem yet\n'
        apkbuild += '}\n\n'
@@ -96,6 +101,8 @@ class Aport:
            apkbuild += "\tpython3 setup.py install --prefix=/usr --root=\"$pkgdir\"\n"
        elif self.buildsystem == 'automake':
            apkbuild += '\tmake -j1 DESTDIR="$pkgdir" install\n'
        elif self.buildsystem == 'cargo':
            apkbuild += '\tinstall -Dm 0755 target/release/$pkgname "$pkgdir/usr/bin/$pkgname"\n'
        else:
            apkbuild += '\t# Cannot autogenerate "' + str(self.buildsystem) + '" buildsystem yet\n'
        apkbuild += '}\n\n'
diff --git a/createaport/buildsystem.py b/createaport/buildsystem.py
index df4af5a..3aa87a4 100644
--- a/createaport/buildsystem.py
+++ b/createaport/buildsystem.py
@@ -49,6 +49,9 @@ def guess_build_system(aport):
        elif str(path) == 'setup.py':
            aport.buildsystem = 'setup.py'
            aport = guess_python_depends(aport, tarball)
        elif str(path) == 'Cargo.toml':
            aport.buildsystem = 'cargo'
            aport = guess_cargo_depends(aport, tarball)

    if aport.subdir is not None:
        if aport.builddir is None:
@@ -96,6 +99,10 @@ def guess_python_depends(aport, tarball):

    return aport

def guess_cargo_depends(aport, tarball):
    aport.makedepends.append('cargo')

    return aport

if __name__ == '__main__':
    from createaport.aport import Aport
-- 
2.39.2
Reply to thread Export thread (mbox)