Code Monkey home page Code Monkey logo

mkdeb's People

Contributors

cbednarski avatar evanphx avatar jen20 avatar thomasf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jen20 thomasf

mkdeb's Issues

Various problems with the .Files map

1. Directories are not included in the archive

I was just using the Files map to add in extra files..

...Files = map[string]string{
  "somefile":"/usr/share/doc/someproject/somefile",
}

This fails because the directory /usr/share/doc/someproject/ isn't explicitly
added to the archive.

2. Directories are not supported in the Files map

Files should probably also support directories which would be added recursively.

3. It's not possible to add a source file multiple times

The mapping in the Files map should be inverted to support copying one source
file to multiple destination files. The current Files map map[src]dst makes
it impossible to reuse src multiple times.

I had an actual use case for this today when I tried to put a default
configuration file both in /etc and in the documentation folder.

good solution ⊂(◉‿◉)つ

A backwards compatible solution is keep the Files struct field (map[src]dst)
and add a new field Include which probably is some functionality to properly
handle sources and destinations. It opens up for .Exclude or .Filters
fields. I will work on a suggestion.

worse solution ◔_◔

A worse solution is to change Files from map[src]dst to map[src][]dst which
breaks the current API so that any current users have to change.

worst! solution ಠ_ಠ

The worst solution is to just silently change map[src]dst to map[dst]src
which will cause errors without breaking compilation.

concurrent package builds in same directory fails

  • the TempPath option isn't being used
  • no temporary directory is used at all

I haven't looked at the details of the deb file creation so I might have missed
something but it seems like the whole process just use io.writer's writing
directly to the .deb-archive instead of writing it out to multiple files first?

new suggestion: create intermediate files concurrently in goroutines

Bad permissions on control files

lintian shoes that packages built using mkdeb have incorrect UNIX permissions on the control file:

$ lintian quickmkdeb-1.0-amd64.deb
.... some output snipped...
E: quickmkdeb: control-file-has-bad-permissions conffiles 0600 != 0644
E: quickmkdeb: control-file-has-bad-permissions md5sums 0600 != 0644

Vendor dependencies

It's a good idea to vendor all dependencies locally for building the executable to ensure reproducible builds and not fail if something external changes.

Data archive does not include intermediate directory headers

Currently it is only possible to install a .deb generated by mkdeb if the filesystem image only includes directories which already exist, as intermediate directory headers are not included in the data archive (likely because of the ListFiles() method).

A reproducible example:

cat > mkdeb.json <<EOF
{
  "package": "quickmkdeb",
  "architecture": "amd64",
  "maintainer": "Your Name \[email protected]\u003e",
  "description": "quickmkdeb is an awsome project for...",
  "depends": [],
  "section": "default",
  "priority": "extra",
  "homepage": "https://www.example.com/project",
  "preinst": "",
  "postinst": "",
  "prerm": "",
  "postrm": "",
  "autoPath": "deb-pkg"
}
EOF
mkdir -p deb-pkg/usr/bin/
touch deb-pkg/usr/bin/testscript.sh
mkdir -p deb-pkg/zzz/i/dont/exist
touch deb-pkg/zzz/i/dont/exist/test.txt
mkdeb build -version=1.0 mkdeb.json

This results in a package which when installed on Ubuntu 16.04 gives the following results:

sudo dpkg -i quickmkdeb-1.0-amd64.deb
Selecting previously unselected package quickmkdeb.
(Reading database ... 59450 files and directories currently installed.)
Preparing to unpack quickmkdeb-1.0-amd64.deb ...
Unpacking quickmkdeb (1.0) ...
dpkg: error processing archive quickmkdeb-1.0-amd64.deb (--install):
 unable to create '/zzz/i/dont/exist/test.txt.dpkg-new' (while processing 'zzz/i/dont/exist/test.txt'): No such file or directory
Errors were encountered while processing:
 quickmkdeb-1.0-amd64.deb

Lintian shows the following relevant lint errors (among some others representing different bugs for which I will open separate issues):

W: quickmkdeb: missing-intermediate-directory usr/
W: quickmkdeb: missing-intermediate-directory usr/bin/
W: quickmkdeb: script-with-language-extension usr/bin/quickmkdeb.sh
E: quickmkdeb: non-standard-toplevel-dir zzz/
W: quickmkdeb: missing-intermediate-directory zzz/
W: quickmkdeb: missing-intermediate-directory ... use --no-tag-display-limit to see all (or pipe to a file/program)

The solution is to include directory header information for each intermediate directory irrespective of whether it already exists, but this requires some rearchitecture to avoid building the data archive from a slice of strings and towards building it directly in the filepath walk.

InstalledSize is not calculated

$ dpkg --contents testpackage-0.0.1-amd64.deb 
-rwxrwxr-x root/root   4028490 2017-06-11 14:39 usr/bin/drone-deb

$ dpkg --info testpackage-0.0.1-amd64.deb 
 new debian package, version 2.0.
 size 1435764 bytes: control archive=366 bytes.
       1 bytes,     0 lines      conffiles            
     181 bytes,     9 lines      control              
      52 bytes,     1 lines      md5sums              
 Package: testpackage
 Version: 0.0.1
 Architecture: amd64
 Maintainer: Foo Bar<[email protected]>
 Installed-Size: 0
 Section: default
 Priority: extra
 Homepage: 
 Description: Test package

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.