Skip to content

Commit

Permalink
fix: correct generated URLS & files
Browse files Browse the repository at this point in the history
Signed-off-by: WoodenMaiden <[email protected]>
  • Loading branch information
WoodenMaiden committed Dec 24, 2023
1 parent d87615c commit 32b56ff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
19 changes: 17 additions & 2 deletions scripts/setup_redirections.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
import sys
import os

import apt_pkg

from jinja2 import Template

apt_pkg.init()

args = sys.argv[1:]

pre_release = False
Expand All @@ -27,7 +31,17 @@

files = glob.glob("*.deb")
repo = args[0]
tag = args[1]
tag = args[1] # for the stable version
alpha_tag = None

if pre_release: # if this is a pre-release, then give tag the value of the current stable version
alpha_tag = tag
with open("Packages", "r") as fp:
for p in apt_pkg.TagFile(fp):
if not p["Package"].endswith("alpha"): # get the latest stable version
tag = p["Version"]
break


with open("templates/_headers_template", "r") as f:
template_header = Template(f.read())
Expand All @@ -47,7 +61,8 @@
latest_packages=latest_packages,
alpha_packages=alpha_packages,
repo=repo,
tag=tag
tag=tag,
alpha_tag=alpha_tag
))

for deb in files:
Expand Down
5 changes: 3 additions & 2 deletions templates/_headers_template
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
{% for p in latest_packages %}
/{{p}}.html
Content-Disposition: attachment; filename="{{p}}"
Location: https://github.com/{{repo}}/releases/download/{{tag}}/{{p}}.html
Location: https://github.com/{{repo}}/releases/download/{{tag}}/{{p}}

{% endfor %}

{% for a in alpha_packages %}
/{{a}}.html
Content-Disposition: attachment; filename="{{a}}"
Location: https://github.com/{{repo}}/releases/download/{{tag}}/{{a}}.html
Location: https://github.com/{{repo}}/releases/download/{{alpha_tag}}/{{a}}

{% endfor %}
4 changes: 2 additions & 2 deletions templates/index_template
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
</head>
<body>
<h1>Debian Repository</h1>
<p>Welcome to thttps://www.youtube.com/watch?v=y0RTfxgSHfghe Debian repository of the <a href="https://gama-platform.org">Gama platform</a>.<br>
<p>Welcome to the Debian repository of the <a href="https://gama-platform.org">Gama platform</a>.<br>
Below is a list of the latest debian/ubuntu packages available for download.</p>
<br/>

Expand Down Expand Up @@ -143,7 +143,7 @@ echo "deb [trusted=yes] https://ppa.gama-platform.org ./" | tee -a /etc/apt/sour
<p>The following apt packages can be installed the same way as the usual ones, however these are unstable and thus not recommended</p>

<ul>
{% for p in latest_packages %}
{% for p in alpha_packages %}
<li>
<a href="{{ p.file }}">{{ p.name }}</a>
<br>Architecture: {{ p.architecture }}
Expand Down

0 comments on commit 32b56ff

Please sign in to comment.