← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/launchpad/bug-741683 into lp:launchpad

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/bug-741683 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #741683 in Launchpad itself: "commercial-compat.sh will soon be obsolete"
  https://bugs.launchpad.net/launchpad/+bug/741683

For more details, see:
https://code.launchpad.net/~jtv/launchpad/bug-741683/+merge/69291

This script is no longer needed, now that Dapper and subsequent non-LTS releases have gone EOL.

Talked to iamfuzz & Ng; they concur that this script can go.

The commercial-compat.sh script is called from the cron.publish-ftpmaster script, but only if it actually exists.
-- 
https://code.launchpad.net/~jtv/launchpad/bug-741683/+merge/69291
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/bug-741683 into lp:launchpad.
=== modified file 'configs/development/launchpad-lazr.conf'
--- configs/development/launchpad-lazr.conf	2011-07-07 10:46:09 +0000
+++ configs/development/launchpad-lazr.conf	2011-07-26 14:44:58 +0000
@@ -8,10 +8,6 @@
 [archivepublisher]
 run_parts_location: none
 
-# XXX JeroenVermeulen 2011-03-29 bug=741683: Retire this item when
-# Dapper supports ends.
-run_commercial_compat: false
-
 [branchscanner]
 oops_prefix: BS
 error_dir: /var/tmp/codehosting.test

=== removed file 'cronscripts/publishing/commercial-compat.sh'
--- cronscripts/publishing/commercial-compat.sh	2010-06-25 14:36:11 +0000
+++ cronscripts/publishing/commercial-compat.sh	1970-01-01 00:00:00 +0000
@@ -1,134 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-# This script munges the partner component into a commercial pocket arrangement
-# for backwards compatibility with dapper, edgy and feisty.
-#
-# After running, <distroseries>-commercial will appear under dists.
-
-# LPCONFIG will come from the environment so this script can run unaltered
-# on dogfood.
-#
-# Authors:
-# Written by Fabio M Di Nitto, amended by Julian Edwards for production
-# and dogfood compatibility.
-#
-
-if [ -z $LPCONFIG ]; then
-    echo LPCONFIG must be set to run this script.
-    exit 1
-fi
-
-# Exit immediately on errors.
-set -e
-
-# Config goes here.
-PRODUCTION_CONFIG=ftpmaster-publish
-if [ "$LPCONFIG" = "$PRODUCTION_CONFIG" ]; then
-    archiveurl=/srv/launchpad.net/ubuntu-archive/ubuntu-partner
-else
-    archiveurl=/srv/launchpad.net/ppa/ubuntu-partner
-fi
-compatreleases="dapper edgy feisty"
-
-# Fix up a release file so it refers to packages in the -commercial pocket.
-fixrelease() {
-    in="$1"
-    out="$2"
-
-    descr=$(cat "$in" |grep ^Version: | sed -e 's#Version: ##g')
-
-    # Add -commercial suffix where required, force the component to main,
-    # and set Origin: and Label: to Canonical.
-    cat "$in" | sed \
-        -e 's#^Archive:.*#&-commercial#g' \
-        -e 's#^Component:.*#Component: main#g' \
-        -e 's#^Origin:.*#Origin: Canonical#g' \
-        -e 's#^Label:.*#Label: Canonical#g' \
-        -e 's#^Suite:.*#&-commercial#g' \
-        -e 's#^Codename:.*#&-commercial#g' \
-        -e 's#^Components:.*#Components: main#g' \
-        -e 's#^Description:.*#Description: Ubuntu '"$descr"' Commercial Software#g' \
-        -e 's#partner/#main/#g' \
-        > "$out"
-}
-
-# Fix the topmost Release file so that its referenced Release file sizes and
-# checksums are correct.
-fixtoprelease() {
-    in="$1"
-    out="$2"
-    release="$3"
-
-    hash=""
-    blank=""
-
-    # Here we read in a line, see what type of hash is being used, and then
-    # the line ending in "Release" is re-written.  Comments cannot go
-    # inside {} blocks so the four commands are explained here:
-    #   filename= : this will get the filename relative to the top level.
-    #   sum=      : this will calculate the new checksum according to which
-    #               one we're processing at the moment.
-    #   size=     : get the file's size.
-    #   printf    : output to the new Release file in the right format.
-    #
-    cat "$in" | { while read line; do
-        case "$line" in
-            MD5Sum:)
-                hash=md5
-                blank=" "
-                echo "MD5Sum:"
-            ;;
-            SHA1:)
-                hash=sha1
-                blank=" "
-                echo "SHA1:"
-            ;;
-            SHA256:)
-                hash=sha256
-                blank=" "
-                echo "SHA256:"
-            ;;
-            *Release)
-                filename=$(echo $line | awk '{print $3}')
-                sum="$(echo $(gpg --print-md $hash $i-commercial/$filename | cut -d ":" -f 2 | tr [A-Z] [a-z]) | sed -e 's/ //g')"
-                size="$(ls -ls $i-commercial/$filename | awk '{print $6}')"
-                printf " %s %*d %s\n" "$sum" 16 "$size" "$filename"
-            ;;
-            *)
-                echo "$blank$line"
-            ;;
-        esac
-    done; } > "$out"
-}
-
-# cd into the real archive or die.
-cd "$archiveurl/dists/" || exit 1
-
-# We do this only for distroseries that we need to process.
-for i in $compatreleases; do
-    if [ -d "$i" ]; then
-        # Nuke the old commercial pocket.
-        rm -rf "$i-commercial"
-        # Clone with the new one to import all the Packages and dir structure.
-        cp -rp "$i" "$i-commercial"
-        # Nuke the old signature that would be invalid anyway.
-        rm -f "$i-commercial/Release.gpg"
-        # Rename section from partner to main.
-        mv $i-commercial/partner $i-commercial/main
-        # Fix all Release files.
-        find "$i-commercial" -name "Release" | { while read line; do
-            fixrelease $line $line.new
-            mv $line.new $line
-        done; }
-        # Top level needs more love (*sums, file size)
-        fixtoprelease "$i-commercial/Release" "$i-commercial/Release.new" "$i"
-        mv "$i-commercial/Release.new" "$i-commercial/Release"
-        # Sign the Release file
-        gpg --armour --output "$i-commercial/Release.gpg" --detach-sign "$i-commercial/Release"
-    fi
-done
-
-exit 0

