From b1019ecaf38e495e1bc71b0a25eda4fb1b394761 Mon Sep 17 00:00:00 2001 From: Bradley G Smith Date: Feb 02 2024 19:28:09 +0000 Subject: Remove Unused Scripts Remove two legacy scripts no longer part of the workflow. --- diff --git a/add-chglog b/add-chglog deleted file mode 100755 index 513026a..0000000 --- a/add-chglog +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/python -t -# -*- mode: Python; indent-tabs-mode: nil; coding: utf-8 -*- -# -# Copyright (c) 2005-2013 Fedora Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -import re -import subprocess -import sys -import textwrap -import time -from optparse import OptionParser - - -__version__ = "1.0.12" - -class SpecFile: - def __init__(self, filename): - self.filename = filename - f = None - try: - f = open(filename,"r") - self.lines = f.readlines() - finally: - f and f.close() - - _changelog_pattern = re.compile(r"^%changelog(\s|$)", re.I) - - def addChangelogEntry(self, evr, entry, email): - for i in range(len(self.lines)): - if SpecFile._changelog_pattern.match(self.lines[i]): - if len(evr): - evrstring = ' - %s' % evr - else: - evrstring = '' - date = time.strftime("%a %b %d %Y", time.gmtime()) - newchangelogentry = "* %s %s%s\n%s\n\n" % \ - (date, email, evrstring, entry) - self.lines[i] += newchangelogentry - return - - def writeFile(self, filename): - f = open(filename, "w") - f.writelines(self.lines) - f.close() - - def debugdiff(self, old, new): - print ('%s\n-%s\n+%s\n' % (self.filename, old, new)) - -if __name__ == "__main__": - usage = '''Usage: %prog [OPTION]... SPECFILE...''' - - userstring = subprocess.Popen("rpmdev-packager 2>/dev/null", shell = True, - stdout = subprocess.PIPE).communicate()[0] - userstring = userstring.strip() or None - - parser = OptionParser(usage=usage) - parser.add_option("-c", "--comment", default='- rebuilt', - help="changelog comment (default: \"- rebuilt\")") - parser.add_option("-u", "--userstring", default=userstring, - help="user name+email string (default: output from "+ - "rpmdev-packager(1))") - (opts, args) = parser.parse_args() - - if not args: - parser.error('No specfiles specified') - - if not opts.userstring: - parser.error('Userstring required, see option -u') - - # Grab bullet, insert one if not found. - bullet_re = re.compile(r'^([^\s\w])\s', re.UNICODE) - bullet = "-" - match = bullet_re.search(opts.comment) - if match: - bullet = match.group(1) - else: - opts.comment = bullet + " " + opts.comment - - # Format comment. - if opts.comment.find("\n") == -1: - wrapopts = { "subsequent_indent": (len(bullet)+1) * " ", - "break_long_words": False } - if sys.version_info[:2] > (2, 5): - wrapopts["break_on_hyphens"] = False - opts.comment = textwrap.fill(opts.comment, 80, **wrapopts) - - for aspec in args: - try: - s = SpecFile(aspec) - except: - # Not actually a parser error, but... meh. - parser.error(sys.exc_info()[1]) - - # Get EVR for changelog entry. - cmd = ("rpm", "-q", "--specfile", "--define", "dist %{nil}", - "--qf=%|epoch?{%{epoch}:}:{}|%{version}-%{release}\n", aspec) - popen = subprocess.Popen(cmd, stdout = subprocess.PIPE) - evr = str(popen.communicate()[0]).split("\n")[0] - - s.addChangelogEntry(evr, opts.comment, opts.userstring) - s.writeFile(aspec) - -sys.exit(0) diff --git a/getsource.sh b/getsource.sh deleted file mode 100755 index 11f4dec..0000000 --- a/getsource.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -GIT_COMMIT="$1" -GIT_SHORT="${GIT_COMMIT:0:7}" -GIT_VERSION="$2" - -set -o errexit -set -o nounset -set -o pipefail - -NAME=kubernetes -SPEC=${NAME}.spec - -curl -s -L https://github.com/GoogleCloudPlatform/${NAME}/archive/${GIT_COMMIT}.tar.gz > ${NAME}-${GIT_SHORT}.tar.gz - -since_tag=0 -if [[ "${GIT_VERSION}" =~ ^v([0-9]+)\.([0-9]+)\-([0-9]+)\-(.*)?$ ]]; then - git_major=${BASH_REMATCH[1]} - git_minor=${BASH_REMATCH[2]} - version="${git_major}.${git_minor}" - since_tag=${BASH_REMATCH[3]} -# handle version like 0.4.2 (although we just ignore the .2 portion...) -elif [[ "${GIT_VERSION}" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)\-([0-9]+)\-(.*)?$ ]]; then - git_major=${BASH_REMATCH[1]} - git_minor=${BASH_REMATCH[2]} - git_really_minor=${BASH_REMATCH[3]} - version="${git_major}.${git_minor}.${git_really_minor}" - since_tag=${BASH_REMATCH[4]} -fi - - -#put the git hash in as the commit -sed -i -e "s/%global commit\t\t[[:xdigit:]]\{40\}/%global commit\t\t${GIT_COMMIT}/" ${SPEC} -#update the version with the latest tag -sed -i -e "s/Version:\t[[:digit:]]\+\.[[:digit:]]\+\(\.[[:digit:]]\+\)\?/Version:\t${version}/" ${SPEC} -#update the release with since_tag -sed -i -e "s/Release:\t[[:digit:]]\+\.[[:digit:]]\+/Release:\t${since_tag}.0/" ${SPEC} -#update the git Version inside the built binaries -sed -i -e "s/export KUBE_GIT_VERSION=v.*/export KUBE_GIT_VERSION=${GIT_VERSION}/" ${SPEC} - -#increment the version number -./add-chglog --comment="Bump to upstream ${GIT_COMMIT}" --userstring="Eric Paris " ${SPEC} - -fedpkg clog - -echo "****Don't forget to run: fedpkg new-sources ${NAME}-${GIT_SHORT}.tar.gz"