Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for apk #39

Closed
tcurdt opened this issue Oct 25, 2018 · 25 comments
Closed

Add support for apk #39

tcurdt opened this issue Oct 25, 2018 · 25 comments
Labels
enhancement New feature or request hacktoberfest

Comments

@tcurdt
Copy link

tcurdt commented Oct 25, 2018

Would be nice to have support for alpine linux packages as well.

http://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package
https://wiki.alpinelinux.org/wiki/Alpine_package_format

@caarlos0 caarlos0 added enhancement New feature or request hacktoberfest labels Oct 25, 2018
@tcurdt
Copy link
Author

tcurdt commented Oct 26, 2018

The new apk package are 2 combined tar.gz packages, control.tar.gz and data.tar.gz. The final .apk package is created by concatenating control.tar.gz and data.tar.gz

This means that

cat $controldir/control.tar.gz $controldir/data.tar.gz > mypackage-1.0-r0.apk

will create an apk

@tcurdt
Copy link
Author

tcurdt commented Oct 26, 2018

control.tar.gz:

tar -c .PKGNIFO .pre-install | abuild-tar --cut | gzip -9 > $controldir/control.tar.gz

data.tar.gz

cd $pkgdir
tar -c * | abuild-tar --hash | gzip -9 > $controldir/data.tar.gz

@caarlos0
Copy link
Member

interested in try to implement a PR for this?

@tcurdt
Copy link
Author

tcurdt commented Oct 26, 2018

I am still investigating using docker and the native tools - but consider me tempted :)
I just don't get why all those native packaging tools are so incredibly bad.

@hellozee
Copy link

hellozee commented Nov 6, 2018

cat $controldir/control.tar.gz $controldir/data.tar.gz > mypackage-1.0-r0.apk

If that's the only thing to be done, I could give it a shot

@tcurdt
Copy link
Author

tcurdt commented Nov 6, 2018

I am currently working on it and in the end (as always) it is a little bit more involved.
But the prototype is almost there. An unsigned apk already installed successfully.
Currently working on the signing.

@tcurdt
Copy link
Author

tcurdt commented Nov 6, 2018

@hellozee maybe take a stab at native rpm support instead? #40

@hellozee
Copy link

hellozee commented Nov 6, 2018

@tcurdt cool, but well rpm is something, I have never taken a look into, I just used alien to convert debs to rpm if I needed any

@tcurdt
Copy link
Author

tcurdt commented Nov 6, 2018

