Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
f23570f228 | |||
79af8764e1 | |||
94f1ffcf9a | |||
1c15fcfb25 | |||
5a0fa63a96 | |||
bbcfce5260 | |||
db0354041e | |||
c7d8a76d80 | |||
058a0baa7e | |||
38c75eea33 |
5
Makefile
5
Makefile
@ -11,7 +11,7 @@ sysconfdir = /etc
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
bindir = ${exec_prefix}/bin
|
||||
datadir = ${prefix}/share
|
||||
initrddir = ${sysconfdir}/rc.d/init.d
|
||||
unitdir = /lib/systemd/system
|
||||
libexecdir = ${prefix}/libexec
|
||||
mandir = ${prefix}/usr/share/man
|
||||
sysconfigdir= ${sysconfdir}/sysconfig
|
||||
@ -52,6 +52,7 @@ install-dirs:
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(sbindir)
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(cgidir)
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(htmldir)
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(unitdir)
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(pck_datadir)
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(pck_statedir)
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(pck_statedir)/template/autoupdate/spec-patches-build/old
|
||||
@ -82,6 +83,7 @@ install-programs:
|
||||
@$(INSTALL_SCRIPT) webbuild/webbuild-checkpassword $(DESTDIR)$(libexecdir)/webbuild-checkpassword
|
||||
@$(INSTALL_SCRIPT) webbuild/webbuild-functions $(DESTDIR)$(pck_datadir)/webbuild-functions
|
||||
@$(INSTALL_SCRIPT) webbuild/webbuild-functions-private $(DESTDIR)$(pck_datadir)/webbuild-functions-private
|
||||
@$(INSTALL_SCRIPT) telegram/openmamba_bot.py $(DESTDIR)$(pck_datadir)/openmamba_bot.py
|
||||
@cp -a webbuild/html/* $(DESTDIR)$(htmldir)
|
||||
|
||||
install-data:
|
||||
@ -102,6 +104,7 @@ install-data:
|
||||
@$(INSTALL_DATA) autodist-bashrc $(DESTDIR)$(pck_statedir)/.bashrc
|
||||
@$(INSTALL_DATA) autodist-bash_profile $(DESTDIR)$(pck_statedir)/.bash_profile
|
||||
@$(INSTALL_DATA) autodist-tmpfilesd $(DESTDIR)$(prefix)/lib/tmpfiles.d/autodist.conf
|
||||
@$(INSTALL_DATA) telegram/openmambabot.service $(DESTDIR)$(unitdir)/openmambabot.service
|
||||
@touch $(DESTDIR)$(pck_statedir)/template/autoupdate/auto.success
|
||||
@touch $(DESTDIR)$(pck_statedir)/template/autoupdate/auto.skip
|
||||
|
||||
|
2
autodist
2
autodist
@ -5,7 +5,7 @@
|
||||
#
|
||||
# Released under the terms of the GNU GPL release 3 license
|
||||
#
|
||||
VERSION=1.0.0
|
||||
VERSION=1.0.2
|
||||
me=(${0##*/} $VERSION "Tue Jan 26 2016")
|
||||
exec 3>`readlink /proc/self/fd/0`
|
||||
|
||||
|
@ -145,9 +145,8 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||
[ "${SHOWLOG}" = "current" -o "${SHOWLOG}" = "last" -a ! "${AUTOPORT_UPDATE[$i]}" ] && echo -n " ($r)"
|
||||
echo -n ":</h2>"
|
||||
cat << _EOF
|
||||
<div class=downloadbox align=center>
|
||||
<div class=output align=left style="height:550px;width:850px;">
|
||||
<!--overflow:auto;font-size:8pt;border:1px solid #2b6600;margin:4px;padding:2px;color:lightgray;background-color:black;"-->
|
||||
<div class="downloadbox" align="center">
|
||||
<div class="output outputbox">
|
||||
_EOF
|
||||
echo -n "<pre><code>"
|
||||
if [ "$SHOWLOG" = "current" ]; then
|
||||
@ -215,8 +214,8 @@ _EOF
|
||||
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i&REP=$RNUM$HOST_ADD\">last</a> ]</b>"
|
||||
fi
|
||||
cat << _EOF
|
||||
<div class=downloadbox align=center>
|
||||
<div align=left style="background-color: white; height: 250px; width: 850px; overflow: auto; font-size: 8pt; border:1px solid #2b6600; margin: 4px; padding:4; background-color: #e0f2d0;">
|
||||
<div class="downloadbox" align="center">
|
||||
<div align="left" class="showlogbox">
|
||||
_EOF
|
||||
echo -n "<pre style='margin:1px;word-wrap:normal;white-space:pre;'>"
|
||||
unset BUILDNOWIDX BUILDLOG BUILDNOW BUILDNOWSTATUS SCHEDULED STARTTIME AUTODIST_PID ENDTIME
|
||||
|
@ -175,7 +175,7 @@ parse_arch_linux() {
|
||||
#for page in `seq 1 45`; do
|
||||
for rep in core community extra; do
|
||||
# SOURCEURL="https://www.archlinux.org/packages/?page=$page&sort=-last_update&q=&arch=i686&maintainer=&flagged="
|
||||
SOURCEURL="http://lug.mtu.edu/archlinux/$rep/os/i686/"
|
||||
SOURCEURL="http://lug.mtu.edu/archlinux/$rep/os/x86_64/"
|
||||
curl -L -s "$SOURCEURL" | \
|
||||
grep ".pkg." | grep -v ".sig\"" | \
|
||||
while read line; do
|
||||
@ -259,7 +259,7 @@ parse_gnome() {
|
||||
parse_distromatic() {
|
||||
# parse distrowatch.com packages list
|
||||
[ "$quiet" ] || echo "Parsing Distrowatch packages list..." >&2
|
||||
SOURCEURL="http://distrowatch.gds.tuwien.ac.at/packages.php"
|
||||
SOURCEURL="https://distrowatch.com/packages.php"
|
||||
lynx -width 300 -dump $SOURCEURL |
|
||||
while read line; do
|
||||
[ "`echo $line | grep "Package Version Note"`" ] && start_print=1
|
||||
|
13
automaint
13
automaint
@ -173,13 +173,18 @@ rm -f $tmpfile
|
||||
for p in ${allpkgs}; do
|
||||
pkgcontinue=
|
||||
needsport=
|
||||
|
||||
for w in ${warningslist[*]}; do
|
||||
[ "$p" = "$w" ] && { pkgcontinue=1; break; }
|
||||
done
|
||||
[ "$pkgcontinue" ] && continue
|
||||
|
||||
for a in `seq 1 ${#ARCHS[*]}`; do
|
||||
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$DEST_REPOSITORY ${ARCHS[$a-1]} $p
|
||||
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$PORT_REPOSITORY ${ARCHS[$a-1]} $p
|
||||
if [ ! "$pkg_name" ]; then
|
||||
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$DEST_REPOSITORY ${ARCHS[$a-1]} $p
|
||||
fi
|
||||
|
||||
if [ "$pkg_name" ]; then
|
||||
spkg_version=$pkg_version
|
||||
spkg_release=$pkg_release
|
||||
@ -253,7 +258,7 @@ for p in ${allpkgs}; do
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
if [ "$needsport" ]; then
|
||||
if [ "$needsport" -o "$pkg_repository" == "$PORT_REPOSITORY" ]; then
|
||||
echo "$p: importing from $SOURCE_REPOSITORY to $PORT_REPOSITORY ($pkg_version-$pkg_release -> $spkg_version-$spkg_release)"
|
||||
if [ ! "$TESTMODE" ]; then
|
||||
autodist-repository import $SOURCE_REPOSITORY $p -d $PORT_REPOSITORY -y >/dev/null
|
||||
@ -262,7 +267,7 @@ for p in ${allpkgs}; do
|
||||
MESSAGE=`cgi_encodevar \"imported <b>$p</b> from <b>$SOURCE_REPOSITORY</b> to <b>$PORT_REPOSITORY</b> for porting\"`" >/dev/null
|
||||
fi
|
||||
fi
|
||||
else
|
||||
elif [ "$pkg_repository" == "$DEST_REPOSITORY" ]; then
|
||||
echo "$p: importing from $SOURCE_REPOSITORY to $DEST_REPOSITORY ($pkg_version-$pkg_release -> $spkg_version-$spkg_release; update type: $update_type)"
|
||||
if [ ! "$TESTMODE" ]; then
|
||||
autodist-repository import $SOURCE_REPOSITORY $p -d $DEST_REPOSITORY -y >/dev/null
|
||||
@ -271,6 +276,8 @@ MESSAGE=`cgi_encodevar \"imported <b>$p</b> from <b>$SOURCE_REPOSITORY</b> to <b
|
||||
MESSAGE=`cgi_encodevar \"imported <b>$p</b> from <b>$SOURCE_REPOSITORY</b> to <b>$DEST_REPOSITORY</b>\"`" >/dev/null
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "$p: unexpected upstream package repository; ignoring."
|
||||
fi
|
||||
done
|
||||
|
||||
|
2
autoport
2
autoport
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Released under the terms of the GNU GPL release 3 license
|
||||
#
|
||||
VERSION=1.0.0
|
||||
VERSION=1.0.2
|
||||
|
||||
BASE_ARCH=i586
|
||||
BASE_REPOSITORY=devel
|
||||
|
@ -30,7 +30,7 @@ function fix_la_files() {
|
||||
sed -i "s|libdir='/usr/$TARGET_PLATFORM/${_lib}'|libdir='/usr/${_lib}'|g" /usr/${_lib}/*.la
|
||||
sed -i "s|libdir='/$TARGET_PLATFORM/${_lib}'|libdir='/usr/${_lib}'|g" /usr/${_lib}/*.la
|
||||
sed -i "s|/usr/$TARGET_PLATFORM/${_lib}|/usr/${_lib}|g" /usr/${_lib}/*.la
|
||||
sed -i "s|[:space:]/usr/$TARGET_PLATFORM/${_lib}|[:space:]/usr/${_lib}/lib|g" /usr/${_lib}/*.la
|
||||
sed -i "s|[[:space:]]/usr/$TARGET_PLATFORM/${_lib}|[[:space:]]/usr/${_lib}/lib|g" /usr/${_lib}/*.la
|
||||
}
|
||||
done
|
||||
}
|
||||
@ -41,7 +41,7 @@ function fix_la_files_cross() {
|
||||
sed -i "s|libdir='/usr/${_lib}'|libdir='/usr/$TARGET_PLATFORM/${_lib}'|g" /usr/$TARGET_PLATFORM/${_lib}/*.la
|
||||
sed -i "s|libdir='/${_lib}'|libdir='/usr/$TARGET_PLATFORM/${_lib}'|g" /usr/$TARGET_PLATFORM/${_lib}/*.la
|
||||
sed -i "s|/usr/${_lib}|/usr/$TARGET_PLATFORM/${_lib}|g" /usr/$TARGET_PLATFORM/${_lib}/*.la
|
||||
sed -i "s|[:space:]/lib/${_lib}|[:space:]/usr/$TARGET_PLATFORM/${_lib}/lib|g" /usr/$TARGET_PLATFORM/${_lib}/*.la
|
||||
sed -i "s|[[:space:]]/lib/${_lib}|[[:space:]]/usr/$TARGET_PLATFORM/${_lib}/lib|g" /usr/$TARGET_PLATFORM/${_lib}/*.la
|
||||
}
|
||||
done
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ makedist
|
||||
makedist-openmamba
|
||||
postplug
|
||||
grub-theme-openmamba
|
||||
kdevelop
|
||||
lxde
|
||||
distromatic
|
||||
u-boot
|
||||
|
@ -52,6 +52,8 @@ done
|
||||
sed -i "s|^Vendor:.*|Vendor: openmamba|;
|
||||
s|^Distribution:.*|Distribution: openmamba|;
|
||||
/BuildRequires:[[:space:]]*libffmpeg-devel/d;
|
||||
/^BuildRequires:[[:space:]]*libkdegames-devel/d;
|
||||
/^BuildRequires:[[:space:]]*libkdegames5-devel/d;
|
||||
s|\(BuildRequires:[[:space:]]*\)libmysql-devel|\1libmysql5-devel|;
|
||||
s|\(BuildRequires:[[:space:]]*\)libdb42-devel|\1libdb47-devel|;
|
||||
s|\(BuildRequires:[[:space:]]*\)firefox-devel|\1xulrunner-devel|;
|
||||
|
191
telegram/openmamba_bot.py
Executable file
191
telegram/openmamba_bot.py
Executable file
@ -0,0 +1,191 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# openmamba bot for Telegram
|
||||
#
|
||||
# Copyright (C) 2016-2017 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
#
|
||||
# GPL v3 license
|
||||
|
||||
from telegram import (ParseMode)
|
||||
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
|
||||
ConversationHandler, Job)
|
||||
|
||||
import logging
|
||||
import subprocess
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
# Enable logging
|
||||
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||
level=logging.INFO)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
timers = dict()
|
||||
social_log_last_ids = dict()
|
||||
|
||||
|
||||
def start(bot, update):
|
||||
|
||||
user = update.message.from_user
|
||||
logger.info("User %s started the conversation." % user.first_name)
|
||||
|
||||
update.message.reply_text(
|
||||
'Hi! This is the openmamba GNU/Linux Bot.\n'
|
||||
'Send any text to search for packages.\n'
|
||||
'Send /details name to see details of specified source package.\n'
|
||||
'Send /set [seconds] to enable notifications.\n'
|
||||
'Send /unset to disable notifications.\n'
|
||||
'Send /cancel to stop talking to me.\n\n')
|
||||
|
||||
return
|
||||
|
||||
|
||||
def query(bot, update):
|
||||
user = update.message.from_user
|
||||
logger.info("Query of %s: %s" % (user.first_name, update.message.text))
|
||||
|
||||
response = ""
|
||||
for rep in [ 'devel', 'devel-games', 'devel-makedist', 'devel-autodist', 'devel-kernel', 'devel-misc', 'devel-kde4' ]:
|
||||
conn = sqlite3.connect('/var/webbuild/db/%s-sources.db' % rep, check_same_thread=False)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute(
|
||||
'SELECT id,name,version,release,summary,url FROM sources where name like "%%%s%%" or summary like "%%%s%%" '
|
||||
'ORDER BY name="%s" DESC, name like "%s%%" DESC, name like "%%%s%%" DESC limit 10'
|
||||
% (update.message.text, update.message.text, update.message.text, update.message.text, update.message.text))
|
||||
for row in cursor:
|
||||
response += "<b>%s</b> %s-%s (%s)\n%s\n%s\n\n" % (row[1], row[2], row[3], rep, row[4], row[5])
|
||||
|
||||
if response != "":
|
||||
update.message.reply_text(response, parse_mode=ParseMode.HTML)
|
||||
else:
|
||||
update.message.reply_text('No results found.')
|
||||
return
|
||||
|
||||
|
||||
def details(bot, update, args):
|
||||
user = update.message.from_user
|
||||
logger.info("Details of %s: %s" % (user.first_name, update.message.text))
|
||||
|
||||
response = ""
|
||||
for rep in [ 'devel', 'devel-games', 'devel-makedist', 'devel-autodist', 'devel-kernel', 'devel-misc', 'devel-kde4' ]:
|
||||
conn = sqlite3.connect('/var/webbuild/db/%s-sources.db' % rep, check_same_thread=False)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute(
|
||||
'SELECT id,name,version,release,summary,url,description FROM sources where name="%s"' % (args[0]))
|
||||
for row in cursor:
|
||||
response += "<b>%s</b> %s-%s (devel)\n%s\n%s\n\n<i>%s</i>\n\n" % (row[1], row[2], row[3], row[4], row[5], row[6])
|
||||
for arch in [ 'x86_64', 'i586', 'arm' ]:
|
||||
conn1 = sqlite3.connect('/var/webbuild/db/' + rep + '-' + arch + '.db', check_same_thread=False)
|
||||
cursor1 = conn1.cursor()
|
||||
cursor1.execute('SELECT id,name FROM packages where id_source=%s' % (row[0]))
|
||||
for row1 in cursor1:
|
||||
response += "<b>%s</b>(%s) " % (row1[1], arch)
|
||||
response += "\n\n\n"
|
||||
|
||||
if response != "":
|
||||
update.message.reply_text(response, parse_mode=ParseMode.HTML)
|
||||
else:
|
||||
update.message.reply_text('No results found.')
|
||||
return
|
||||
|
||||
|
||||
def alarm(bot, job):
|
||||
social_log_conn = sqlite3.connect('/var/webbuild/webbuild.db')
|
||||
social_log_cursor = social_log_conn.cursor()
|
||||
social_log_cursor.execute('SELECT id,user,text,datetime(time,\'localtime\'),type FROM social_log where id>%s' % social_log_last_ids[job.context])
|
||||
response = ""
|
||||
for row in social_log_cursor:
|
||||
if row[4] == "job":
|
||||
response += "Job run by <i>%s</i> %s (%s)\n" % (row[1], row[2], row[3])
|
||||
else:
|
||||
response += "<i>%s</i> %s (%s)\n" % (row[1], row[2], row[3])
|
||||
if response != "":
|
||||
bot.sendMessage(job.context, response, parse_mode=ParseMode.HTML)
|
||||
social_log_last_ids[job.context] = row[0]
|
||||
|
||||
|
||||
def set(bot, update, args, job_queue):
|
||||
chat_id = update.message.chat_id
|
||||
try:
|
||||
due = int(args[0])
|
||||
if due < 0:
|
||||
update.message.reply_text('Sorry we can not go back to future!')
|
||||
return
|
||||
job = Job(alarm, due, repeat=True, context=chat_id)
|
||||
timers[chat_id] = job
|
||||
job_queue.put(job)
|
||||
|
||||
social_log_conn = sqlite3.connect('/var/webbuild/webbuild.db')
|
||||
social_log_cursor = social_log_conn.cursor()
|
||||
social_log_cursor.execute('''SELECT MAX(id) FROM social_log''')
|
||||
social_log_last_ids[chat_id] = social_log_cursor.fetchone()[0] - 5
|
||||
|
||||
update.message.reply_text('Notifications enabled!')
|
||||
|
||||
except (IndexError, ValueError):
|
||||
update.message.reply_text('Usage: /set <seconds>')
|
||||
|
||||
|
||||
def unset(bot, update):
|
||||
chat_id = update.message.chat_id
|
||||
|
||||
if chat_id not in timers:
|
||||
update.message.reply_text('Notification were not enabled')
|
||||
return
|
||||
|
||||
job = timers[chat_id]
|
||||
job.schedule_removal()
|
||||
del timers[chat_id]
|
||||
update.message.reply_text('Notifications disabled')
|
||||
|
||||
|
||||
def cancel(bot, update):
|
||||
user = update.message.from_user
|
||||
logger.info("User %s canceled the conversation." % user.first_name)
|
||||
update.message.reply_text('Bye!')
|
||||
|
||||
return ConversationHandler.END
|
||||
|
||||
|
||||
def error(bot, update, error):
|
||||
logger.warn('Update "%s" caused error "%s"' % (update, error))
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
# Load bot token from external configuration file
|
||||
bot_token = ""
|
||||
with open("/etc/autodist/secrets") as myfile:
|
||||
for line in myfile:
|
||||
name, var = line.rstrip().split("=")
|
||||
if name == "TELEGRAM_BOT_TOKEN":
|
||||
bot_token = var
|
||||
|
||||
# Create the EventHandler and pass it your bot's token.
|
||||
updater = Updater(bot_token)
|
||||
|
||||
# Get the dispatcher to register handlers
|
||||
dp = updater.dispatcher
|
||||
|
||||
dp.add_handler(CommandHandler('start', start))
|
||||
dp.add_handler(MessageHandler(Filters.text, query))
|
||||
dp.add_handler(CommandHandler('details', details, pass_args=True))
|
||||
dp.add_handler(CommandHandler('set', set, pass_args=True, pass_job_queue=True))
|
||||
dp.add_handler(CommandHandler('unset', unset))
|
||||
dp.add_handler(CommandHandler('cancel', cancel))
|
||||
|
||||
# log all errors
|
||||
dp.add_error_handler(error)
|
||||
|
||||
# Start the Bot
|
||||
updater.start_polling()
|
||||
|
||||
# Run the bot until the you presses Ctrl-C or the process receives SIGINT,
|
||||
# SIGTERM or SIGABRT. This should be used most of the time, since
|
||||
# start_polling() is non-blocking and will stop the bot gracefully.
|
||||
updater.idle()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
10
telegram/openmambabot.service
Normal file
10
telegram/openmambabot.service
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=openmamba bot for Telegram
|
||||
After=syslog.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/python /usr/share/autodist/openmamba_bot.py
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -100,7 +100,7 @@ elif [ "${REQUEST:0:7}" != "refresh" ]; then
|
||||
echo -n "<packages> </packages>"
|
||||
echo -n "<editcontrols> </editcontrols>"
|
||||
echo -n "<showlogcontrols> </showlogcontrols>"
|
||||
+ echo -n "<editor> </editor>"
|
||||
echo -n "<editor> </editor>"
|
||||
echo -n "<operationpanel> </operationpanel>"
|
||||
echo -n "</webbuild>"
|
||||
exit
|
||||
@ -137,12 +137,6 @@ if [ "$USER_ENABLED" != "1" -a "${REQUEST:0:7}" != "refresh" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -e $WEBBUILD_STATEDIR/webbuild.state ]; then
|
||||
. $WEBBUILD_STATEDIR/users/webbuild.state
|
||||
else
|
||||
touch $WEBBUILD_STATEDIR/users/webbuild.state
|
||||
fi
|
||||
|
||||
if [ "$USER_ADMIN" -a "$FAKEUSERSWITCH" != "" ]; then
|
||||
if [ "$FAKEUSERSWITCH" = "_disabled_" ]; then
|
||||
set_user_state_var STATE_FAKEUSER
|
||||
@ -209,7 +203,7 @@ fi
|
||||
if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
|
||||
if [ "$WEBBUILD_URL" -a "${WEBBUILD_URL/\/localhost\//}" = "$WEBBUILD_URL" ]; then
|
||||
curl -s "$WEBBUILD_URL?REQUEST=refreshsocial&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&FROMID=$FROMID"
|
||||
else
|
||||
else
|
||||
[ -e "$WEBBUILD_STATEDIR/webbuild.db" ] || exit
|
||||
# social box
|
||||
echo -n "<socialbox>"
|
||||
@ -217,13 +211,13 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
|
||||
if [ ! "$FROMID" -o "$FROMID" = "0" -o "$FROMID" = "NaN" ]; then
|
||||
# Find id of last row - 25
|
||||
if [ "$USER" ]; then
|
||||
LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE id!='$USER' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
|
||||
LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE user!='$USER' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
|
||||
else
|
||||
LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE target!='$DEVELOPERS' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
|
||||
LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE target!='developers' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
|
||||
fi
|
||||
FROMID=`sqlite3 $WEBBUILD_STATEDIR/webbuild.db "$LASTID_QUERY"`
|
||||
fi
|
||||
sqlite3 $WEBBUILD_STATEDIR/webbuild.db "select *,strftime('%s',time) from social_log where id>$FROMID" | while read line; do
|
||||
sqlite3 $WEBBUILD_STATEDIR/webbuild.db "SELECT *,strftime('%s',time) FROM social_log WHERE id>$FROMID LIMIT 100" | while read line; do
|
||||
SAVEIFS=$IFS
|
||||
IFS="|"
|
||||
set -- $line
|
||||
@ -236,7 +230,7 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
|
||||
STEXT="$7"
|
||||
STIME="$9"
|
||||
[ "$STARGET" = "developers" -a ! "$USER" ] && continue
|
||||
[ "$SUSER" = "$USER" -a "$STARGET" == "developers" ] && continue
|
||||
[ "$SUSER" = "$USER" -a "$STARGET" = "developers" ] && continue
|
||||
if [ "$SPRIVACY" -a ! "$USER" ]; then
|
||||
USER_GRAVATAR=
|
||||
else
|
||||
@ -473,7 +467,7 @@ fi
|
||||
if [ "$REQUEST" = "message" -a "$USER" -a "$USER_CANSENDMESSAGES" ]; then
|
||||
# external (autodist) social messages
|
||||
[ "$MESSAGETYPE" ] || MESSAGETYPE=broadcastmessage
|
||||
social_log "SUSER=$USER STYPE=$MESSAGETYPE SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`"
|
||||
social_log "SUSER=$USER STYPE=$MESSAGETYPE STARGET=\"$TARGET\" SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`"
|
||||
echo "</webbuild>"
|
||||
exit
|
||||
fi
|
||||
@ -481,7 +475,7 @@ fi
|
||||
# repsearch request
|
||||
if [ "$REQUEST" = "repsearch" ]; then
|
||||
echo -n "<output><![CDATA["
|
||||
echo -n "<hr><b>Search results for \"$REPSEARCHTEXT\":</b><div align=left class=output id=outputtop style=\"font-family:serif;color:black;background-color:#E0F2D0;\">"
|
||||
echo -n "<hr><b>Search results for \"$REPSEARCHTEXT\":</b><div align=left class=\"outputbox\" id=outputtop style=\"font-family:serif;color:black;background-color:#E0F2D0;\">"
|
||||
# echo -n "<pre><!-- SCROLL -->"
|
||||
REPSEARCHTEXT_FMT=`echo "${REPSEARCHTEXT}" | sed "s|[[:space:]]|+|g"`
|
||||
curl -s "${WEBBUILD_DISTROQUERY_URL}?query=${REPSEARCHTEXT_FMT}&search_milestone2=true&search_milestone3=true&search_devel=true\
|
||||
@ -500,7 +494,7 @@ fi
|
||||
# environment search request
|
||||
if [ "$REQUEST" = "environmentsearch" ]; then
|
||||
echo -n "<output><![CDATA["
|
||||
echo -n "<hr><b>Environment search results for \"$ENVSEARCHTEXT\":</b><div align=left class=output id=outputtop>"
|
||||
echo -n "<hr><b>Environment search results for \"$ENVSEARCHTEXT\":</b><div align=left class=\"outputbox\" id=outputtop>"
|
||||
echo -n "<pre><!-- SCROLL -->"
|
||||
echo -n "<font style=\"background-color:gray\">Installed packages providing '$ENVSEARCHTEXT':</font><br>"
|
||||
WHAT_PROVIDES=`$SUDO_WRAPPER binary $ENVIRONMENT "$USER" "" "rpm -q --what-provides \"$ENVSEARCHTEXT\"" | sort -u`
|
||||
@ -797,9 +791,9 @@ if [ ! "$REPSEARCHTEXT" ]; then
|
||||
# echo -n "REQUEST=repsearch&REPSEARCHTEXT=\"+encodeURIComponent(getElementById('repsearchtext').value));>"
|
||||
|
||||
if [ "$PACKAGE" ]; then
|
||||
echo -n "<input type=text style=\"display:block;width:98%;align:center;padding:0;margin:0;\" id=repsearchtext value=\"${PACKAGE/*\/}\" "
|
||||
echo -n "<br><input type=text id=\"repsearchtext\" value=\"${PACKAGE/*\/}\" "
|
||||
else
|
||||
echo -n "<input type=text style=\"display:block;width:98%;align:center;padding:0;margin:0;\" id=repsearchtext value=\"Enter a package name to search...\" "
|
||||
echo -n "<br><input type=text id=\"repsearchtext\" value=\"Enter a package name to search...\" "
|
||||
echo -n "onfocus=\"if (this.value==this.defaultValue) this.value=''\" "
|
||||
fi
|
||||
echo -n "onkeypress=if(checkEnter(event))ajax_getvalues(\""
|
||||
@ -1026,7 +1020,7 @@ if [ "$SPECTEXT" ]; then
|
||||
fi
|
||||
RET=$?
|
||||
[ $RET -eq 0 ] || {
|
||||
echo -n "<output><![CDATA[<div class=output>ERROR: could not save file ${PACKAGE/*\/}.spec! Please report the problem, thanks.</div>]]></output></webbuild>"
|
||||
echo -n "<output><![CDATA[<div class=\"outputbox\">ERROR: could not save file ${PACKAGE/*\/}.spec! Please report the problem, thanks.</div>]]></output></webbuild>"
|
||||
exit 1
|
||||
}
|
||||
rm -f $tmpfile
|
||||
@ -1047,7 +1041,7 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
|
||||
else
|
||||
OUTPUTMODE="outputbottom"
|
||||
fi
|
||||
echo -n "<output><![CDATA[<hr><b>Console output:</b><div align=left class=output id=$OUTPUTMODE>"
|
||||
echo -n "<output><![CDATA[<hr><b>Console output:</b><div align=left class=\"outputbox\" id=$OUTPUTMODE>"
|
||||
echo -n "<pre>"
|
||||
RET=255
|
||||
case $REQUEST in
|
||||
@ -1072,7 +1066,7 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
|
||||
"speccreate") if [ "$SPECCREATEURL" -a "$PACKAGE" ]; then
|
||||
FOUND_EXISTING=`curl -s "${WEBBUILD_DISTROQUERY_URL}?package=$PACKAGE&search_milestone2=true&search_milestone3=true&search_devel=true&search_sources=true&query_compact=true&replyplain=true&searchbox=false"`
|
||||
if [ "$FOUND_EXISTING" != "" ]; then
|
||||
echo -n "<div align=left class=output id=outputtop style=\"font-family:serif;color:black;background-color:#E0F2D0;\">"
|
||||
echo -n "<div align=left class=\"output\" id=outputtop style=\"font-family:serif;color:black;background-color:#E0F2D0;\">"
|
||||
echo "<b><font color=red>ERROR: package already exists, please update from appropriate version:</font><b>"
|
||||
echo -n "<hr><b>Search results for \"$PACKAGE\":</b>$FOUND_EXISTING"
|
||||
echo -n "</div>"
|
||||
@ -1521,7 +1515,7 @@ if [ "$MAINTAINERMODE" != "true" ]; then
|
||||
echo -n "ADDPATCHNAME=\"+encodeURIComponent(getElementById('addpatchname').value));>"
|
||||
echo -n " <a href=\"http://pastebin.com\" target=_new>pastebin</a><br>"
|
||||
echo -n "URL:<input type=text id=addpatchurl value=\"\" style=\"width:80%\">"
|
||||
echo -n "<br><div style=\"white-space:nowrap;font-size:9px;width:100%;overflow:hidden\"><span style=\"float:left;margin-top:6px;\">$PACKAGE-${SPECVAR_Version}-</span>"
|
||||
echo -n "<br><div style=\"white-space:nowrap;font-size:9pt;width:100%;overflow:hidden\"><span style=\"float:left;margin-top:6px;\">$PACKAGE-${SPECVAR_Version}-</span>"
|
||||
echo -n "<span style=\"display:block;float:right;margin-top:6px;\">.patch</span>"
|
||||
echo -n "<span style=\"display:block;overflow:hidden;padding-right:5px;\"><input type=text id=addpatchname value=\"\" style=\"width:100%\"></span></div>"
|
||||
echo -n "</div>"
|
||||
@ -1631,7 +1625,7 @@ if [ "$MAINTAINERMODE" != "true" ]; then
|
||||
#echo -n "REQUEST=runldconfig\");>"
|
||||
|
||||
# environment search
|
||||
echo -n "<div style=\"white-space:nowrap;width:100%;\">Provides:<input type=text style=\"width:75%;align:center;padding:0;margin:2px;\" id=environmentsearch value=\"Search package or provide...\" "
|
||||
echo -n "<div style=\"white-space:nowrap;width:100%;\">Provides:<input type=text style=\"width:75%;\" id=\"environmentsearch\" value=\"Search package or provide...\" "
|
||||
echo -n "onfocus=\"if (this.value==this.defaultValue) this.value=''\" "
|
||||
echo -n "onkeypress=if(checkEnter(event))ajax_getvalues(\""
|
||||
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
@ -1649,7 +1643,7 @@ fi
|
||||
echo -n "<chatpanel><![CDATA["
|
||||
# broadcast message
|
||||
echo -n "<div class=\"chatpanel\">"
|
||||
echo -n "<textarea id=broadcastmessage style=\"font-family:sans;height:36px;width:80%;float:left;font-size:8pt;resize:none;\" "
|
||||
echo -n "<textarea id=broadcastmessage style=\"height:40px;width:80%;float:left;resize:none;\" "
|
||||
echo -n "onfocus=\"if(this.value==this.defaultValue)this.value='';\">Chat with online developers...</textarea>"
|
||||
echo -n "<input type=button style=\"float:right\" onclick=ajax_getvalues(\""
|
||||
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
@ -1664,7 +1658,7 @@ if [ "$REQUEST" != "" ]; then
|
||||
echo -n "<b>Console output ($REQUEST"
|
||||
[ "$PACKAGE" ] && echo -n " for $PACKAGE"
|
||||
echo -n "):</b>"
|
||||
echo -n "<div align=left class=output "
|
||||
echo -n "<div class=\"outputbox\" "
|
||||
if [ "$REQUEST" = "rpmbuild" -o "$REQUEST" = "autoportnp" -o "$REQUEST" = "rpmprepare" \
|
||||
-o "$REQUEST" = "sendpackage" -o "$REQUEST" = "sendsource" -o "$REQUEST" = "autospeclistcheck" \
|
||||
-o "$REQUEST" = "autodistbuild" -o "$REQUEST" = "autodistinstall" -o "$REQUEST" = "autodistsend" ]; then
|
||||
|
@ -48,7 +48,7 @@ function social_log() {
|
||||
eval $line
|
||||
USER_SECRET_FIXED=`echo $USER_SECRET | sed "s|\$|\\$|"`
|
||||
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&\
|
||||
MESSAGE=`cgi_encodevar \"$STEXT\"`" >/dev/null
|
||||
TARGET=$STARGET&MESSAGE=`cgi_encodevar \"$STEXT\"`" >/dev/null
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -268,8 +268,8 @@ function parse_build_output() {
|
||||
s|^\([\+#] .*\)|<font style=\"color:cyan\">\1</font>|;
|
||||
s|\(ftp[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|<a href=\1 target=new>\1</a>|;
|
||||
s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|<a href=\1 target=new>\1</a>|;
|
||||
s|\(.*\)\(error[^0-9A-Za-z]*:[[:space:]]*.*\)|<font style=\"background-color:darkred;color:white\">\1<a %SRCURL%\2%SRCURLEND%>\2</a></font>|i;
|
||||
s|^\(== =.*\)|<font style=\"background-color:green;color:white\">\1</font>|;
|
||||
s|\(.*\)\(error[^0-9A-Za-z]*:[[:space:]]*.*\)|<span class=\"outputboxerror\">\1<a %SRCURL%\2%SRCURLEND%>\2</a></span>|i;
|
||||
s|^\(== =.*\)|<span class=\"outputboxok\">\1</span>|;
|
||||
s|^[[:cntrl:]]*\([!%?=][!%!=>] .*\)|<font style=\"color:gold\">\1</font>|;
|
||||
s|[[:cntrl:]]||g;" | google_search $1
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ function showlog() {
|
||||
LOGFILES=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls -t $LOGFILES 2>/dev/null | head -1"`
|
||||
fi
|
||||
echo -n "<output><![CDATA[<hr><b>Console output for $PACKAGE ($LOGTYPE$LOGSTATUSAPPEND):</b>"
|
||||
echo "<div align=left class=output id=$LOGOUTPUTID>"
|
||||
echo "<div align=left class=\"outputbox\" id=\"$LOGOUTPUTID\">"
|
||||
for f in $LOGFILES; do
|
||||
if [ -r $f ]; then
|
||||
LOGFILESIZE=`stat -c %s $f`
|
||||
|
@ -2,6 +2,7 @@
|
||||
. /usr/share/autodist/webbuild-functions
|
||||
. /etc/sysconfig/autoport
|
||||
|
||||
export LANG="C.UTF-8"
|
||||
MODE=$1
|
||||
ENVIRONMENT=$2
|
||||
USER=$3
|
||||
@ -87,7 +88,7 @@ if [ "$MODE" = "specinfo" ]; then
|
||||
done < ${ENVPREFIX}${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec
|
||||
[ "$AUTOBUILDREQ_BEGIN" -a "$AUTOBUILDREQ_END" -a ! "$AUTOBUILDREQ_UNDONE" ] || \
|
||||
echo "SPECVAR_CHECK_NOAUTOBUILDREQ=1"
|
||||
$SUCMDPREFIX "rpm -q --specfile ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec --specedit > ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec.tmp 2>/dev/null"
|
||||
$SUCMDPREFIX "rpmspec -P ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec > ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec.tmp 2>/dev/null"
|
||||
if [ -e $SPECFILE.tmp ]; then
|
||||
echo "SPECVAR_Specfile=\"$SPECFILE\""
|
||||
BUILDDIR=`grep -m1 "^%setup.*-n " $SPECFILE.tmp | sed "s|.*-n \([^[:space:]]*\).*|\1|"`
|
||||
|
Reference in New Issue
Block a user