Skip to content

Commit

Permalink
Fixes from flatpak release
Browse files Browse the repository at this point in the history
  • Loading branch information
bailuk committed Aug 29, 2024
1 parent 7e7d916 commit 8b7ef58
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 40 deletions.
4 changes: 2 additions & 2 deletions flatpak/ch.bailu.gtk_meteo.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"--env=GIO_EXTRA_MODULES=/app/lib/gio/modules",
"--env=JAVA_HOME=/app/jre",
"--env=LIBO_FLATPAK=1",
"--env=PATH=/app/bin:/app/jre/bin"
"--env=PATH=/app/jre/bin:/app/bin:/usr/bin"
],
"modules": [
{
Expand All @@ -33,7 +33,7 @@
{
"type": "git",
"url": "https://github.com/bailuk/gtk-meteo.git",
"commit": "543eb0a5ff40b57d70277fb6c7ac9b3e6f9fb431"
"commit": "7e7d91690fea4389be3162cde723003c367219ef"
},
"gradle-sources.json"
],
Expand Down
4 changes: 0 additions & 4 deletions flatpak/flatpak-create-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ full_id="ch.bailu.$short_id"

# As described in https://docs.flathub.org/docs/for-app-authors/submission/

test -d flatpak || cd ..
cd flatpak || exit 1

flatpak_base="build/flatpak"
flatpak_export="${flatpak_base}/export"
flatpak_repo="${flatpak_base}/repo"
Expand Down Expand Up @@ -65,7 +62,6 @@ echo "_"
echo "Export flatpak"
flatpak build-export ${flatpak_export} ${flatpak_build} || exit 1


echo "_"
echo "Build single-file bundle"
flatpak build-bundle ${flatpak_export} ${flatpak_base}/${short_id}.flatpak "$full_id"
Expand Down
68 changes: 34 additions & 34 deletions flatpak/flatpak-generate-gradle-sources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ gradle_target="build"
# The maven repos:
REPO_BASEURL=(
'https://plugins.gradle.org/m2/'
'https://repo1.maven.org/maven2/'
'https://jitpack.io/'
'https://repo1.maven.org/maven2/'
'https://jitpack.io/'
)

gradle_user_home="${module_root}/flatpak/build/gradle"
Expand Down Expand Up @@ -87,19 +87,19 @@ cd "$gradle_user_home/caches/modules-2/files-2.1" || exit 1
# Transforms gradle cache paths to maven repo paths
function mavenize {
IFS='/' read -r -a paths <<< "$1"
groupId=$(echo "${paths[1]}" | tr . /)
artifactId="${paths[2]}"
version="${paths[3]}"
echo "$groupId/$artifactId/$version"
groupId=$(echo "${paths[1]}" | tr . /)
artifactId="${paths[2]}"
version="${paths[3]}"
echo "$groupId/$artifactId/$version"
}

echo "_"
echo "Copy every file from the cache to it's maven repo location"
find . -type f -print0 | while IFS= read -r -d '' file; do
filename=$(basename "$file")
source_dir=$(dirname "$file")
target_dir="$maven_repo/$(mavenize "$file")"
mkdir -p "$target_dir" && cp "$source_dir/$filename" "$target_dir/"
filename=$(basename "$file")
source_dir=$(dirname "$file")
target_dir="$maven_repo/$(mavenize "$file")"
mkdir -p "$target_dir" && cp "$source_dir/$filename" "$target_dir/"
done

echo "_"
Expand All @@ -112,33 +112,33 @@ echo '[' > "$source_file"
echo "_"
echo "Probe repository for each file and write source object to json"
find * -type f | sort | while IFS= read -r file; do
url=''
for repo in "${REPO_BASEURL[@]}"; do
url_to_try="${repo}${file}"
if curl --head "$url_to_try" --fail -L &> /dev/null; then
url="$url_to_try"
break
fi
done
if [ -z "$url" ]; then
echo "ERROR: No repo contains $file"
exit 1
fi
hash="$(sha256sum "$file" | cut -f 1 -d ' ')"

echo "_"
url=''
for repo in "${REPO_BASEURL[@]}"; do
url_to_try="${repo}${file}"
if curl --head "$url_to_try" --fail -L &> /dev/null; then
url="$url_to_try"
break
fi
done
if [ -z "$url" ]; then
echo "ERROR: No repo contains $file"
exit 1
fi
hash="$(sha256sum "$file" | cut -f 1 -d ' ')"

echo "_"
echo "$url"
echo "$hash"
echo "$file"

cat << HERE >> "$source_file"
{
"type": "file",
"url": "$url",
"sha256": "$hash",
"dest": "maven-local/$(dirname "$file")",
"dest-filename": "$(basename "$file")"
},
cat << HERE >> "$source_file"
{
"type": "file",
"url": "$url",
"sha256": "$hash",
"dest": "maven-local/$(dirname "$file")",
"dest-filename": "$(basename "$file")"
},
HERE
done

Expand All @@ -158,7 +158,7 @@ HERE

# Remove last line in json file and replace with closing braces without comma
head -n -1 "$source_file" > temp.json && mv temp.json "$source_file"
echo ' }' >> "$source_file"
echo ' }' >> "$source_file"
# And close the json array
echo ']' >> "$source_file"

Expand Down

0 comments on commit 8b7ef58

Please sign in to comment.