[med-svn] [Git][med-team/community/package_template][master] 3 commits: Start dealing with PyPI in convert-watch5

Andreas Tille (@tille) gitlab at salsa.debian.org
Tue Feb 10 09:53:20 GMT 2026



Andreas Tille pushed to branch master at Debian Med / community / package_template


Commits:
9cc65dc3 by Andreas Tille at 2026-02-10T08:01:52+01:00
Start dealing with PyPI in convert-watch5

- - - - -
76a9c257 by Andreas Tille at 2026-02-10T08:09:06+01:00
Deal with uversionmangle

- - - - -
acd32c13 by Andreas Tille at 2026-02-10T10:52:55+01:00
Fix expression to make trailing , optional

- - - - -


1 changed file:

- convert-watch5


Changes:

=====================================
convert-watch5
=====================================
@@ -7,13 +7,20 @@ homepage=$(grep -E '^Homepage:' debian/control | awk '{print $2}')
 # Make sure it's a GitHub URL
 case "$homepage" in
   https://github.com/*/*)
+    host=github
     owner=$(echo "$homepage" | cut -d/ -f4)
     project=$(echo "$homepage" | cut -d/ -f5)
     ;;
+  https://pypi.org/project/*)
+    host=pypi
+    dist=$(echo "$homepage" | cut -d/ -f5)
+    # echo "PyPi project $dist"
+    ;;
   *)
     watch=$(grep -o 'https://github.com/[^/]\+/[^[:space:]]*' debian/watch | sed 's/\.git//')
     case "$watch" in
       https://github.com/*/*)
+        host=github
         owner=$(echo "$watch" | cut -d/ -f4)
         project=$(echo "$watch" | cut -d/ -f5)
         ;;
@@ -22,6 +29,7 @@ case "$homepage" in
         source=$(grep -E '^Source:' debian/copyright | awk '{print $2}')
         case "$source" in
 	    https://github.com/*/*)
+                host=github
 		owner=$(echo "$source" | cut -d/ -f4)
 		project=$(echo "$source" | cut -d/ -f5)
 		;;
@@ -34,16 +42,18 @@ case "$homepage" in
     ;;
 esac
 
-dversionmangle=$(grep -i 'dversionmangle[[:space:]]*=' debian/watch | sed 's/^.*dversionmangle[[:space:]]*=[[:space:]]*\([^,]\+\),.*/Dversion-Mangle: \1/')
-repacksuffix=$(grep -i 'repacksuffix[[:space:]]*=' debian/watch | sed 's/^.*repacksuffix[[:space:]]*=[[:space:]]*\([^,]\+\),.*/Repack-Suffix: \1/')
+dversionmangle=$(grep -i 'dversionmangle[[:space:]]*=' debian/watch | sed 's/^.*dversionmangle[[:space:]]*=[[:space:]]*\([^,]\+\)\(,\|$\).*/Dversion-Mangle: \1/')
+repacksuffix=$(grep -i 'repacksuffix[[:space:]]*=' debian/watch | sed 's/^.*repacksuffix[[:space:]]*=[[:space:]]*\([^,]\+\)\(,\|$\).*/Repack-Suffix: \1/')
+uversionmangle=$(grep -i 'uversionmangle[[:space:]]*=' debian/watch | sed 's/^.*uversionmangle[[:space:]]*=[[:space:]]*\([^,]\+\)\(,\|$\).*/Uversion-Mangle: \1/')
 #echo "$dversionmangle"
 #echo "$repacksuffix"
 
 use_tags=0
 
-response=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/$owner/$project/tags")
+if [ "$host" = "github" ] ; then
+  response=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/$owner/$project/tags")
 
-if [ "$response" -eq 200 ]; then
+  if [ "$response" -eq 200 ]; then
     # Check if tags array is not empty
     tag_count=$(curl -s "https://api.github.com/repos/$owner/$project/tags" | jq length 2>/dev/null || echo "0")
     
@@ -53,15 +63,16 @@ if [ "$response" -eq 200 ]; then
     else
         echo "Repository exists but has no tags"
     fi
-elif [ "$response" -eq 301 ]; then
+  elif [ "$response" -eq 301 ]; then
     echo "Repository moved permanently.  Please adjust Homepage field."
     exit 1
-elif [ "$response" -eq 404 ]; then
+  elif [ "$response" -eq 404 ]; then
     echo "Repository not found"
     exit 1
-else
+  else
     echo "Error: HTTP $response"
     exit 1
+  fi
 fi
 
 cat > debian/watch <<EOF
@@ -69,20 +80,29 @@ Version: 5
 
 EOF
 
-if [ $use_tags -eq 1 ] ; then
-cat >> debian/watch <<EOF
+if [ "$host" = "pypi" ] ; then
+  cat >> debian/watch <<EOF
+Template: Pypi
+Dist:  $dist
+EOF
+fi
+
+if [ "$host" = "github" ] ; then
+  if [ $use_tags -eq 1 ] ; then
+    cat >> debian/watch <<EOF
 Template: Github
 Owner: $owner
 Project: $project
 EOF
-else
-# Append to debian/watch
-cat >> debian/watch <<EOF
+  else
+  # Append to debian/watch
+  cat >> debian/watch <<EOF
 Source: https://github.com/$owner/$project.git
 Matching-Pattern: HEAD
 Mode: git
 Git-Pretty: 0.0~git%cd.%h
 EOF
+  fi
 fi
 
 if [ "$dversionmangle" != "" ] ; then
@@ -91,3 +111,6 @@ fi
 if [ "$repacksuffix" != "" ] ; then
   echo $repacksuffix >> debian/watch
 fi
+if [ "$uversionmangle" != "" ] ; then
+  echo $uversionmangle >> debian/watch
+fi



View it on GitLab: https://salsa.debian.org/med-team/community/package_template/-/compare/b53627fa2b35b79f271efe977ccb52e98c149217...acd32c1303db2301bb73ad518a9ba89bbe40f779

-- 
View it on GitLab: https://salsa.debian.org/med-team/community/package_template/-/compare/b53627fa2b35b79f271efe977ccb52e98c149217...acd32c1303db2301bb73ad518a9ba89bbe40f779
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20260210/33665927/attachment-0001.htm>


More information about the debian-med-commit mailing list