build_rpm(build)
+def get_sysd_commit():
+ """Get latest Int/Pack repo commit hash"""
+
+ int_pack_repo = "https://github.com/opendaylight/integration-packaging.git"
+ # Get the commit hash at the tip of the master branch
+ args_git = ['git', 'ls-remote', int_pack_repo, "HEAD"]
+ args_awk = ['awk', '{print $1}']
+ references = subprocess.Popen(args_git, stdout=subprocess.PIPE,
+ shell=False)
+ sysd_commit = subprocess.check_output(args_awk, stdin=references.stdout,
+ shell=False).strip()
+
+ return sysd_commit
+
+
# When run as a script, accept a set of builds and execute them
if __name__ == "__main__":
# Load RPM build variables from a YAML config file
builds = []
# Check if `changelog_date` has been passed as an arg
- # The current datetime should be the default date for RPM changelog dates
+ # The current datetime should be the default date for RPM changelog date
# but can still accept optional `changelog_date` param
# `changelog_date` is in the format: 'Sat Dec 10 2016'
# Docs:
if not args.changelog_date:
args.changelog_date = datetime.date.today().strftime("%a %b %d %Y")
+ # Check if `sysd_commit` has been passed as an arg
+ # Use latest Int/Pack repo commit hash as sysd_commit var
+ # unless passed by param
+ if not args.sysd_commit:
+ args.sysd_commit = get_sysd_commit()
+
if args.version:
# Build a list of requested versions as dicts of version components
versions = []
"download_url": args.download_url
})
- # If download_url is given, get version info
+ # If download_url is given, update version info
if args.download_url:
version = extract_version(args.download_url)
build.update(version)