pyreposync 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pyreposync/__init__.py CHANGED
@@ -265,6 +265,9 @@ class PyRepoSync:
265
265
  destination=self.config.get("main", "destination"),
266
266
  reponame=section[:-4],
267
267
  date=date,
268
+ allow_missing_packages=self.config.getboolean(
269
+ section, "allow_missing_packages", fallback=False
270
+ ),
268
271
  treeinfo=self.config.get(section, "treeinfo", fallback=".treeinfo"),
269
272
  proxy=self.config.get("main", "proxy", fallback=None),
270
273
  client_cert=self.config.get(section, "sslclientcert", fallback=None),
@@ -277,6 +280,9 @@ class PyRepoSync:
277
280
  destination=self.config.get("main", "destination"),
278
281
  reponame=section[:-4],
279
282
  date=date,
283
+ allow_missing_packages=self.config.getboolean(
284
+ section, "allow_missing_packages", fallback=False
285
+ ),
280
286
  proxy=self.config.get(section, "proxy", fallback=None),
281
287
  client_cert=self.config.get(section, "sslclientcert", fallback=None),
282
288
  client_key=self.config.get(section, "sslclientkey", fallback=None),
pyreposync/sync_deb.py CHANGED
@@ -16,20 +16,22 @@ class SyncDeb(SyncGeneric):
16
16
  suites,
17
17
  components,
18
18
  binary_archs,
19
+ allow_missing_packages,
19
20
  proxy=None,
20
21
  client_cert=None,
21
22
  client_key=None,
22
23
  ca_cert=None,
23
24
  ):
24
25
  super().__init__(
25
- base_url,
26
- destination,
27
- reponame,
28
- date,
29
- proxy,
30
- client_cert,
31
- client_key,
32
- ca_cert,
26
+ base_url=base_url,
27
+ destination=destination,
28
+ reponame=reponame,
29
+ date=date,
30
+ allow_missing_packages=allow_missing_packages,
31
+ proxy=proxy,
32
+ client_cert=client_cert,
33
+ client_key=client_key,
34
+ ca_cert=ca_cert,
33
35
  )
34
36
  self._binary_archs = binary_archs
35
37
  self._components = components
@@ -13,11 +13,13 @@ class SyncGeneric:
13
13
  destination,
14
14
  reponame,
15
15
  date,
16
+ allow_missing_packages,
16
17
  proxy=None,
17
18
  client_cert=None,
18
19
  client_key=None,
19
20
  ca_cert=None,
20
21
  ):
22
+ self._allow_missing_packages = allow_missing_packages
21
23
  self._base_url = base_url
22
24
  self._date = date
23
25
  self._destination = destination
@@ -27,6 +29,10 @@ class SyncGeneric:
27
29
  )
28
30
  self.log = logging.getLogger("application")
29
31
 
32
+ @property
33
+ def allow_missing_packages(self):
34
+ return self._allow_missing_packages
35
+
30
36
  @property
31
37
  def base_url(self):
32
38
  return self._base_url
pyreposync/sync_rpm.py CHANGED
@@ -11,6 +11,7 @@ import xml.etree.ElementTree
11
11
  from pyreposync.sync_generic import SyncGeneric
12
12
 
13
13
  from pyreposync.exceptions import OSRepoSyncException
14
+ from pyreposync.exceptions import OSRepoSyncDownLoadError
14
15
 
15
16
 
16
17
  class SyncRPM(SyncGeneric):
@@ -21,20 +22,22 @@ class SyncRPM(SyncGeneric):
21
22
  reponame,
22
23
  date,
23
24
  treeinfo,
25
+ allow_missing_packages,
24
26
  proxy=None,
25
27
  client_cert=None,
26
28
  client_key=None,
27
29
  ca_cert=None,
28
30
  ):
29
31
  super().__init__(
30
- base_url,
31
- destination,
32
- reponame,
33
- date,
34
- proxy,
35
- client_cert,
36
- client_key,
37
- ca_cert,
32
+ base_url=base_url,
33
+ destination=destination,
34
+ reponame=reponame,
35
+ date=date,
36
+ allow_missing_packages=allow_missing_packages,
37
+ proxy=proxy,
38
+ client_cert=client_cert,
39
+ client_key=client_key,
40
+ ca_cert=ca_cert,
38
41
  )
39
42
  self._treeinfo = treeinfo
40
43
 
@@ -62,7 +65,11 @@ class SyncRPM(SyncGeneric):
62
65
  root = xml.etree.ElementTree.parse(source).getroot()
63
66
  else:
64
67
  with open(primary, "rb") as source:
65
- root = xml.etree.ElementTree.parse(source).getroot()
68
+ try:
69
+ root = xml.etree.ElementTree.parse(source).getroot()
70
+ except xml.etree.ElementTree.ParseError as err:
71
+ self.log.fatal(f"could not parse {primary}: {err}")
72
+ raise OSRepoSyncException(f"could not parse {primary}: {err}")
66
73
  packages = root.findall("{http://linux.duke.edu/metadata/common}package")
