diff --git a/fpaste-0.3.7.1-fedora-staging.patch b/fpaste-0.3.7.1-fedora-staging.patch new file mode 100644 index 0000000..b444496 --- /dev/null +++ b/fpaste-0.3.7.1-fedora-staging.patch @@ -0,0 +1,78 @@ +From 319b7c0d8f3956e5a2d0e4d4a4cd40c5b18e386c Mon Sep 17 00:00:00 2001 +From: Clint Savage +Date: Fri, 12 Oct 2012 13:04:12 -0600 +Subject: [PATCH] replace fpaste.org with sticky-notes version fpaste.stg.fp.o + +--- + fpaste | 40 +++++++++++++++++++++++++--------------- + 1 file changed, 25 insertions(+), 15 deletions(-) + +diff --git a/fpaste b/fpaste +index 8899397..7073dcd 100755 +--- a/fpaste ++++ b/fpaste +@@ -19,9 +19,10 @@ + VERSION = '0.3.7.1' + USER_AGENT = 'fpaste/' + VERSION + SET_DESCRIPTION_IF_EMPTY = 1 # stdin, clipboard, sysinfo +-FPASTE_URL = 'http://fpaste.org/' ++#FPASTE_URL = 'http://fpaste.org/' ++FPASTE_URL = 'http://paste.stg.fedoraproject.org/' + +-import os, sys, urllib, urllib2, subprocess ++import os, sys, urllib, urllib2, subprocess, json + from optparse import OptionParser, OptionGroup, SUPPRESS_HELP + + def is_text(text, maxCheck = 100, pctPrintable = 0.75): +@@ -80,7 +81,7 @@ def paste(text, options): + if len(author) > 30: + author = author[0:30-3] + "..." + +- params = urllib.urlencode({'title': title, 'author': author, 'lexer': options.lang, 'content': text, 'expire_options': options.expires}) ++ params = urllib.urlencode({'paste_lang': options.lang, 'paste_data': text, 'api_submit': 'true', 'mode': 'json'}) + pasteSizeKiB = len(params)/1024.0 + + if pasteSizeKiB >= 512: # 512KiB appears to be the current hard limit (20110404); old limit was 16MiB +@@ -110,18 +111,27 @@ def paste(text, options): + print f.read() + return False + +- url = f.geturl() +- if re.match(FPASTE_URL + '?.+', url): +- return url +- elif urllib2.urlparse.urlsplit(url).path == '/static/limit/': +- # instead of returning a 500 server error, fpaste.org now returns "http://fedoraunity.org/static/limit/" if paste too large +- print >> sys.stderr, "Error: paste size (%.1fKiB) exceeded server limit. %s" % (pasteSizeKiB, url) +- return False +- else: +- print >> sys.stderr, "Invalid URL '%s' returned. This should not happen. Use --debug to see server output" % url +- if options.debug: +- print f.read() +- return False ++# response = f.read() ++ response = json.loads(f.read()) ++ id = [i[1]["id"] for i in response.iteritems()].pop() ++# for k,j in i.iteritems(): ++# print j, k ++ ++ url = "{0}{1}".format(FPASTE_URL, id) ++ return url ++ ++# url = f.geturl() ++# if re.match(FPASTE_URL + '?.+', url): ++# return url ++# elif urllib2.urlparse.urlsplit(url).path == '/static/limit/': ++# # instead of returning a 500 server error, fpaste.org now returns "http://fedoraunity.org/static/limit/" if paste too large ++# print >> sys.stderr, "Error: paste size (%.1fKiB) exceeded server limit. %s" % (pasteSizeKiB, url) ++# return False ++# else: ++# print >> sys.stderr, "Invalid URL '%s' returned. This should not happen. Use --debug to see server output" % url ++# if options.debug: ++# print f.read() ++# return False + + + def sysinfo(show_stderr = False, show_successful_cmds = True, show_failed_cmds = True): +-- +1.7.11.7 + diff --git a/fpaste-0.3.7.1-remove-smolt-code.patch b/fpaste-0.3.7.1-remove-smolt-code.patch new file mode 100644 index 0000000..fc412bf --- /dev/null +++ b/fpaste-0.3.7.1-remove-smolt-code.patch @@ -0,0 +1,22 @@ +--- fpaste.orig 2012-10-19 10:33:40.030190352 +1100 ++++ fpaste 2012-10-19 10:33:47.819151831 +1100 +@@ -195,19 +195,6 @@ + else: + si.append( ('%s' % cmdname, out) ) + +- # public SMOLT url +- try: +- sys.path.append('/usr/share/smolt/client') +- from smolt import get_profile_link, getPubUUID +- from smolt_config import get_config_attr +- smoonurl = get_config_attr("SMOON_URL", "http://smolts.org/") +- pubuuid = getPubUUID() +- puburl = get_profile_link(smoonurl, pubuuid)+os.linesep +- except: +- puburl = None +- si.insert(2, ('Smolt Profile URL', puburl) ) +- +- sys.stderr.write("\n") + + # return in readable indented format + sistr = "=== fpaste %s System Information (fpaste --sysinfo) ===\n" % VERSION diff --git a/fpaste.spec b/fpaste.spec index 5c9c6d5..e0d2688 100644 --- a/fpaste.spec +++ b/fpaste.spec @@ -1,6 +1,6 @@ Name: fpaste Version: 0.3.7.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A simple tool for pasting info onto fpaste.org BuildArch: noarch Group: Applications/Internet @@ -8,6 +8,15 @@ License: GPLv3+ URL: https://fedorahosted.org/fpaste/ Source0: https://fedorahosted.org/released/fpaste/fpaste-%{version}.tar.bz2 +# Point fpaste to fedora sticky notes staging instance +# Thanks Clint for the patch. +# https://fedorahosted.org/fpaste/ticket/7#comment:1 +Patch0: %{name}-0.3.7.1-fedora-staging.patch + +# Remove smolt data from fpaste +# https://fedorahosted.org/fpaste/ticket/6 +Patch1: %{name}-0.3.7.1-remove-smolt-code.patch + %description It is often useful to be able to easily paste text to the Fedora Pastebin at http://fpaste.org and this simple script will do that @@ -19,6 +28,10 @@ be unable to paste something into the pastebin %prep %setup -q +# Patching order is important +%patch0 -p1 +%patch1 + %build #nothing required @@ -37,6 +50,12 @@ rm -rf %{buildroot} %{_mandir}/man1/fpaste.1.gz %changelog +* Fri Oct 19 2012 Ankur Sinha 0.3.7.1-4 +- Patch: remove smolt data +- Patch: point to fedora staging sticky notes server +- THIS UPDATE DOES NOT GO TO STABLE. TESTING ONLY. +- Will go to stable when the fedora sticky notes moves to production + * Thu Jul 19 2012 Fedora Release Engineering - 0.3.7.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild