Permalink
Browse files

Initial import of CreativeCloudPackager providers from mosen-recipes

  • Loading branch information...
mosen committed Nov 9, 2016
1 parent dc017c3 commit b030c95d49238535dce98d96580f42d4994d4b15
Showing with 299 additions and 0 deletions.
  1. +162 −0 Adobe/CreativeCloudFeed.py
  2. +106 −0 Adobe/CreativeCloudPackager.py
  3. +31 −0 Adobe/PhotoshopCC2017.pkg.recipe
@@ -0,0 +1,162 @@
#!/usr/bin/python
#
# Copyright 2016 Mosen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import string
import json
import urllib2
from urllib import urlencode
from distutils.version import LooseVersion as LV
from autopkglib import Processor, ProcessorError
__all__ = ["CreativeCloudFeed"]
BASE_URL = 'https://prod-rel-ffc-ccm.oobesaas.adobe.com/adobe-ffc-external/core/v4/products/all'
# Sap Codes can be seen at https://helpx.adobe.com/creative-cloud/packager/apps-deployed-without-their-base-versions.html
class CreativeCloudFeed(Processor):
"""Fetch information about product(s) from the Creative Cloud products feed."""
description = __doc__
input_variables = {
"product_id": {
"required": True,
"description": "The product sap code"
},
"base_version": {
"required": True,
"description": "The base product version"
},
"channels": {
"required": False,
"default": "ccm",
"description": "The update feed channel(s), comma separated. (default is ccm)"
},
"platforms": {
"required": False,
"default": "osx10,osx10-64",
"desription": "The deployment platform(s), comma separated. (default is osx10,osx10-64)"
}
}
output_variables = {
"product_info_url": {
"description": "Product main information URL"
},
"icon_url": {
"description": "Icon download URL for the highest resolution available, normally 96x96."
},
"base_version": {
"description": "The basic (major.minor) version"
},
"version": {
"description": "The full length version"
},
"display_name": {
"description": "The product full name and major version"
},
"manifest_url": {
"description": "The URL to the product manifest"
},
"family": {
"description": "The product family"
},
"minimum_os_version": {
"description": "The minimum operating system version required to install this package"
}
}
def feed_url(self, channels, platforms):
"""Build the GET query parameters for the product feed."""
params = [
('payload', 'true'),
('productType', 'Desktop'),
('_type', 'json')
]
for ch in channels:
params.append(('channel', ch))
for pl in platforms:
params.append(('platform', pl))
return BASE_URL + '?' + urlencode(params)
def main(self):
product_id = self.env.get('product_id')
base_version = self.env.get('base_version')
channels = string.split(self.env.get('channels'), ',')
platforms = string.split(self.env.get('platforms'), ',')
url = self.feed_url(channels, platforms)
self.output('Fetching from feed URL: {}'.format(url))
req = urllib2.Request(url, headers={
'User-Agent': 'Creative Cloud',
'x-adobe-app-id': 'AUSST_4_0',
})
data = json.loads(urllib2.urlopen(req).read())
channel_data = {}
for channel in data['channel']:
if channel['name'] in channels:
channel_data[channel['name']] = channel
product = {'version': '1.0'}
for channel in data['channel']:
if channel['name'] not in channels:
continue
for prod in channel['products']['product']:
if prod['id'] != product_id:
continue
if prod['platforms']['platform'][0]['languageSet'][0].get('baseVersion') != base_version:
continue
if 'version' not in prod:
self.output('product has no version: {}'.format(prod['displayName']))
continue
# self.output('check if version: {} is greater than newest found product: {}'.format(prod['version'], product['version']))
if LV(prod['version']) > LV(product['version']):
product = prod
first_platform = {}
for platform in product['platforms']['platform']:
if platform['id'] in platforms:
first_platform = platform
break
if first_platform.get('packageType') == 'RIBS':
raise ProcessorError('This process does not support RIBS style packages.')
self.output('Found matching product {}, version: {}'.format(product.get('displayName'), product.get('version')))
compatibility_range = first_platform['systemCompatibility']['operatingSystem']['range'][0]
# output variable naming has been kept as close to pkginfo names as possible in order to feed munkiimport
self.env['minimum_os_version'] = compatibility_range.split('-')[0]
self.env['product_info_url'] = product.get('productInfoPage')
self.env['version'] = product.get('version')
self.env['display_name'] = product.get('displayName')
if __name__ == "__main__":
processor = CreativeCloudFeed()
processor.execute_shell()
@@ -0,0 +1,106 @@
#!/usr/bin/python
#
# Copyright 2016 Mosen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from autopkglib import Processor, ProcessorError
__all__ = ["CreativeCloudPackager"]
# https://helpx.adobe.com/creative-cloud/packager/ccp-automation.html
TEMPLATE_XML = """<CCPPackage>
<CreatePackage>
<packageName>${package_name}</packageName>
<packagingJobId>12345</packagingJobId>
<outputLocation>${output_location}</outputLocation>
<is64Bit>true</is64Bit>
<customerType>enterprise</customerType>
<organizationName>Concordia University, Quebec</organizationName>
<!-- ProductCategory should be left 'Custom' -->
<ProductCategory>Custom</ProductCategory>
<matchOSLanguage>true</matchOSLanguage>
<IncludeUpdates>false</IncludeUpdates>
<rumEnabled>true</rumEnabled>
<updatesEnabled>false</updatesEnabled>
<appsPanelEnabled>false</appsPanelEnabled>
<adminPrivilegesEnabled>false</adminPrivilegesEnabled>
<Language>
<id>en_US</id>
</Language>
<Products>
<Product>
<sapCode>${sap_code}</sapCode>
<version>${version}</version>
</Product>
</Products>
</CreatePackage>
</CCPPackage>
"""
class CreativeCloudPackager(Processor):
"""Create and execute a CCP automation file. The package output will always be the autopkg cache directory"""
description = __doc__
input_variables = {
"package_name": {
"required": True,
"description": "The output package name"
},
"customer_type": {
"required": True,
"description": "The license type 'enterprise' or 'team'"
},
"organization_name": {
"required": True,
"description": "The organization name which must match your licensed organization."
},
"serial_number": {
"required": False,
"description": "The serial number, if you are using serialized packages."
},
"include_updates": {
"required": False,
"default": True,
"description": "Include all available updates, defaults to true."
},
"language": {
"required": True,
"default": "en_US",
"description": "The language to build, defaults to en_US."
},
"rum_enabled": {
"required": False,
"default": True,
"description": "Include RUM in the package"
},
"updates_enabled": {
"required": False,
"default": True,
"description": "Enable updates"
},
"apps_panel_enabled": {
"required": False,
"default": True,
"description": "Enable access to the apps panel in the desktop application"
},
"admin_privileges_enabled": {
"required": False,
"default": False,
"description": "Allow the desktop application to run in privileged mode, so that standard users may install apps."
}
}
output_variables = {
}
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Description</key>
<string>Download the latest update for the specified major release of Lightroom</string>
<key>Identifier</key>
<string>com.github.mosen.pkg.PhotoshopCC2017</string>
<key>Input</key>
<dict>
<key>developer</key>
<string>Adobe</string>
</dict>
<key>MinimumVersion</key>
<string>0.2.0</string>
<key>Process</key>
<array>
<dict>
<key>Processor</key>
<string>CreativeCloudFeed</string>
<key>Arguments</key>
<dict>
<key>product_id</key>
<string>PHSP</string>
<key>base_version</key>
<string>18.0</string>
</dict>
</dict>
</array>
</dict>
</plist>

0 comments on commit b030c95

Please sign in to comment.