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

generate checksums for all Components files [$15] #384

Open
btkostner opened this issue Apr 18, 2016 · 6 comments · May be fixed by #1186
Open

generate checksums for all Components files [$15] #384

btkostner opened this issue Apr 18, 2016 · 6 comments · May be fixed by #1186
Labels

Comments

@btkostner
Copy link
Contributor

It would be amazing if aptly would generate AppStream data when it publishes a repository. This would allow packages in the published repo to be seen by new-age app centers, including gnome software.

Here is a generator written in D for reference.

@smira smira added the feature label Apr 18, 2016
@ximion
Copy link

ximion commented May 12, 2016

As long as Aptly reads the dep11/ directory and puts the correct checksums for Components-* into the InRelease file, asgen and Aptly should work well together.
I would advise against writing an own metadata generator, since that is a huge pain, and keeping it up-to-date is an issue. But making asgen easier to use from other tools would be possible (at time, it is mainly built for large distro repositories and to be a standalone tool).

@btkostner
Copy link
Contributor Author

btkostner commented May 31, 2016

I'm changing this issue's scope to copy files and generate checksums for all Components files. This will be the easiest solution to this issues, and some other issues related to metadata generation.

Currently:

  • asgen will output a directory similar to data/xenial/main/Components-amd64.yml.gz

Expected behavior:

  • On publish aptly copies folder so we have a directory similar to public/stable/dists/xenial/main/Components-amd64.yml.gz
  • Aptly includes checksums for all Components files in /aptly/public/stable/dists/xenial/main

@btkostner btkostner changed the title Generate AppStream data when publishing [enhancement] generate checksums for all Components files May 31, 2016
@btkostner btkostner changed the title generate checksums for all Components files generate checksums for all Components files [$15] May 31, 2016
@btkostner
Copy link
Contributor Author

I also put a $15 bounty on this for anyone who want's to add it:
https://www.bountysource.com/issues/33086807-generate-checksums-for-all-components-files

@ximion
Copy link

ximion commented May 31, 2016

Just something to add before it gets forgotten: The same thing needs to be done with the icons-* tarballs in the same dep11 subdirectory.
Also, the checksums for the uncompressed files need to be in InRelease, but the actual uncompressed files need not (and probably should not) be present.

@danirabbit
Copy link

Bumped the bounty to a total of $50 :)

@hsitter
Copy link
Member

hsitter commented Jun 8, 2016

I have been looking into this, alas, it is a bit tricky. I'd absolutely love some input on this @smira

We need a bunch of information which could be different per source/publishedrepo/usecase.
Namely the following appstream-generator attributes:

  • UseIconTheme (overrides icon to use)
  • MediaBaseURL (fully qualified URI to a media directory)
  • HTMLBaseURL (URL to a html directory, if I am not mistaken this can actually be relative)
  • DataPriority (allows overriding of other appstream data)
    The other attributes we can pretty much fill with information we already have in aptly anyway.

With that in mind I am currently thinking about the following changes to make this happen:

api/publish.go for both initial publishing and updating gets a new attribute AppStream: {} with the aforementioned attributes for appstream-generator.
Final payload should be something like

{
  "Prefix": "floof",
  "SourceKind": "local",
  "Sources": [{"Name": "local-repo"}],
  "AppStream": {
    "MediaBaseURL": "http://floof.com/media",
    "HTMLBaseURL": "http://floof.com/html",
    "IconTheme": "breeze",
    "DataPriority": 1
  }
}

We probably ought to mangle this information internally a bit more. MediaBaseURL for example should probably be expanded to be "prefix-unique" by appending the actual publishing prefix, so what we give to asgen would be $MediaBaseURL/$Prefix -> http://floof.com/media/floof.

deb/index_files.go gets a new Dep11Asset type, this type is used for all files we want to dump in dist/$component/dep11/ (namely icons-* and Components-*). Ideally this should be only an addition. Which is a bit meh because index_files does assume the bufio.Writer gets decompressed data, while appstream gives us compressed data.

To that end utils/compress.go should probably get a new helper to decompress a file and load it into memory. This should work for starters but will ramp up memory consumption with appstream's icons.tar, so long-term refactoring of index_files to not assume uncompressed data would probably be good.

deb/publish.go probably gets a new argument for the AppStream options we got via the API, it gets a new loopedy loop which does:

  • construct a Config for asgen using available information
  • adds options obtained via API
  • writes that into a path under $AptlyRoot/asgen/$Prefix
  • runs asgen
  • foreach export/data/$Dist/$Component/*
    • decompresses file into memory
    • constructs Dep11Asset
    • writes decompressed data into bufio of the asset
    • (the assets get finalized alongside the rest of the index_files stuff) at which point they get compressed again

This should give us a largely working lineup for local repositories. How to deal with remote publishing endpoints I am not really sure to be honest.

All of this also assumes that some other piece of software grabs $AptlyRoot/asgen/$Prefix/export/media (i.e. the screenshots) to publish them under the URL we were provided.

We will probably also need some global .aptly.conf option to configure an appstream-generator run string so that one can "intercept" and redirect the appstream-generator run (e.g. to run in a container, or on a different host). Running appstream-generator on the same system as aptly is a bit meh from a security POV.

@btkostner btkostner mentioned this issue Jan 12, 2017
2 tasks
@lbolla lbolla closed this as completed Jan 28, 2022
@lbolla lbolla reopened this Jan 28, 2022
@reglim reglim linked a pull request May 31, 2023 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants