Skip to content
Browse files

Add scripts to add deps and replace SlackBuilds

Add sb_adddeps script that adds new dependencies to the REQUIRES list of
SlackBuilds. For example, add "qt" as a dependency to skype.

Add sb_replace script that replaces SlackBuild names with new names, in
case the package is already present in Salix repos, but is named
differently. For example "configobj" and "python-configobj".

In sb_dupes_req, also exclude all SlackBuilds in the SBoREPLACE list.
  • Loading branch information...
1 parent 8e06e72 commit 79f3e0b6f6310eac06b16bea57c7330b6e1e4bc0 @gapan committed Jun 27, 2014
Showing with 129 additions and 7 deletions.
  1. +46 −0 sbo/sb_adddeps
  2. +14 −5 sbo/sb_dupes_req
  3. +40 −0 sbo/sb_replace
  4. +29 −2 sbo/sync.sh
View
46 sbo/sb_adddeps
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+# This script adds extra dependencies to the SLACKBUILDS.TXT file, based
+# on the SBoADDEPS file.
+#
+# NOT FINISHED YET
+
+VERSION='14.1'
+
+SBOADD='SBoADD'
+SBO='SLACKBUILDS.TXT.SBo'
+SBONEW=SBO+'.NEW'
+
+d = dict()
+f = open(SBOADD)
+for line in f:
+ pkg, sep, deps = line.partition(':')
+ pkg = pkg.strip(' ')
+ deps = deps.rstrip('\n').strip(' ')
+ d[pkg]=deps
+f.close()
+
+f = open(SBO)
+fn = open(SBONEW, 'w')
+sb=''
+for line in f:
+ if line.startswith('SLACKBUILD NAME:'):
+ req = ''
+ sb = line.partition('SLACKBUILD NAME:')[2].lstrip(' ').rstrip(' \n')
+ if line.startswith('SLACKBUILD REQUIRES:'):
+ req = line.partition('SLACKBUILD REQUIRES:')[2].lstrip(' ').rstrip(' \n')
+ if req != '':
+ if sb in d:
+ newreq = req+','+d[sb]
+ else:
+ newreq = req
+ else:
+ if sb in d:
+ newreq = d[sb]
+ else:
+ newreq = ''
+ fn.write('SLACKBUILD REQUIRES: '+newreq+'\n')
+ else:
+ fn.write(line)
+f.close()
+fn.close()
View
19 sbo/sb_dupes_req
@@ -11,7 +11,8 @@ VERSION='14.1'
PKG='../../i486/'+VERSION+'/PACKAGES.TXT'
SLKBUILD='../../slkbuild/'+VERSION+'/SLACKBUILDS.TXT'
SBOEXCLUDE='SBoEXCLUDE'
-SBO='SLACKBUILDS.TXT'
+SBOREPLACE='SBoREPLACE'
+SBO='SLACKBUILDS.TXT.SBo'
SBONEW=SBO+'.NEW'
f = open(PKG)
@@ -35,6 +36,12 @@ for line in f:
packages.append(pkg)
f.close()
+f = open(SBOREPLACE)
+for line in f:
+ pkg = line.partition(':')[0].strip(' ')
+ packages.append(pkg)
+f.close()
+
f = open(SBO)
fn = open(SBONEW, 'w')
match = False
@@ -56,10 +63,12 @@ for line in f:
freq.close()
except IOError:
print sb+': info not found'
- if line.startswith('SLACKBUILD SHORT DESCRIPTION:'):
- if req != '':
- fn.write('SLACKBUILD REQUIRES: '+req+'\n')
if match is not True:
- fn.write(line)
+ if line.startswith('SLACKBUILD SHORT DESCRIPTION:'):
+ if req != '':
+ fn.write('SLACKBUILD REQUIRES: '+req+'\n')
+ else:
+ fn.write('SLACKBUILD REQUIRES: \n')
+ fn.write(line)
f.close()
fn.close()
View
40 sbo/sb_replace
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+# This script replaces mentions of SlackBuilds with a new name in the
+# REQUIRES lines. For example, it can replace all instances of
+# "configobj" with "python-configobj"
+
+VERSION='14.1'
+
+SBOREPLACE='SBoREPLACE'
+SBO='SLACKBUILDS.TXT.SBo'
+SBONEW=SBO+'.NEW'
+
+d = dict()
+f = open(SBOREPLACE)
+for line in f:
+ name, sep, new_name = line.partition(':')
+ name = name.strip(' ')
+ new_name = new_name.rstrip('\n').strip(' ')
+ d[name]=new_name
+f.close()
+
+f = open(SBO)
+fn = open(SBONEW, 'w')
+for line in f:
+ if line.startswith('SLACKBUILD REQUIRES:'):
+ reqline = line.partition('SLACKBUILD REQUIRES:')[2].lstrip(' ').rstrip(' \n')
+ reqlist = reqline.split(',')
+ new_reqs = ''
+ for req in reqlist:
+ if req != '':
+ if req in d:
+ new_reqs = new_reqs+d[req]+','
+ else:
+ new_reqs = req+','
+ new_reqs = new_reqs.rstrip(',')
+ fn.write('SLACKBUILD REQUIRES: '+new_reqs+'\n')
+ else:
+ fn.write(line)
+f.close()
+fn.close()
View
31 sbo/sync.sh
@@ -2,21 +2,48 @@
VERSION="14.1"
+DIR="/var/www/vhosts/salix.enialis.net/pages/sbo/$VERSION"
+
rsync -av --delete \
--exclude '.sync.sh' \
--exclude 'sync.sh' \
--exclude '.sb_dupes_req' \
--exclude 'sb_dupes_req' \
--exclude 'SBoEXCLUDE' \
+ --exclude '.sb_adddeps' \
+ --exclude 'sb_adddeps' \
+ --exclude 'SBoADD' \
+ --exclude '.sb_replace' \
+ --exclude 'sb_replace' \
+ --exclude 'SBoREPLACE' \
+ --exclude 'SLACKBUILDS.TXT' \
+ --exclude 'SLACKBUILDS.TXT.gz' \
rsync://slackbuilds.org/slackbuilds/$VERSION/ \
- /var/www/vhosts/salix.enialis.net/pages/sbo/$VERSION
+ $DIR
+
+rsync -av \
+ rsync://slackbuilds.org/slackbuilds/$VERSION/SLACKBUILDS.TXT \
+ $DIR/SLACKBUILDS.TXT.SBo
# use the hidden file only when a non-hidden file is not there
if [ -x ./sb_dupes_req ]; then
./sb_dupes_req
else
./.sb_dupes_req
fi
-mv SLACKBUILDS.TXT.NEW SLACKBUILDS.TXT
+mv SLACKBUILDS.TXT.SBo.NEW SLACKBUILDS.TXT.SBo
+if [ -x ./sb_adddeps ]; then
+ ./sb_adddeps
+else
+ ./.sb_adddeps
+fi
+mv SLACKBUILDS.TXT.SBo.NEW SLACKBUILDS.TXT.SBo
+if [ -x ./sb_replace ]; then
+ ./sb_replace
+else
+ ./.sb_replace
+fi
+rm -f SLACKBUILDS.TXT.SBo
+mv SLACKBUILDS.TXT.SBo.NEW SLACKBUILDS.TXT
cat SLACKBUILDS.TXT | gzip > SLACKBUILDS.TXT.gz

0 comments on commit 79f3e0b

Please sign in to comment.
Something went wrong with that request. Please try again.