ossa-scanner 0.1.34__py3-none-any.whl → 0.1.36__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.
ossa_scanner/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.34"
1
+ __version__ = "0.1.36"
ossa_scanner/scanner.py CHANGED
@@ -26,6 +26,7 @@ class Scanner:
26
26
  try:
27
27
  print(f"Processing package: {package}")
28
28
  package_info = get_package_info(self.pm_type, package, self.temp_dir)
29
+ exit()
29
30
  source_files = download_source(self.pm_type, package, self.temp_dir)
30
31
  self.save_package_report(package, package_info, source_files)
31
32
  except Exception as e:
@@ -2,7 +2,7 @@ import subprocess
2
2
  import re
3
3
  import os
4
4
  import shutil
5
-
5
+ import glob
6
6
 
7
7
  def list_packages(package_manager):
8
8
  if package_manager == 'apt':
@@ -158,36 +158,24 @@ def parse_apt_info(output, package_name, output_dir):
158
158
  }
159
159
 
160
160
  def apt_get_license_from_source(package_name, output_dir):
161
- """Fetches source package and extracts license from debian/copyright."""
162
-
161
+ p_hash = hash(package_name) % 10000
162
+ output_dir = os.path.join(output_dir, str(p_hash))
163
163
  try:
164
- # Ensure output directory exists
165
- os.makedirs(output_dir, exist_ok=True)
166
-
167
- # Run apt-get source inside output_dir
168
- subprocess.run(["apt-get", "source", package_name], check=True, capture_output=True, text=True, cwd=output_dir)
169
-
170
- # Find the extracted source directory (since apt-get source doesn't always use package_name directly)
171
- source_dirs = glob.glob(os.path.join(output_dir, f"{package_name}-*")) # Wildcard match for versioned package dirs
164
+ subprocess.run(["apt-get", "source", package_name, '-d', output_dir], check=True, capture_output=True, text=True)
165
+ source_dirs = [d for d in os.listdir(output_dir) if d.startswith(package_name) and os.path.isdir(d)]
172
166
  if not source_dirs:
173
167
  return "NOASSERTION"
174
-
168
+ print(package_name, source_dirs)
175
169
  package_dir = source_dirs[0]
176
170
  copyright_file = os.path.join(package_dir, "debian", "copyright")
177
-
178
- # Extract license information
179
171
  licenses = []
180
172
  if os.path.exists(copyright_file):
181
173
  with open(copyright_file, "r", encoding="utf-8") as f:
182
174
  for line in f:
183
175
  if re.search(r"(?i)license:", line):
184
176
  licenses.append(line.split(":", 1)[1].strip())
185
-
186
- # Cleanup
187
177
  shutil.rmtree(output_dir, ignore_errors=True)
188
-
189
178
  return ", ".join(set(licenses)) if licenses else "NOASSERTION"
190
-
191
179
  except subprocess.CalledProcessError as e:
192
180
  print(f"Error fetching source package: {e}")
193
181
  return "NOASSERTION"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ossa_scanner
3
- Version: 0.1.34
3
+ Version: 0.1.36
4
4
  Summary: Open Source Software Advisory generator for Core and Base Linux Packages.
5
5
  Home-page: https://github.com/oscarvalenzuelab/ossa_scanner
6
6
  Author: Oscar Valenzuela
@@ -1,16 +1,16 @@
1
- ossa_scanner/__init__.py,sha256=79r5jd-MqbhXLbIBDVBqUJvhvcucjkaId96r46KF18I,23
1
+ ossa_scanner/__init__.py,sha256=z6JYG2yALo9HI8zZMbgirtKP92kE14gI-nkfBP7Sf24,23
2
2
  ossa_scanner/cli.py,sha256=sgr8NFpf_Ut84KYFQjOKRxv8CfAMaTPhMo7DbR53lT4,2311
3
- ossa_scanner/scanner.py,sha256=P_pouAPLMWUq_tjiwDyBYvs6cnXDs5VHB8305ui2VHI,4802
3
+ ossa_scanner/scanner.py,sha256=4VfkM2h-Y1zFQnqdBxpav5OhRoTdjdmFbF5VOXKKoXU,4821
4
4
  ossa_scanner/uploader.py,sha256=dPbhSLlQcDyHP-6Ugn6BzYGn_VQ1Ik6TWt2138k3REo,1837
5
5
  ossa_scanner/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  ossa_scanner/utils/downloader.py,sha256=AGRhJU9YducTe6mY5-7mZ4fRTFg2tcfz1DS0Nee-wM0,5693
7
7
  ossa_scanner/utils/hash_calculator.py,sha256=LrDKngWOPbizYJWab2sDJDLB4pD_RrI51L0cZt3VjJY,960
8
8
  ossa_scanner/utils/os_detection.py,sha256=35VbUbFklzd7aojgltKf2PxbnVFcpREA7Tri2YI5nfY,417
9
- ossa_scanner/utils/package_manager.py,sha256=4Nk51B7IpLuJQnM4wQD_UTJBovI07KpDU0VcZM9jBBI,8959
9
+ ossa_scanner/utils/package_manager.py,sha256=BRBr31alnbOuQM_j_6e8VcGCJgE_sbMWNtddVoRPBU0,8707
10
10
  ossa_scanner/utils/swhid_calculator.py,sha256=7-bO4RglJr-kt5SjUfnlcPZD0k0-s_dveHEjRo-zEMc,1317
11
- ossa_scanner-0.1.34.dist-info/LICENSE,sha256=9slQ_XNiEkio28l90NwihP7a90fCL2GQ6YhcVXTBls4,1064
12
- ossa_scanner-0.1.34.dist-info/METADATA,sha256=7xU188NKa9NHaFeAfXfrdKC6VgyjIOgQv-rfTi4boK0,1938
13
- ossa_scanner-0.1.34.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
14
- ossa_scanner-0.1.34.dist-info/entry_points.txt,sha256=UVoAo-wTPxT82g3cfqTs2CmQnazd57TAwhd9VwEKD1c,55
15
- ossa_scanner-0.1.34.dist-info/top_level.txt,sha256=uUp5CvhZfJLapXn9DyUXvgH7QK3uzF2ibH943lWN5Bs,13
16
- ossa_scanner-0.1.34.dist-info/RECORD,,
11
+ ossa_scanner-0.1.36.dist-info/LICENSE,sha256=9slQ_XNiEkio28l90NwihP7a90fCL2GQ6YhcVXTBls4,1064
12
+ ossa_scanner-0.1.36.dist-info/METADATA,sha256=9BFx_9uhhXfg0mDZNvAfew3HQ_VYzwvWYVH5ife_5P4,1938
13
+ ossa_scanner-0.1.36.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
14
+ ossa_scanner-0.1.36.dist-info/entry_points.txt,sha256=UVoAo-wTPxT82g3cfqTs2CmQnazd57TAwhd9VwEKD1c,55
15
+ ossa_scanner-0.1.36.dist-info/top_level.txt,sha256=uUp5CvhZfJLapXn9DyUXvgH7QK3uzF2ibH943lWN5Bs,13
16
+ ossa_scanner-0.1.36.dist-info/RECORD,,