Univention Bugzilla – Attachment 7553 Details for
Bug 40932
dists/ucs$REL/main/[debian-installer/]binary-$ARCH/Packages* contain duplicate packages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch 4.0-4 and 4.1-1 [v2]
40932_mirror.diff (text/plain), 4.83 KB, created by
Philipp Hahn
on 2016-03-23 01:17:02 CET
(
hide
)
Description:
Patch 4.0-4 and 4.1-1 [v2]
Filename:
MIME Type:
Creator:
Philipp Hahn
Created:
2016-03-23 01:17:02 CET
Size:
4.83 KB
patch
obsolete
>diff --git a/branches/ucs-4.0/ucs-4.0-4/base/univention-updater/modules/univention/updater/mirror.py b/branches/ucs-4.0/ucs-4.0-4/base/univention-updater/modules/univention/updater/mirror.py >index 2d0da13..579d07c 100644 >--- a/branches/ucs-4.0/ucs-4.0-4/base/univention-updater/modules/univention/updater/mirror.py >+++ b/branches/ucs-4.0/ucs-4.0-4/base/univention-updater/modules/univention/updater/mirror.py >@@ -39,6 +39,7 @@ import itertools > import logging > from operator import itemgetter > from debian.deb822 import Packages >+from apt import apt_pkg > > from tools import UniventionUpdater, UCS_Version, NullHandler > try: >@@ -239,8 +240,8 @@ class UniventionMirror( UniventionUpdater ): > self.log.debug('Generating %s and %s ...', main_name, inst_name) > makedirs(os.path.dirname(main_name)) > makedirs(os.path.dirname(inst_name)) >- main = open(main_name, 'w') >- inst = open(inst_name, 'w') >+ main = open(main_name + '.tmp', 'w') >+ inst = open(inst_name + '.tmp', 'w') > try: > for dir2, src_name in prev: > self.log.debug('Appending %s ...', src_name) >@@ -274,11 +275,35 @@ class UniventionMirror( UniventionUpdater ): > > def _compress(self, filename): > self.log.debug('Compressing %s ...', filename) >- subprocess.call( >+ sorter = subprocess.Popen( >+ ('apt-sortpkgs', filename + '.tmp'), >+ stdout=subprocess.PIPE, >+ ) >+ tee = subprocess.Popen( >+ ('tee', filename), >+ stdin=subprocess.PIPE, >+ stdout=subprocess.PIPE, >+ ) >+ gzip = subprocess.Popen( > ('gzip',), >- stdin=open(filename, 'rb'), >+ stdin=tee.stdout, > stdout=open(filename + '.gz', 'wb'), > ) >+ tee.stdout.close() >+ prev = None >+ for pkg in Packages.iter_paragraphs(sorter.stdout): >+ if prev: >+ if prev["Package"] != pkg["Package"]: >+ tee.stdin.write("%s\n" % prev) >+ elif apt_pkg.version_compare(prev["Version"], pkg["Version"]) >= 0: >+ continue >+ prev = pkg >+ if prev: >+ tee.stdin.write("%s\n" % prev) >+ tee.stdin.close() >+ rc_sorter, rc_tee, rc_gzip = sorter.wait(), tee.wait(), gzip.wait() >+ self.log.debug('sorter=%d tee=%d gzip=%d', rc_sorter, rc_tee, rc_gzip) >+ os.remove(filename + '.tmp') > > def _release(self, outdir, dist, archs, version): > rel_name = os.path.join(outdir, 'dists', dist, 'Release') >diff --git a/branches/ucs-4.1/ucs-4.1-1/base/univention-updater/modules/univention/updater/mirror.py b/branches/ucs-4.1/ucs-4.1-1/base/univention-updater/modules/univention/updater/mirror.py >index 9abf547..7b161c6 100644 >--- a/branches/ucs-4.1/ucs-4.1-1/base/univention-updater/modules/univention/updater/mirror.py >+++ b/branches/ucs-4.1/ucs-4.1-1/base/univention-updater/modules/univention/updater/mirror.py >@@ -39,6 +39,7 @@ import itertools > import logging > from operator import itemgetter > from debian.deb822 import Packages >+from apt import apt_pkg > > from tools import UniventionUpdater, NullHandler > from ucs_version import UCS_Version >@@ -240,8 +241,8 @@ class UniventionMirror(UniventionUpdater): > self.log.debug('Generating %s and %s ...', main_name, inst_name) > makedirs(os.path.dirname(main_name)) > makedirs(os.path.dirname(inst_name)) >- main = open(main_name, 'w') >- inst = open(inst_name, 'w') >+ main = open(main_name + '.tmp', 'w') >+ inst = open(inst_name + '.tmp', 'w') > try: > for dir2, src_name in prev: > self.log.debug('Appending %s ...', src_name) >@@ -275,11 +276,35 @@ class UniventionMirror(UniventionUpdater): > > def _compress(self, filename): > self.log.debug('Compressing %s ...', filename) >- subprocess.call( >+ sorter = subprocess.Popen( >+ ('apt-sortpkgs', filename + '.tmp'), >+ stdout=subprocess.PIPE, >+ ) >+ tee = subprocess.Popen( >+ ('tee', filename), >+ stdin=subprocess.PIPE, >+ stdout=subprocess.PIPE, >+ ) >+ gzip = subprocess.Popen( > ('gzip',), >- stdin=open(filename, 'rb'), >+ stdin=tee.stdout, > stdout=open(filename + '.gz', 'wb'), > ) >+ tee.stdout.close() >+ prev = None >+ for pkg in Packages.iter_paragraphs(sorter.stdout): >+ if prev: >+ if prev["Package"] != pkg["Package"]: >+ tee.stdin.write("%s\n" % prev) >+ elif apt_pkg.version_compare(prev["Version"], pkg["Version"]) >= 0: >+ continue >+ prev = pkg >+ if prev: >+ tee.stdin.write("%s\n" % prev) >+ tee.stdin.close() >+ rc_sorter, rc_tee, rc_gzip = sorter.wait(), tee.wait(), gzip.wait() >+ self.log.debug('sorter=%d tee=%d gzip=%d', rc_sorter, rc_tee, rc_gzip) >+ os.remove(filename + '.tmp') > > def _release(self, outdir, dist, archs, version): > rel_name = os.path.join(outdir, 'dists', dist, 'Release')
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 40932
:
7552
| 7553