X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=inline;f=daklib%2Farchive.py;h=e4804433be13afdb6cc5d18ac74a4ab5a40e477a;hb=4db39fc2fdceac5ddae30507a65f24b3fe694137;hp=81719a8731871ef2a4e24903328f518d80774f57;hpb=d0e97f0b0f1a35690a7bd789e70e04d5da616efd;p=dak.git diff --git a/daklib/archive.py b/daklib/archive.py index 81719a87..e4804433 100644 --- a/daklib/archive.py +++ b/daklib/archive.py @@ -388,14 +388,14 @@ class ArchiveTransaction(object): """ session = self.session - if session.query(ArchiveFile).filter_by(archive=archive, component=component, file=db_file).first() is None: - query = session.query(ArchiveFile).filter_by(file=db_file, component=component) + if session.query(ArchiveFile).filter_by(archive=archive, file=db_file).first() is None: + query = session.query(ArchiveFile).filter_by(file=db_file) if not allow_tainted: query = query.join(Archive).filter(Archive.tainted == False) source_af = query.first() if source_af is None: - raise ArchiveException('cp: Could not find {0} in component {1} in any archive.'.format(db_file.filename, component.component_name)) + raise ArchiveException('cp: Could not find {0} in any archive.'.format(db_file.filename)) target_af = ArchiveFile(archive, component, db_file) session.add(target_af) session.flush() @@ -1061,14 +1061,26 @@ class ArchiveUpload(object): remaining = [] for f in byhand: - parts = f.filename.split('_', 2) - if len(parts) != 3: - print "W: unexpected byhand filename {0}. No automatic processing.".format(f.filename) - remaining.append(f) - continue + if '_' in f.filename: + parts = f.filename.split('_', 2) + if len(parts) != 3: + print "W: unexpected byhand filename {0}. No automatic processing.".format(f.filename) + remaining.append(f) + continue + + package, version, archext = parts + arch, ext = archext.split('.', 1) + else: + parts = f.filename.split('.') + if len(parts) < 2: + print "W: unexpected byhand filename {0}. No automatic processing.".format(f.filename) + remaining.append(f) + continue - package, version, archext = parts - arch, ext = archext.split('.', 1) + package = parts[0] + version = '0' + arch = 'all' + ext = parts[-1] try: rule = automatic_byhand_packages.subtree(package)