67
74
  for package in packages:
68
75
  checksum = package.find("{http://linux.duke.edu/metadata/common}checksum")
@@ -123,7 +130,15 @@ class SyncRPM(SyncGeneric):
123
130
  for location, hash_algo, hash_sum in self.packages():
124
131
  url = f"{self.base_url}{location}"
125
132
  destination = f"{self.destination}/sync/{self.reponame}/{location}.{hash_algo}.{hash_sum}"
126
- self.downloader.get(url, destination, hash_sum, hash_algo, replace=False)
133
+ try:
134
+ self.downloader.get(
135
+ url, destination, hash_sum, hash_algo, replace=False
136
+ )
137
+ except OSRepoSyncDownLoadError:
138
+ if self.allow_missing_packages:
139
+ pass
140
+ else:
141
+ raise
127
142
 
128
143
  def treeinfo_files(self):
129
144
  treeinfo_file = f"{self.destination}/sync/{self.reponame}/{self.treeinfo}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyreposync
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Orbit Api
5
5
  Project-URL: Source, https://github.com/schlitzered/pyreposync
6
6
  Author-email: "Stephan.Schultchen" <sschultchen@gmail.com>
@@ -27,5 +27,5 @@ License: The MIT License (MIT)
27
27
  THE SOFTWARE.
28
28
  License-File: LICENSE.txt
29
29
  Classifier: Programming Language :: Python
30
- Requires-Python: >=3.6
30
+ Requires-Python: >=3.9
31
31
  Requires-Dist: requests
@@ -0,0 +1,11 @@
1
+ pyreposync/__init__.py,sha256=Y5wux97cZGbZfLJa2aXku1ZwISLVqoeYsgDDVTmbVpU,16562
2
+ pyreposync/downloader.py,sha256=828bIMCctd1X6I1w91-XHytQ1M5fmxkEw0YDKd5nvAY,4764
3
+ pyreposync/exceptions.py,sha256=IlnvhNaffQQ6geOgrjCciNFVbFpNcycH4ijSuMTbrGA,169
4
+ pyreposync/sync_deb.py,sha256=d9UggP-wW5CXXV4bjmd0gk7i0BM9xDeEJP8XEY_tYN0,8364
5
+ pyreposync/sync_generic.py,sha256=wN5hPcIacvQiMQoajcf7WSbiBGqxI86CYwfVnq1fR38,5693
6
+ pyreposync/sync_rpm.py,sha256=yL7fuGmg3yMbu3x5CtBF_3UAdsK4aFW-0saFJaiCB54,11428
7
+ pyreposync-0.2.4.dist-info/METADATA,sha256=W5rAwK4CK2UWpF-YpbiaeVZoovx49whfeVVXNr_e3Zo,1565
8
+ pyreposync-0.2.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ pyreposync-0.2.4.dist-info/entry_points.txt,sha256=9LsBDWOF3O6_3ONP3Lc-4v1MTt5ay0Xv-TMcFbOIt2s,47
10
+ pyreposync-0.2.4.dist-info/licenses/LICENSE.txt,sha256=lwnJoIo7uwc0h6y6gC_RYqJkvjplViV3Ad6u7pQM4Bw,1084
11
+ pyreposync-0.2.4.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- pyreposync/__init__.py,sha256=GdNdSibEs53cwekuUQI9SqM0gXSgO7kDQgWU0o-vWNU,16258
2
- pyreposync/downloader.py,sha256=828bIMCctd1X6I1w91-XHytQ1M5fmxkEw0YDKd5nvAY,4764
3
- pyreposync/exceptions.py,sha256=IlnvhNaffQQ6geOgrjCciNFVbFpNcycH4ijSuMTbrGA,169
4
- pyreposync/sync_deb.py,sha256=taH4Tf0i6alSR0Z_iJ21LfiAWZelcU74DnYCQ6EXwhs,8201
5
- pyreposync/sync_generic.py,sha256=vNNuh-hJp3Qj_AqrPc7S6OibHhsFKSFRaTv_2Aj9H9Y,5502
6
- pyreposync/sync_rpm.py,sha256=v9NpP_OA60NmVawEmFyk8j5nALLK8rZqxhCWeBXR5DM,10739
7
- pyreposync-0.2.2.dist-info/METADATA,sha256=BiyuASP9P7J9G1H8aagYyjUl5WAR4iDJAp_gZVSho_0,1565
8
- pyreposync-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- pyreposync-0.2.2.dist-info/entry_points.txt,sha256=9LsBDWOF3O6_3ONP3Lc-4v1MTt5ay0Xv-TMcFbOIt2s,47
10
- pyreposync-0.2.2.dist-info/licenses/LICENSE.txt,sha256=lwnJoIo7uwc0h6y6gC_RYqJkvjplViV3Ad6u7pQM4Bw,1084
11
- pyreposync-0.2.2.dist-info/RECORD,,