Mailinglist Archive: opensuse-buildservice (314 mails)

< Previous Next >
[opensuse-buildservice] link_pac
  • From: JP Rosevear <jpr@xxxxxxxxxx>
  • Date: Wed, 30 Jan 2008 16:32:09 -0500
  • Message-id: <1201728729.28797.524.camel@xxxxxxxxxxxxxxxxxxxxx>
I wrote a plugin (attached) that compares two repos using the nice rdiff
command and if the packages are identical creates a link in the
destination repo (useful for doing your work in a repo, submitting to
autobuild and cleaning up later).

What I'm not sure though is how to guarantee the link is used instead of
the files in the project. Should I remove those files from the package
before creating the link? Could link_pac take an argument that removes
any existing files?

JP Rosevear <jpr@xxxxxxxxxx>
Novell, Inc.

# it might make sense to add an option to attempt to merge patches.

@cmdln.option('-d', '--dry-run', action='store_true', help='dry run, do not
link packages')
@cmdln.option('-f', '--diff', action='store_true', help='display diff')

def do_linksame(self, subcmd, opts, *args):
"""${cmd_name}: Link packages in one repo to another if they are the same

linksame openSUSE:Factory GNOME:UNSTABLE



# FIXME It sucks to hard code this, but...
nochange = '''
changes files:

spec files:

other changes:

args = slash_split(args)

if not args or len(args) < 2:
print >>sys.stderr, 'Incorrect number of argument.'
self.do_help([None, 'linksame'])
return 2

srcproject = args[0]
destproject = args[1]
if len(args) > 2:
packages = args[2:]
packages = meta_get_packagelist(conf.config['apiurl'], destproject)

for package in packages:
print "Checking %s: " % package,

rdiff = pretty_diff(conf.config['apiurl'],
srcproject, package, None,
destproject, package, None)
print "Unable to diff (no such package in source?)"

if rdiff == nochange:
if (not opts.dry_run):
link_pac (srcproject, package, destproject, package)
print "Identical, linked packages"
print "Differences, not linking packages"
if (opts.diff):
print "'" + rdiff + "'"


< Previous Next >