pyreposync 0.2.1__py3-none-any.whl → 0.2.3__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
 
@@ -86,15 +89,24 @@ class SyncRPM(SyncGeneric):
86
89
  self.log.error(
87
90
  f"could not migrate {location}: {destination_old} not found"
88
91
  )
89
- continue
90
92
  except OSError as err:
91
93
  self.log.error(f"could not migrate {location}: {err}")
92
- continue
93
94
 
94
95
  for snap in self.snap_list_timestamp_snapshots():
95
96
  self.log.info(f"migrating {snap}")
96
97
  base_path = f"{self.destination}/snap/{self.reponame}/{snap}"
97
98
  for location, hash_algo, hash_sum in self.packages(base_path=base_path):
99
+ destination_old = f"{self.destination}/sync/{self.reponame}/{location}"
100
+ destination_new = f"{self.destination}/sync/{self.reponame}/{location}.{hash_algo}.{hash_sum}"
101
+ try:
102
+ os.rename(destination_old, destination_new)
103
+ except FileNotFoundError:
104
+ self.log.error(
105
+ f"could not migrate {location}: {destination_old} not found"
106
+ )
107
+ except OSError as err:
108
+ self.log.error(f"could not migrate {location}: {err}")
109
+
98
110
  dst = f"{base_path}/{location}"
99
111
  src = f"{self.destination}/sync/{self.reponame}/{location}.{hash_algo}.{hash_sum}"
100
112
  try:
@@ -114,7 +126,15 @@ class SyncRPM(SyncGeneric):
114
126
  for location, hash_algo, hash_sum in self.packages():
115
127
  url = f"{self.base_url}{location}"
116
128
  destination = f"{self.destination}/sync/{self.reponame}/{location}.{hash_algo}.{hash_sum}"
117
- self.downloader.get(url, destination, hash_sum, hash_algo, replace=False)
129
+ try:
130
+ self.downloader.get(
131
+ url, destination, hash_sum, hash_algo, replace=False
132
+ )
133
+ except OSRepoSyncDownLoadError:
134
+ if self.allow_missing_packages:
135
+ pass
136
+ else:
137
+ raise
118
138
 
119
139
  def treeinfo_files(self):
120
140
  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.1
3
+ Version: 0.2.3
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=5xIV0zG6FLL4Xv1zuVoPodYbg689qNBy2rZixYj73JA,11184
7
+ pyreposync-0.2.3.dist-info/METADATA,sha256=OT6kup82ufQsSJ_59i-smN52NT4GMDVvdyf7HWrDPLo,1565
8
+ pyreposync-0.2.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ pyreposync-0.2.3.dist-info/entry_points.txt,sha256=9LsBDWOF3O6_3ONP3Lc-4v1MTt5ay0Xv-TMcFbOIt2s,47
10
+ pyreposync-0.2.3.dist-info/licenses/LICENSE.txt,sha256=lwnJoIo7uwc0h6y6gC_RYqJkvjplViV3Ad6u7pQM4Bw,1084
11
+ pyreposync-0.2.3.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=odQczvyKCj5w-iB2KhkzJpj8ZnIuBPoTMCgDM1ddfXQ,10205
7
- pyreposync-0.2.1.dist-info/METADATA,sha256=AgufaQ-v626kKo0eSMioqoJDvatIYVNPC-s0Zm4IHDo,1565
8
- pyreposync-0.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- pyreposync-0.2.1.dist-info/entry_points.txt,sha256=9LsBDWOF3O6_3ONP3Lc-4v1MTt5ay0Xv-TMcFbOIt2s,47
10
- pyreposync-0.2.1.dist-info/licenses/LICENSE.txt,sha256=lwnJoIo7uwc0h6y6gC_RYqJkvjplViV3Ad6u7pQM4Bw,1084
11
- pyreposync-0.2.1.dist-info/RECORD,,