@jskladan's mad cries made me do this :-)
Details
Details
tested rpmlint and depcheck real usage
Diff Detail
Diff Detail
- Repository
- rLTRN libtaskotron
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | libtaskotron/file_utils.py (2 lines) | |||
| M | libtaskotron/koji_utils.py (11 lines) |
| Commit | Tree | Parents | Author | Summary | Date |
|---|---|---|---|---|---|
| ccdc5ee2f185 | e277b71b9408 | 14b08fa55507 | Kamil Páral | koji_utils: improve debug messages when downloading files (Show More…) | Jun 12 2014, 3:01 PM |
| Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 54 | def download(url, dest, overwrite=False, grabber=None): | |||
|---|---|---|---|---|---|
| 87 | # overwrite? | 87 | # overwrite? | ||
| 88 | if os.path.exists(dest): | 88 | if os.path.exists(dest): | ||
| 89 | if overwrite: | 89 | if overwrite: | ||
| 90 | os.remove(dest) | 90 | os.remove(dest) | ||
| 91 | else: | 91 | else: | ||
| 92 | log.debug('Already downloaded: %s', os.path.basename(dest)) | 92 | log.debug('Already downloaded: %s', os.path.basename(dest)) | ||
| 93 | return dest | 93 | return dest | ||
| 94 | 94 | | |||
| 95 | log.info('Downloading: %s', url) | 95 | log.debug('Downloading: %s', url) | ||
| 96 | try: | 96 | try: | ||
| 97 | grabber.urlgrab(url, dest) | 97 | grabber.urlgrab(url, dest) | ||
| 98 | except urlgrabber.grabber.URLGrabError, e: | 98 | except urlgrabber.grabber.URLGrabError, e: | ||
| 99 | log.exception('Download failed for: %s', url) | 99 | log.exception('Download failed for: %s', url) | ||
| 100 | # the file can be incomplete, remove | 100 | # the file can be incomplete, remove | ||
| 101 | if os.path.exists(dest): | 101 | if os.path.exists(dest): | ||
| 102 | try: | 102 | try: | ||
| 103 | os.remove(dest) | 103 | os.remove(dest) | ||
| 104 | except OSError, e: | 104 | except OSError, e: | ||
| 105 | log.exception('Could not delete incomplete file: %s', dest) | 105 | log.exception('Could not delete incomplete file: %s', dest) | ||
| 106 | raise TaskotronRemoteError(e) | 106 | raise TaskotronRemoteError(e) | ||
| 107 | 107 | | |||
| 108 | return dest | 108 | return dest | ||
| 109 | 109 | | |||
| Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | 106 | except OSError, e: | |||
|---|---|---|---|---|---|
| 108 | raise TaskotronRemoteError(e) | 108 | raise TaskotronRemoteError(e) | ||
| 109 | 109 | | |||
| 110 | 110 | | |||
| 111 | rpm_urls = self.nvr_to_urls(nvr, | 111 | rpm_urls = self.nvr_to_urls(nvr, | ||
| 112 | arches=arches, | 112 | arches=arches, | ||
| 113 | debuginfo=debuginfo, | 113 | debuginfo=debuginfo, | ||
| 114 | src=src) | 114 | src=src) | ||
| 115 | rpm_files = [] | 115 | rpm_files = [] | ||
| 116 | log.info('Fetching RPMs for: %s', nvr) | 116 | log.info('Fetching %s RPMs for: %s', len(rpm_urls), nvr) | ||
| 117 | for url in rpm_urls: | 117 | for url in rpm_urls: | ||
| 118 | log.info(' fetching %s', url) | 118 | log.debug(' Fetching %s', url) | ||
| 119 | rpm_file = file_utils.download(url, rpm_dir) | 119 | rpm_file = file_utils.download(url, rpm_dir) | ||
| 120 | rpm_files.append(rpm_file) | 120 | rpm_files.append(rpm_file) | ||
| 121 | 121 | | |||
| 122 | return rpm_files | 122 | return rpm_files | ||
| 123 | 123 | | |||
| 124 | 124 | | |||
| 125 | def get_tagged_rpms(self, tag, dest, arches): | 125 | def get_tagged_rpms(self, tag, dest, arches): | ||
| 126 | '''Downloads all RPMs of all NVRs tagged by a specific Koji tag. | 126 | '''Downloads all RPMs of all NVRs tagged by a specific Koji tag. | ||
| 127 | 127 | | |||
| 128 | :param str tag: Koji tag to be queried for available builds, e.g. | ||||
| 129 | ``f20-updates-pending`` | ||||
| 128 | :param str dest: destination directory | 130 | :param str dest: destination directory | ||
| 129 | :param arches: list of architectures | 131 | :param arches: list of architectures | ||
| 130 | :type arches: list of str | 132 | :type arches: list of str | ||
| 131 | :return: list of local filenames of the grabbed RPMs | 133 | :return: list of local filenames of the grabbed RPMs | ||
| 132 | :rtype: list of str | 134 | :rtype: list of str | ||
| 133 | :raise TaskotronRemoteError: if downloading failed | 135 | :raise TaskotronRemoteError: if downloading failed | ||
| 134 | ''' | 136 | ''' | ||
| 137 | log.debug('Querying Koji for tag: %s' % tag) | ||||
| 135 | tag_data = self.session.listTagged(tag) | 138 | tag_data = self.session.listTagged(tag) | ||
| 139 | | ||||
| 136 | nvrs = ["%(nvr)s" % x for x in tag_data] | 140 | nvrs = ["%(nvr)s" % x for x in tag_data] | ||
| 137 | rpms = [] | 141 | rpms = [] | ||
| 142 | log.info("Fetching %s builds for tag: %s", len(nvrs), tag) | ||||
| 143 | log.debug('Builds to be downloaded:\n %s', '\n '.join(nvrs)) | ||||
| 144 | | ||||
| 138 | for nvr in nvrs: | 145 | for nvr in nvrs: | ||
| 139 | rpms.append(self.get_nvr_rpms(nvr, dest, arches)) | 146 | rpms.append(self.get_nvr_rpms(nvr, dest, arches)) | ||
| 140 | 147 | | |||
| 141 | return rpms | 148 | return rpms | ||
| 142 | 149 | | |||
| 143 | 150 | | |||
| 144 | def getNEVR(build): | 151 | def getNEVR(build): | ||
| 145 | '''Extract RPM version identifier in NEVR format from Koji build object | 152 | '''Extract RPM version identifier in NEVR format from Koji build object | ||
| Show All 19 Lines | |||||