Skip to content

Commit

Permalink
Update patches for typecode, extractcode and packagedcode
Browse files Browse the repository at this point in the history
  • Loading branch information
qduanmu committed Feb 8, 2023
1 parent f4b1913 commit 1bf7db3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
7 changes: 3 additions & 4 deletions containers/docker-ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ RUN cd /etc/pki/ca-trust/source/anchors/ && \
mkdir -p /usr/local/lib64/python3.8/ && \
ln -s /opt/app-root/lib64/python3.8/site-packages /usr/local/lib64/python3.8/

# Apply patch for typecode, extractcode, packagedcode
# TODO: rpm.patch need an update together with the rpm parser
# Apply patches for typecode, extractcode, packagedcode
COPY ./containers/patches/* /opt/app-root/lib64/python3.8/site-packages/
WORKDIR /opt/app-root/lib64/python3.8/site-packages/
RUN patch -p0 < magic2.patch && \
patch -p0 < extract.patch
# patch -p0 < rpm.patch
patch -p0 < extract.patch && \
patch -p0 < rpm.patch

WORKDIR /opt/app-root/src
USER 1001
Expand Down
6 changes: 3 additions & 3 deletions containers/docker-openlcs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ RUN cd /etc/pki/ca-trust/source/anchors/ && \
chmod a+x -R "${HOME}"/containers/docker-openlcs/bin/* && \
chown -R 1001:0 "${HOME}"

# Apply patch for typecode, extractcode, packagedcode
# Apply patches for typecode, extractcode, packagedcode
COPY ./containers/patches/* /opt/app-root/lib64/python3.8/site-packages/
WORKDIR /opt/app-root/lib64/python3.8/site-packages/
RUN patch -p0 < magic2.patch && \
patch -p0 < extract.patch
# patch -p0 < rpm.patch
patch -p0 < extract.patch && \
patch -p0 < rpm.patch

WORKDIR "${HOME}"
USER 1001
4 changes: 2 additions & 2 deletions containers/patches/extract.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- extractcode/extract.py 2022-03-24 21:42:00.778077190 +0800
+++ extractcode/extract_mod.py 2022-03-24 21:42:00.778077190 +0800
--- extractcode/extract.py 2023-01-09 16:18:26.325216293 +0800
+++ extractcode/extract_mod.py 2023-02-08 15:59:53.481604363 +0800
@@ -127,6 +127,13 @@
processed_events_append = processed_events.append
for event in extract_events:
Expand Down
6 changes: 3 additions & 3 deletions containers/patches/magic2.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
--- typecode/magic2.py 2022-01-26 17:22:18.330889855 +0800
+++ typecode/magic2_mod.py 2022-01-26 17:22:08.812841583 +0800
--- typecode/magic2.py 2023-01-09 16:18:25.849212368 +0800
+++ typecode/magic2_mod.py 2023-02-08 15:49:28.718765445 +0800
@@ -29,6 +29,7 @@
# SOFTWARE.

import ctypes
+import ctypes.util
import glob
import os

import sys
14 changes: 7 additions & 7 deletions containers/patches/rpm.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
--- packagedcode/rpm.py 2022-04-01 12:38:24.375524865 +0800
+++ packagedcode/rpm.py.mod 2022-04-01 16:29:21.394860116 +0800
@@ -94,7 +94,7 @@
# note: the order of the named tuple is the sort order.
# But for creation we put the rarely used epoch last
def __new__(self, version, release=None, epoch=None):
--- packagedcode/rpm.py 2023-01-10 09:23:48.750055521 +0800
+++ packagedcode/rpm_mod.py 2023-02-08 15:45:31.010924345 +0800
@@ -99,7 +99,7 @@
note: the sort order of the named tuple is the sort order.
But for creation we put the rarely used epoch last with a default to None.
"""
- if epoch and epoch.strip() and not epoch.isdigit():
+ if epoch and not isinstance(epoch, int):
raise ValueError('Invalid epoch: must be a number or empty.')
if not version:
raise ValueError('Version is required: {}'.format(repr(version)))
@@ -111,7 +111,7 @@
@@ -116,7 +116,7 @@
vr = self.version

if self.epoch:
Expand Down

0 comments on commit 1bf7db3

Please sign in to comment.