=== modified file 'lib/canonical/config/schema-lazr.conf'
--- lib/canonical/config/schema-lazr.conf	2011-07-21 09:15:52 +0000
+++ lib/canonical/config/schema-lazr.conf	2011-07-26 14:44:58 +0000
@@ -34,11 +34,6 @@
 # datatype: string
 run_parts_location: none
 
-# XXX JeroenVermeulen 2011-03-29 bug=741683: Retire this item when
-# Dapper supports ends.
-# datatype: boolean
-run_commercial_compat: false
-
 
 [binaryfile_expire]
 dbuser: binaryfile-expire

=== modified file 'lib/lp/archivepublisher/scripts/publish_ftpmaster.py'
--- lib/lp/archivepublisher/scripts/publish_ftpmaster.py	2011-07-18 21:50:38 +0000
+++ lib/lp/archivepublisher/scripts/publish_ftpmaster.py	2011-07-26 14:44:58 +0000
@@ -427,25 +427,6 @@
             os.rename(backup_dists, dists)
             os.rename(temp_dists, backup_dists)
 
-    def runCommercialCompat(self):
-        """Generate the -commercial pocket.
-
-        This is done for backwards compatibility with dapper, edgy, and
-        feisty releases.  Failure here is not fatal.
-        """
-        # XXX JeroenVermeulen 2011-03-24 bug=741683: Retire
-        # commercial-compat.sh (and this method) as soon as Dapper
-        # support ends.
-        if self.distribution.name != 'ubuntu':
-            return
-        if not config.archivepublisher.run_commercial_compat:
-            return
-
-        env = {"LPCONFIG": shell_quote(config.instance_name)}
-        self.executeShell(
-            "env %s commercial-compat.sh"
-            % compose_env_string(env, extend_PATH()))
-
     def generateListings(self):
         """Create ls-lR.gz listings."""
         self.logger.debug("Creating ls-lR.gz...")
@@ -570,13 +551,11 @@
 
         self.rsyncBackupDists()
         self.publish(security_only=True)
-        self.runCommercialCompat()
         self.runFinalizeParts(security_only=True)
 
         if not self.options.security_only:
             self.rsyncBackupDists()
             self.publish(security_only=False)
-            self.runCommercialCompat()
             self.generateListings()
             self.clearEmptyDirs()
             self.runFinalizeParts(security_only=False)

=== modified file 'lib/lp/archivepublisher/tests/test_publish_ftpmaster.py'
--- lib/lp/archivepublisher/tests/test_publish_ftpmaster.py	2011-05-27 21:12:25 +0000
+++ lib/lp/archivepublisher/tests/test_publish_ftpmaster.py	2011-07-26 14:44:58 +0000
@@ -262,14 +262,6 @@
         self.assertEqual(1, len(sections))
         return dict(sections[0])
 
-    def enableCommercialCompat(self):
-        """Enable commercial-compat.sh runs for the duration of the test."""
-        config.push("commercial-compat", dedent("""\
-            [archivepublisher]
-            run_commercial_compat: true
-            """))
-        self.addCleanup(config.pop, "commercial-compat")
-
     def installRunPartsScript(self, distro, parts_dir, script_code):
         """Set up a run-parts script, and configure it to run.
 
@@ -506,38 +498,6 @@
         missing_parameters = required_parameters.difference(set(env.keys()))
         self.assertEqual(set(), missing_parameters)
 
-    def test_runCommercialCompat_runs_commercial_compat_script(self):
-        # XXX JeroenVermeulen 2011-03-29 bug=741683: Retire
-        # runCommercialCompat as soon as Dapper support ends.
-        self.enableCommercialCompat()
-        script = self.makeScript(self.prepareUbuntu())
-        script.setUp()
-        script.executeShell = FakeMethod()
-        script.runCommercialCompat()
-        self.assertEqual(1, script.executeShell.call_count)
-        args, kwargs = script.executeShell.calls[0]
-        command_line, = args
-        self.assertIn("commercial-compat.sh", command_line)
-
-    def test_runCommercialCompat_runs_only_for_ubuntu(self):
-        # XXX JeroenVermeulen 2011-03-29 bug=741683: Retire
-        # runCommercialCompat as soon as Dapper support ends.
-        self.enableCommercialCompat()
-        script = self.makeScript(self.makeDistroWithPublishDirectory())
-        script.setUp()
-        script.executeShell = FakeMethod()
-        script.runCommercialCompat()
-        self.assertEqual(0, script.executeShell.call_count)
-
-    def test_runCommercialCompat_runs_only_if_configured(self):
-        # XXX JeroenVermeulen 2011-03-29 bug=741683: Retire
-        # runCommercialCompat as soon as Dapper support ends.
-        script = self.makeScript(self.prepareUbuntu())
-        script.setUp()
-        script.executeShell = FakeMethod()
-        script.runCommercialCompat()
-        self.assertEqual(0, script.executeShell.call_count)
-
     def test_generateListings_writes_ls_lR_gz(self):
         distro = self.makeDistroWithPublishDirectory()
         script = self.makeScript(distro)


Follow ups