aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES4
-rw-r--r--RepSys/commands/getsrpm.py25
-rw-r--r--RepSys/rpmutil.py25
3 files changed, 42 insertions, 12 deletions
diff --git a/CHANGES b/CHANGES
index d1db357..bad90d2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -11,6 +11,10 @@
- if REPSYS_CONF is set, /etc/repsys.conf and ~/.repsys/config will not be
readed anymore
- added option -F to repsys ci to set a log message file
+- added option --strict to getsrpm to check if the revision provided
+ matches the package URL;
+- added boolean configuration option strict-revision in the submit
+ section, to allow forcing the use of --strict
- the fix for the unreleased commits problem in the previous release was
wrong, really fixed it
- fixed the use of file:/// URLs when using just the package name
diff --git a/RepSys/commands/getsrpm.py b/RepSys/commands/getsrpm.py
index f1ebfe1..f9a63d2 100644
--- a/RepSys/commands/getsrpm.py
+++ b/RepSys/commands/getsrpm.py
@@ -19,17 +19,18 @@ Usage: repsys getsrpm [OPTIONS] REPPKGURL
Generates the source RPM (.srpm) file of a given package.
Options:
- -c Use files in current/ directory (default)
- -p Use files in pristine/ directory
- -v VER Use files from the version specified by VER (e.g. 2.2.1-2cl)
- -r REV Use files from current directory, in revision REV (e.g. 1001)
- -t DIR Put SRPM file in directory DIR when done (default is ".")
- -P USER Define the RPM packager inforamtion to USER
- -s FILE Run script with "FILE TOPDIR SPECFILE" command
- -n Rename the package to include the revision number
- -l Use subversion log to build rpm %changelog
- -T FILE Template to be used to generate the %changelog
- -h Show this message
+ -c Use files in current/ directory (default)
+ -p Use files in pristine/ directory
+ -v VER Use files from the version specified by VER (e.g. 2.2.1-2cl)
+ -r REV Use files from current directory, in revision REV (e.g. 1001)
+ -t DIR Put SRPM file in directory DIR when done (default is ".")
+ -P USER Define the RPM packager inforamtion to USER
+ -s FILE Run script with "FILE TOPDIR SPECFILE" command
+ -n Rename the package to include the revision number
+ -l Use subversion log to build rpm %changelog
+ -T FILE Template to be used to generate the %changelog
+ -h Show this message
+ --strict Check if the given revision contains changes in REPPKGURL
Examples:
repsys getsrpm python
@@ -73,6 +74,8 @@ def parse_options():
parser.add_option("-n", dest="revname", action="store_true")
parser.add_option("-l", dest="svnlog", action="store_true")
parser.add_option("-T", dest="template", type="string", default=None)
+ parser.add_option("--strict", dest="strict", default=False,
+ action="store_true")
opts, args = parser.parse_args()
del opts.__ignore
if len(args) != 1:
diff --git a/RepSys/rpmutil.py b/RepSys/rpmutil.py
index 45c9758..6fae669 100644
--- a/RepSys/rpmutil.py
+++ b/RepSys/rpmutil.py
@@ -33,6 +33,22 @@ def rpm_macros_defs(macros):
args = " ".join(defs)
return args
+def rev_touched_url(url, rev):
+ svn = SVN()
+ info = svn.info2(url)
+ if info is None:
+ raise Error, "can't fetch svn info about the URL: %s" % url
+ root = info["Repository Root"]
+ urlpath = url[len(root):]
+ touched = False
+ entries = svn.log(root, start=rev, limit=1)
+ entry = entries[0]
+ for change in entry.changed:
+ path = change.get("path")
+ if path and path.startswith(urlpath):
+ touched = True
+ return touched
+
def get_srpm(pkgdirurl,
mode = "current",
targetdirs = None,
@@ -46,7 +62,8 @@ def get_srpm(pkgdirurl,
submit = False,
template = None,
macros = [],
- verbose = 0):
+ verbose = 0,
+ strict = False):
svn = SVN()
tmpdir = tempfile.mktemp()
topdir = "--define '_topdir %s'" % tmpdir
@@ -66,6 +83,12 @@ def get_srpm(pkgdirurl,
geturl = os.path.join(pkgdirurl, "current")
else:
raise Error, "unsupported get_srpm mode: %s" % mode
+ strict = strict or config.getbool("submit", "strict-revision", False)
+ if strict and not rev_touched_url(geturl, revision):
+ #FIXME would be nice to have the revision number even when
+ # revision is None
+ raise Error, "the revision %s does not change anything "\
+ "inside %s" % (revision or "HEAD", geturl)
svn.export(geturl, tmpdir, rev=revision)
srpmsdir = os.path.join(tmpdir, "SRPMS")
os.mkdir(srpmsdir)