Skip to content

Commit

Permalink
Merge branch '1.0.x' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Nov 16, 2018
2 parents 9ebc613 + 692efa1 commit ff6a4a3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Matrix](https://img.shields.io/badge/chat-matrix.org-blue.svg)](https://riot.im/app/#/room/#reprozip:matrix.org)
[![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/remram44)
[![status](https://img.shields.io/badge/JOSS-10.21105%2Fjoss.00107-green.svg)](http://joss.theoj.org/papers/b578b171263c73f64dfb9d040ca80fe0)
[![DOI](https://img.shields.io/badge/DOI/10.5281%2Fzenodo.1247557-green.svg)](https://doi.org/10.5281/zenodo.1247557)
[![DOI](https://img.shields.io/badge/DOI/10.5281%2Fzenodo.1324502-green.svg)](https://doi.org/10.5281/zenodo.1324502)

ReproZip
========
Expand Down
2 changes: 1 addition & 1 deletion reprounzip-docker/reprounzip/unpackers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def docker_reset(args):
write_dict(target, unpacked_info)


_addr_re = re.compile(r'^(?:[a-z]+://)?([[0-9a-zA-Z_.-]+)(?::[0-9]+)?$')
_addr_re = re.compile(r'^(?:[a-z]+://)?([0-9a-zA-Z_.-]+)(?::[0-9]+)?$')


def get_local_addr():
Expand Down
53 changes: 32 additions & 21 deletions reprozip/reprozip/tracer/linux_pkgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from __future__ import division, print_function, unicode_literals

import distro
import itertools
import logging
from rpaths import Path
import subprocess
Expand Down Expand Up @@ -106,6 +107,10 @@ def _create_package(self, pkgname):
raise NotImplementedError


# Before Linux 2.6.23, maximum argv is 128kB
MAX_ARGV = 800


class DpkgManager(PkgManager):
"""Package identifier for deb-based systems (Debian, Ubuntu).
"""
Expand All @@ -114,30 +119,37 @@ def search_for_files(self, files):
requested = dict((f.path, f) for f in self.filter_files(files))
found = {} # {path: pkgname}

# Process /var/lib/dpkg/info/*.list
for listfile in Path('/var/lib/dpkg/info').listdir():
pkgname = listfile.unicodename[:-5]
# Removes :arch
pkgname = pkgname.split(':', 1)[0]

if not listfile.unicodename.endswith('.list'):
continue
with listfile.open('rb') as fp:
# Read paths from the file
line = fp.readline()
while line:
if line[-1:] == b'\n':
line = line[:-1]
path = Path(line)
# If it's one of the requested paths
if path in requested:
# Request a few files at a time so we don't hit the command-line size
# limit
iter_batch = iter(requested)
while True:
batch = list(itertools.islice(iter_batch, MAX_ARGV))
if not batch:
break

proc = subprocess.Popen(['dpkg-query', '-S'] +
[path.path for path in batch],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = proc.communicate()
for l in out.splitlines():
pkgname, path = l.split(b': ', 1)
path = Path(path.strip())
# 8-bit safe encoding, because this might be a localized error
# message (that we don't care about)
pkgname = pkgname.decode('iso-8859-1')
if ', ' in pkgname: # Multiple packages
found[path] = None
continue
pkgname = pkgname.split(':', 1)[0] # Remove :arch
if path in requested:
if ' ' not in pkgname:
# If we had assigned it to a package already, undo
if path in found:
found[path] = None
# Else assign to the package
else:
found[path] = pkgname
line = fp.readline()

# Remaining files are not from packages
self.unknown_files.update(
Expand All @@ -163,9 +175,8 @@ def search_for_files(self, files):
len(self.unknown_files))

def _get_packages_for_file(self, filename):
# This method is no longer used for dpkg: instead of querying each file
# using `dpkg -S`, we read all the list files once ourselves since it
# is faster
# This method is not used for dpkg: instead, we query multiple files at
# once since it is faster
assert False

def _create_package(self, pkgname):
Expand Down
2 changes: 2 additions & 0 deletions scripts/RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Create a release on GitHub, add the CHANGELOG to it, link to the attached files
Attach tarballs and wheels
Attach installers

Set correct metadata on Zenodo, update badge in README

Update conda-forge feedstocks

Build Windows installer using native Python installer & InnoDB
Expand Down

0 comments on commit ff6a4a3

Please sign in to comment.