forked from vieter-v/vieter
Compare commits
2 Commits
8a0beffbe2
...
aa5ee55059
| Author | SHA1 | Date |
|---|---|---|
|
|
aa5ee55059 | |
|
|
33e695bdf3 |
|
|
@ -25,9 +25,7 @@ pipeline:
|
||||||
settings:
|
settings:
|
||||||
repo: chewingbever/vieter
|
repo: chewingbever/vieter
|
||||||
dockerfile: Dockerfile.ci
|
dockerfile: Dockerfile.ci
|
||||||
tag:
|
auto_tag: true
|
||||||
- latest
|
|
||||||
- ${CI_COMMIT_TAG}
|
|
||||||
platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ]
|
platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ]
|
||||||
build_args_from_env:
|
build_args_from_env:
|
||||||
- CI_COMMIT_SHA
|
- CI_COMMIT_SHA
|
||||||
|
|
@ -13,13 +13,10 @@ pipeline:
|
||||||
pull: true
|
pull: true
|
||||||
secrets: [ s3_username, s3_password ]
|
secrets: [ s3_username, s3_password ]
|
||||||
commands:
|
commands:
|
||||||
- git clone "$CI_REPO_REMOTE" .
|
|
||||||
- git checkout "$CI_COMMIT_BRANCH"
|
|
||||||
# Write the title to a file that the plugin can then read
|
|
||||||
- echo "$(git describe --tags --abbrev=0 2> /dev/null || echo '0.0.0')-$(git rev-list --count ^dev)" > title
|
|
||||||
- cat title
|
|
||||||
- mc alias set s3/ https://s3.rustybever.be "$S3_USERNAME" "$S3_PASSWORD"
|
- mc alias set s3/ https://s3.rustybever.be "$S3_USERNAME" "$S3_PASSWORD"
|
||||||
- mc cp -r "s3/vieter/commits/$CI_COMMIT_SHA" assets
|
- mc cp -r "s3/vieter/commits/$CI_COMMIT_SHA" assets
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
||||||
release:
|
release:
|
||||||
image: 'plugins/gitea-release'
|
image: 'plugins/gitea-release'
|
||||||
|
|
@ -32,7 +29,6 @@ pipeline:
|
||||||
- md5
|
- md5
|
||||||
- sha256
|
- sha256
|
||||||
prerelease: true
|
prerelease: true
|
||||||
# This should get read in as a file
|
title: ${CI_COMMIT_TAG}
|
||||||
title: title
|
|
||||||
when:
|
when:
|
||||||
event: push
|
event: tag
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
# Because the only step here is a pull_request event, the branch should be dev
|
|
||||||
# because it has to be the target of the pull request
|
|
||||||
branches: dev
|
|
||||||
platform: linux/amd64
|
|
||||||
depends_on: [ build ]
|
|
||||||
|
|
||||||
pipeline:
|
|
||||||
dryrun:
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
secrets: [ docker_username, docker_password ]
|
|
||||||
settings:
|
|
||||||
dockerfile: Dockerfile.ci
|
|
||||||
repo: chewingbever/vieter
|
|
||||||
tag: dev
|
|
||||||
platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ]
|
|
||||||
dry_run: true
|
|
||||||
build_args_from_env:
|
|
||||||
- CI_COMMIT_SHA
|
|
||||||
when:
|
|
||||||
event: pull_request
|
|
||||||
branch: dev
|
|
||||||
|
|
@ -63,6 +63,9 @@ fn C.archive_write_close(&C.archive)
|
||||||
// Free the write archive
|
// Free the write archive
|
||||||
fn C.archive_write_free(&C.archive)
|
fn C.archive_write_free(&C.archive)
|
||||||
|
|
||||||
|
// Returns the name of the filter
|
||||||
|
fn C.archive_filter_code(&C.archive, int) int
|
||||||
|
|
||||||
#include "archive_entry.h"
|
#include "archive_entry.h"
|
||||||
|
|
||||||
struct C.archive_entry {}
|
struct C.archive_entry {}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,10 @@ import util
|
||||||
// Represents a read archive
|
// Represents a read archive
|
||||||
struct Pkg {
|
struct Pkg {
|
||||||
pub:
|
pub:
|
||||||
path string [required]
|
path string [required]
|
||||||
info PkgInfo [required]
|
info PkgInfo [required]
|
||||||
files []string [required]
|
files []string [required]
|
||||||
|
compression int [required]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents the contents of a .PKGINFO file
|
// Represents the contents of a .PKGINFO file
|
||||||
|
|
@ -125,6 +126,11 @@ pub fn read_pkg(pkg_path string) ?Pkg {
|
||||||
C.archive_read_free(a)
|
C.archive_read_free(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 0: no compression (just a tarball)
|
||||||
|
// 1: gzip
|
||||||
|
// 14: zstd
|
||||||
|
compression_code := C.archive_filter_code(a, 0)
|
||||||
|
|
||||||
mut files := []string{}
|
mut files := []string{}
|
||||||
mut pkg_info := PkgInfo{}
|
mut pkg_info := PkgInfo{}
|
||||||
|
|
||||||
|
|
@ -164,6 +170,7 @@ pub fn read_pkg(pkg_path string) ?Pkg {
|
||||||
path: pkg_path
|
path: pkg_path
|
||||||
info: pkg_info
|
info: pkg_info
|
||||||
files: files
|
files: files
|
||||||
|
compression: compression_code
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -175,7 +182,14 @@ fn format_entry(key string, value string) string {
|
||||||
pub fn (pkg &Pkg) filename() string {
|
pub fn (pkg &Pkg) filename() string {
|
||||||
p := pkg.info
|
p := pkg.info
|
||||||
|
|
||||||
return '$p.name-$p.version-${p.arch}.pkg.tar.zst'
|
ext := match pkg.compression {
|
||||||
|
0 { '.tar' }
|
||||||
|
1 { '.tar.gz' }
|
||||||
|
14 { '.tar.zst' }
|
||||||
|
else { panic("Another compression code shouldn't be possible. Faulty code: $pkg.compression") }
|
||||||
|
}
|
||||||
|
|
||||||
|
return '$p.name-$p.version-${p.arch}.pkg$ext'
|
||||||
}
|
}
|
||||||
|
|
||||||
// to_desc returns a desc file valid string representation
|
// to_desc returns a desc file valid string representation
|
||||||
|
|
|
||||||
4
test.py
4
test.py
|
|
@ -38,7 +38,7 @@ def create_random_pkginfo(words, name_min_len, name_max_len):
|
||||||
Generates a random .PKGINFO
|
Generates a random .PKGINFO
|
||||||
"""
|
"""
|
||||||
name = "-".join(random_words(words, name_min_len, name_max_len))
|
name = "-".join(random_words(words, name_min_len, name_max_len))
|
||||||
ver = "0.1.0" # doesn't matter what it is anyways
|
ver = "0.1.0-1" # doesn't matter what it is anyways
|
||||||
|
|
||||||
# TODO add random dependencies (all types)
|
# TODO add random dependencies (all types)
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ def create_random_package(tmpdir, words, pkg_name_min_len, pkg_name_max_len, min
|
||||||
|
|
||||||
return tar_info
|
return tar_info
|
||||||
|
|
||||||
with tarfile.open(tar_path, "w") as tar:
|
with tarfile.open(tar_path, "w:gz") as tar:
|
||||||
# Add random .PKGINFO file
|
# Add random .PKGINFO file
|
||||||
pkginfo_file = sub_path / ".PKGINFO"
|
pkginfo_file = sub_path / ".PKGINFO"
|
||||||
pkginfo_file.write_text(create_random_pkginfo(words, pkg_name_min_len, pkg_name_max_len))
|
pkginfo_file.write_text(create_random_pkginfo(words, pkg_name_min_len, pkg_name_max_len))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue