pyreposync 0.2.0__py3-none-any.whl → 0.2.2__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/sync_rpm.py CHANGED
@@ -46,7 +46,7 @@ class SyncRPM(SyncGeneric):
46
46
  if not base_path:
47
47
  base_path = f"{self.destination}/sync/{self.reponame}"
48
48
  primary = None
49
- for location, hash_algo, hash_sum in self.repomd_files():
49
+ for location, hash_algo, hash_sum in self.repomd_files(base_path=base_path):
50
50
  destination = f"{base_path}/{location}"
51
51
  if "primary.xml" in destination.lower():
52
52
  primary = destination
@@ -86,15 +86,24 @@ class SyncRPM(SyncGeneric):
86
86
  self.log.error(
87
87
  f"could not migrate {location}: {destination_old} not found"
88
88
  )
89
- continue
90
89
  except OSError as err:
91
90
  self.log.error(f"could not migrate {location}: {err}")
92
- continue
93
91
 
94
92
  for snap in self.snap_list_timestamp_snapshots():
95
93
  self.log.info(f"migrating {snap}")
96
94
  base_path = f"{self.destination}/snap/{self.reponame}/{snap}"
97
95
  for location, hash_algo, hash_sum in self.packages(base_path=base_path):
96
+ destination_old = f"{self.destination}/sync/{self.reponame}/{location}"
97
+ destination_new = f"{self.destination}/sync/{self.reponame}/{location}.{hash_algo}.{hash_sum}"
98
+ try:
99
+ os.rename(destination_old, destination_new)
100
+ except FileNotFoundError:
101
+ self.log.error(
102
+ f"could not migrate {location}: {destination_old} not found"
103
+ )
104
+ except OSError as err:
105
+ self.log.error(f"could not migrate {location}: {err}")
106
+
98
107
  dst = f"{base_path}/{location}"
99
108
  src = f"{self.destination}/sync/{self.reponame}/{location}.{hash_algo}.{hash_sum}"
100
109
  try:
@@ -153,8 +162,10 @@ class SyncRPM(SyncGeneric):
153
162
  destination = f"{self.destination}/sync/{self.reponame}/{file}"
154
163
  self.downloader.get(url, destination, hash_sum, hash_algo, replace=True)
155
164
 
156
- def repomd_files(self):
157
- base_path = f"{self.destination}/sync/{self.reponame}/repodata/repomd.xml"
165
+ def repomd_files(self, base_path=None):
166
+ if not base_path:
167
+ base_path = f"{self.destination}/sync/{self.reponame}"
168
+ base_path = f"{base_path}/repodata/repomd.xml"
158
169
  repomd = xml.etree.ElementTree.parse(base_path).getroot()
159
170
  datas = repomd.findall("{http://linux.duke.edu/metadata/repo}data")
160
171
  for data in datas:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyreposync
3
- Version: 0.2.0
3
+ Version: 0.2.2
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.9
30
+ Requires-Python: >=3.6
31
31
  Requires-Dist: requests
@@ -3,9 +3,9 @@ pyreposync/downloader.py,sha256=828bIMCctd1X6I1w91-XHytQ1M5fmxkEw0YDKd5nvAY,4764
3
3
  pyreposync/exceptions.py,sha256=IlnvhNaffQQ6geOgrjCciNFVbFpNcycH4ijSuMTbrGA,169
4
4
  pyreposync/sync_deb.py,sha256=taH4Tf0i6alSR0Z_iJ21LfiAWZelcU74DnYCQ6EXwhs,8201
5
5
  pyreposync/sync_generic.py,sha256=vNNuh-hJp3Qj_AqrPc7S6OibHhsFKSFRaTv_2Aj9H9Y,5502
6
- pyreposync/sync_rpm.py,sha256=3aBKwO_wdyrOXR_3MZlup26WoMTG8p1qdiN165YigrA,10105
7
- pyreposync-0.2.0.dist-info/METADATA,sha256=0sRFsPPiLmjuLvljPnmCxVJXdwmVbUZwKuKHlSOkBXw,1565
8
- pyreposync-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- pyreposync-0.2.0.dist-info/entry_points.txt,sha256=9LsBDWOF3O6_3ONP3Lc-4v1MTt5ay0Xv-TMcFbOIt2s,47
10
- pyreposync-0.2.0.dist-info/licenses/LICENSE.txt,sha256=lwnJoIo7uwc0h6y6gC_RYqJkvjplViV3Ad6u7pQM4Bw,1084
11
- pyreposync-0.2.0.dist-info/RECORD,,
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,,