cybozu-go / aptutil

Go utilities for Debian APT repositories
MIT License
124 stars 29 forks source link

Exporting more functions to allow more code re-use? #19

Closed ringods closed 6 years ago

ringods commented 7 years ago

For Concourse, I'm currently implementing a new apt-package resource type that can easily monitor the availability of new versions of a certain package. Neither the existing aptly-cli nor the debian-sources resource type fulfils my needs.

This repository contains 90% of the functionality to support me in implementing this, weren't it for the fact that a number of functions in the mirror package are not exported. E.g. I would like to use functions downloadRelease and downloadIndices, possibly some more.

I'm not in favor of duplicating code or maintaining my own fork. Are you open to a PR that contains the changes I need to get my Concourse resource implemented?

ymmt2005 commented 7 years ago

Yes I am open to your PR. However, we are going to refactor mirror majorly in #18. Please wait a while before submitting your PR until #18 is merged. Thank you!

ringods commented 7 years ago

Great! I'll keep an eye on #18 and refresh my fork with it before submitting my PR. Tnx for the support already.

ymmt2005 commented 7 years ago

@ringods

18 was merged. We are looking forward to your PR!

ringods commented 7 years ago

OK, refreshed my fork. Tnx for the heads up.

ringods commented 7 years ago

@ymmt2005 @nojima is there any chat system you hangout on? I could use someone to discuss things with.

First question: how should I unwind the current call-chain:

mirror.Run
  \- updateMirrors
       \- environment.Go
             \- m.Update
                   \- updates metadata + downloads packages here.

I currently refactored m.Update and extracted the first part to function UpdateMetadata. I guess I need the same setup of wrappers, environment, contexts, but I only want to have m.UpdateMetadata called deep down. What is the Go way of achieving this?

ymmt2005 commented 7 years ago

I'm afraid chat is not suitable for us because we live in Japan and its already night as well as we cannot type English promptly 😆 So please continue discussion here.

As for your question, could you create a work-in-progress pull request for m.UpdateMetadata and a gist or code snippet to describe how you use it?

ringods commented 7 years ago

@ymmt2005 my changes can be found here:

https://github.com/ringods/aptutil/tree/apt-resource

I'm currently using go-apt-mirror as the test application, aiming for the Run method only to run UpdateMetadata rather than the full Update

ymmt2005 commented 7 years ago

Thank you. will take a look.

ymmt2005 commented 6 years ago

Closing.