Got the apk signing working as well 🎉🎉🎉
Some of the hashing is still a bit odd (as the host system does not seem to care if it's there or not) - but the package now installs even in a trusted manner.

@caarlos0
Copy link
Member

caarlos0 commented Nov 6, 2018

awesome!

@tcurdt
Copy link
Author

tcurdt commented Nov 28, 2018

Still need to find the time to wrap this up in a PR.

@chris-rock
Copy link
Contributor

@tcurdt that would be an awesome addition. Any progress?

@tcurdt
Copy link
Author

tcurdt commented May 8, 2019

@chris-rock I got it working. It's just sitting on my machine waiting until I find the time to turn it into a proper PR. Distracted by other projects - but I'll try to make some time.

@tcurdt
Copy link
Author

tcurdt commented May 20, 2019

Just a quick status update: I've started to massage the code base and tests to accept the new apk packager. Now I need to migrate the code into the packager.

@chris-rock
Copy link
Contributor

@tcurdt I would love to try your implementation. Let me know when its ready for a beta test 🤣

@tcurdt
Copy link
Author

tcurdt commented Jul 8, 2019

@chris-rock TBH I am not sure when I will find the time to finish this :-/
If you want I could link a gist with the experimental code - if that helps?

@chris-rock
Copy link
Contributor

I would appreciate if you could make your current state available. Then the community can collaborate to implement the feature.

@tcurdt
Copy link
Author

tcurdt commented Jul 8, 2019

Sure thing. Sorry, I didn't get around to finish it. The cut/full tgz stuff is a bit unconventional but works.

https://gist.github.com/tcurdt/512beaac7e9c12dcf5b6b7603b09d0d8

Gist
GitHub Gist: instantly share code, notes, and snippets.

@yindia
Copy link

yindia commented Mar 19, 2020

@tcurdt any progress on this ?

@caarlos0
Copy link
Member

nope...

@tcurdt
Copy link
Author

tcurdt commented Mar 19, 2020

@evalsocket As said - I didn't have the time to finish it up for a merge. But it was working and all the parts are linked above.

bhamail added a commit to bhamail/nfpm that referenced this issue Mar 27, 2020
@bhamail
Copy link
Contributor

bhamail commented Apr 7, 2020

Just to raise awareness, I'm trying to implement this here: #126

caarlos0 added a commit that referenced this issue Aug 17, 2020
* first attempt at apk, built from Issue #39

* inspector cleanups

* read the contrib note, ran linter, fixes made. Noice!

* linter went wonky

* linter went wonky

* fix some lint issues

* fix some lint issues

* lightweight file validation, while I try to refactor method into smaller chunks

* refactorings to get `make ci` to pass. ain't pretty, but hopefully doesn't make things worse.

* add ignore file to get workdir created in CI

* try to get a successful test run on CI (file sizes differ on CI).

* must remember to run liner (make ci) before pushing

* Doh! Detect CI via correct env var name

* tweak CI expected file sizes

* blech. try to get a range of values for CI

* better message if value fails conditions

* better message if value fails conditions

* initial impl of Package interface - just hoping I don't already have the arch mapping backwards.

* missed non-altered arch case

* ci failures

* refactor io.File to Writer

* add note about command to test apk install in docker

* remove absolute paths from test (prep for replacement with info.Files).

* rename test files folder

* get ci file size ranges happy after path changes

* get ci file size ranges happy after path changes

* move COPY towards end, allowing more caching of layers - feedback from @tcurdt

* remove Gz from function name

* rename combine function

* add skipVerify flag to preserve generated .apk file for use in dockerfile manual test. Thanks @tcurdt

* make ci is my friend

* remove useless comment

* start conversion to nfpm.Info

* use base64 encoded string for private signing key

* remove old runit() method, as we can now test using Default.Package.
add some tests lifted from deb_test.go.

* duck and cover: register the apk packager

* use the metadata from nfpm (does not handle scripts/pre/post, etc)

* getting closer to removing size assertions, but not just yet

* getting closer to removing size assertions, but not just yet

* add niffty import for init - Blank identifier comes to the rescue. Thanks @tcurdt.
add apk to overrides parse test.

* I will very much enjoy deleting this assertion...soon, soon.

* add PrivateKeyFile option, which is subordinate to PrivateKey

* move PrivateKey configs to root config struct. expand PrivateKey configs from env vars if set.

* provide the user a hint if privatekey config is missing for .apk packager

* lovin' the linter now. learning language from linter loudness. didn't know switch could work like that.

* add support for 'scripts' in control file

* fix control metadata

* make signing keyname configurable

* goofy size fix

* remove temporary test and related files

* fix template copy/pasta error

* remove old print statements

* first take at integration tests. should remove need for --allow-untrusted in `apk add` command.

* fix: merge issues, remove signature support

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: tests

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: lint issues

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: tests

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* test: meta

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: datahash seems unused

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: improve test code

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: unused params

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: tests

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* test: changelog test

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* test: fix

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: img

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* test: symlink

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: uneeded deletes

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: symlinks

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

Co-authored-by: Dan Rollo <danrollo@gmail.com>
@tcurdt
Copy link
Author

tcurdt commented Aug 17, 2020

@caarlos0 Thanks for the merge! Should we keep this issue open for the signing part? Or maybe open a new one?

@caarlos0
Copy link
Member

I think signing will need work across all packages, so I'll open a new one.

Thanks!

@caarlos0
Copy link
Member

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@goreleaser goreleaser locked as resolved and limited conversation to collaborators Nov 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request hacktoberfest
Projects
None yet
Development

No branches or pull requests

6 participants