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

Aptly cannot use deb packages which have control.tar #632

Closed
rlguarino opened this issue Sep 12, 2017 · 1 comment
Closed

Aptly cannot use deb packages which have control.tar #632

rlguarino opened this issue Sep 12, 2017 · 1 comment
Labels

Comments

@rlguarino
Copy link

rlguarino commented Sep 12, 2017

Detailed Description

Aptly cannot handle packages which have control.tar control files instead of control.tar.gz.

Context

Most gzip implementations are non-deterministic. Since control.tar is supported buy dpkg it should also be supported by aptly.

Possible Implementation

diff --git a/deb/deb.go b/deb/deb.go
index 26db3a1..f5f0c40 100644
--- a/deb/deb.go
+++ b/deb/deb.go
@@ -44,12 +44,16 @@ func GetControlFileFromDeb(packageFile string) (Stanza, error) {
                        return nil, fmt.Errorf("unable to read .deb archive %s: %s", packageFile, err)
                }
 
-               if header.Name == "control.tar.gz" {
-                       ungzip, err := gzip.NewReader(library)
-                       if err != nil {
-                               return nil, fmt.Errorf("unable to ungzip control file from %s. Error: %s", packageFile, err)
+               if strings.HasPrefix(header.Name, "control.tar") {
+                       if strings.HasSuffix(header.Name, ".gz") {
+                               ungzip, err := gzip.NewReader(library)
+                               if err != nil {
+                                       return nil, fmt.Errorf("unable to ungzip control file from %s. Error: %s", packageFile, err)
+                               }
+                               defer ungzip.Close()
+                       } else {
+                               ungzip := library
                        }
-                       defer ungzip.Close()
 
                        untar := tar.NewReader(ungzip)
                        for {
rlguarino added a commit to rlguarino/aptly that referenced this issue Sep 12, 2017
Add support for control archives with no compression.

Resolves aptly-dev#632
rlguarino added a commit to rlguarino/aptly that referenced this issue Sep 12, 2017
Add support for control archives with no compression.

Resolves aptly-dev#632
@smira
Copy link
Contributor

smira commented Nov 8, 2017

Should be fixed with #658 (already in nightly builds)

@smira smira closed this as completed Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants