Skip to content

bstinsonmhk/centos-lookaside

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CentOS Infra lookaside upload script

This upload script is a fork of Fedora's.  The original version of the script was taken from https://git.fedorahosted.org/cgit/fedora-infrastructure.git/tree/scripts/upload.cgi (although I think that version might be a bit on the old side, but it does the job).

The script has been modified somewhat (ok, quite a lot) to fit CentOS' requirements.

Calling The Script:

Obviously, you need a valid client cert.  You then need to call the script with the right parameters.  Here's the parameters:

- name
- branch
- sha1sum
- file

name, branch, and sha1sum are mandatory.  name is the package name.  branch is the name of the branch.  sha1sum is a (lowercase) hex SHA1 checksum for the file.  If only these three parameters are provided, the script checks if there is a matching file uploaded.  If the file exists, the script returns the string "Available".  If the file does not exist, the script returns the string "Missing".

If the parameter file is passed, this parameter must be the contents of the file.  The uploaded file will be written to a temporary file, and the checksum of the file compared to the value of the sha1sum parameter.  If the sums match, the file is moved into position.

The script can be called using curl commands similar to the following.  The file mycert.pem contains the client's cert (and private key).

To upload a file (389-ds-base-1.3.1.6.tar.bz2 in the current directory):

curl --cert ./mycert.pem https://git.centos.org/sources/upload.cgi --form "name=389-ds-base" --form "branch=c7" --form "sha1sum=ce4e6293a996e1045bc8f75533418f3172b391ee" --form "file=@389-ds-base-1.3.1.6.tar.bz2"
File 389-ds-base-1.3.1.6.tar.bz2 size 3070988 SHA1 ce4e6293a996e1045bc8f75533418f3172b391ee stored OK

To check if a file exists:

curl --cert ./mycert.pem https://git.centos.org/sources/upload.cgi --form "name=389-ds-base" --form "branch=c7" --form "sha1sum=ce4e6293a996e1045bc8f75533418f3172b391ee"
Available

(on a normal end client, this would be handled by centpkg)

(centos' curl defaults to looking in a NSS db for a client cert; force the --cert arg to be a path - even a relative one like ./mycert.pem - to stop this behaviour)


Email Notification:

The script sends an email to a configured email address when a file is uploaded.  The script tries to send the mail via a configured mail relay.  By default, SELinux will block the script from connecting to port 25 on the configured mail server.  Set the httpd_can_network_connect boolean on to allow it.


Script Config File:

The upload script config file is /etc/lookaside.cfg.  There are config options for all the interesting values.  The script doesn't check the config syntax is correct, so missing / malformed values are likely to case python tracebacks.

About

This is a first-cut at the centos lookaside scripts for uploading non-text sources for building RPMS in the Community Build System

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages