Browse Source

Add spec_cksources() to verify Sources: in spec files

Handy when working with Python module spec files which tend to use
GitHub or PyPi links.
Alois Mahdal 1 month ago
parent
commit
939759a76b
1 changed files with 19 additions and 0 deletions
  1. 19
    0
      dotfiles/config/bashum/main.bashrc

+ 19
- 0
dotfiles/config/bashum/main.bashrc View File

@@ -87,6 +87,25 @@ bb() {
87 87
     printf '\a'
88 88
 }
89 89
 
90
+spec_cksources() {
91
+    #
92
+    # Check Source?: URL's in RPM spec file $1
93
+    #
94
+    local file=$1
95
+    local hdr
96
+    local url
97
+    rpmspec -P "$file" \
98
+      | grep -E 'Source[0-9]+: *http' \
99
+      | while read -r hdr url; do
100
+            echo -n "$hdr: $url .."
101
+            curl -fsSL -I "$url" >/dev/null || {
102
+                echo fail
103
+                return 1
104
+            }
105
+            echo ok
106
+        done
107
+}
108
+
90 109
 nn() {
91 110
     #
92 111
     # Ring the bell and send notification $1 after $2 time