Skip to content

Commit

Permalink
#861: Updated Packages (#393)
Browse files Browse the repository at this point in the history
* Improved scripts/update_apt_package_in_package_list.sh
  • Loading branch information
tkilias authored Dec 11, 2023
1 parent 39fcb6e commit bd3b330
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
curl|7.68.0-1ubuntu2.20 # t1
curl|7.68.0-1ubuntu2.21 # t1
wget|1.20.3-1ubuntu2 # t2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
curl|7.68.0-1ubuntu2.20 # t1
curl|7.68.0-1ubuntu2.21 # t1
wget| # t2
git|
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
coreutils|8.28-1ubuntu1
locales|2.31-0ubuntu9.12
locales|2.31-0ubuntu9.14
tar|1.29b-2ubuntu0.4
curl|7.68.0-1ubuntu2.20
curl|7.68.0-1ubuntu2.21
openjdk-11-jdk|11.0.19+7~us1-0ubuntu1~20.04.1
build-essential|12.4ubuntu1
libpcre3-dev|2:8.39-9ubuntu0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
unzip|6.0-25ubuntu1.1
git|1:2.25.1-1ubuntu3.11
libcurl4-openssl-dev|7.68.0-1ubuntu2.20
libcurl4-openssl-dev|7.68.0-1ubuntu2.21
build-essential|12.8ubuntu1.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ca-certificates|20230311ubuntu0.20.04.1
python3.8-dev|3.8.10-0ubuntu1~20.04.8
python3.8-dev|3.8.10-0ubuntu1~20.04.9
python3-distutils|3.8.10-0ubuntu1~20.04
curl|7.68.0-1ubuntu2.20
curl|7.68.0-1ubuntu2.21

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
coreutils|8.30-3ubuntu2
locales|2.31-0ubuntu9.12
locales|2.31-0ubuntu9.14
libnss-db|2.2.3pre1-6build6
libzmq3-dev|4.3.2-2ubuntu1
libprotobuf-dev|3.6.1.3-2ubuntu5.2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coreutils|8.30-3ubuntu2
locales|2.31-0ubuntu9.12
curl|7.68.0-1ubuntu2.20
locales|2.31-0ubuntu9.14
curl|7.68.0-1ubuntu2.21
ca-certificates|20230311ubuntu0.20.04.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coreutils|8.30-3ubuntu2
locales|2.31-0ubuntu9.12
curl|7.68.0-1ubuntu2.20
locales|2.31-0ubuntu9.14
curl|7.68.0-1ubuntu2.21
ca-certificates|20230311ubuntu0.20.04.1
27 changes: 17 additions & 10 deletions scripts/update_apt_package_in_package_list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@ PACKAGE=$(echo "$LIST_NEWEST_VERSION_OUTPUT" | cut -f 1 -d "|")
CANDIDATE_VERSION=$(echo "$LIST_NEWEST_VERSION_OUTPUT" | cut -f 3 -d "|")
CURRENT_VERSION=$(echo "$LIST_NEWEST_VERSION_OUTPUT" | cut -f 2 -d "|")

if [[ "$REPLACE" == "yes" ]]
then
SED_REPLACE_OPTION=("-i")
else
SED_REPLACE_OPTION=()
fi
grep -E -R "^$PACKAGE\|$CURRENT_VERSION" "$SEARCH_DIRECTORY" \
| cut -f 1 -d ":" \
| xargs -I{} sed "${SED_REPLACE_OPTION[@]}" -E "s/^($PACKAGE\|$CURRENT_VERSION).*$/$PACKAGE|$CANDIDATE_VERSION/g" "{}" \
| grep -E "^$PACKAGE\|"
FILES=$(grep -R "^$PACKAGE|$CURRENT_VERSION" "$SEARCH_DIRECTORY" | cut -f 1 -d ":")
for FILE in $FILES
do
echo "Found package $PACKAGE|$CURRENT_VERSION in $FILE"
echo "Original lines:"
grep "^$PACKAGE|$CURRENT_VERSION" "$FILE"
echo "Updated lines:"
CURRENT_VERSION_ESCAPE=${CURRENT_VERSION//\~/\\~}
SEARCH_REPLACE_PATTERN="s/^($PACKAGE|$CURRENT_VERSION_ESCAPE).*$/$PACKAGE|$CANDIDATE_VERSION/g"
sed -E "$SEARCH_REPLACE_PATTERN" "$FILE" | grep "^$PACKAGE|"
if [[ "$REPLACE" == "yes" ]]
then
echo "Updating file $FILE:"
sed -E -i "$SEARCH_REPLACE_PATTERN" "$FILE"
fi
echo
done

0 comments on commit bd3b330

Please sign in to comment.