├── yast ├── VERSION ├── RPMNAME ├── package │ └── .cvsignore ├── testsuite │ ├── tests │ │ └── .cvsignore │ ├── .gitignore │ ├── .cvsignore │ └── Makefile.am ├── doc │ ├── .cvsignore │ └── Makefile.am ├── MAINTAINER ├── agents │ ├── .cvsignore │ ├── Makefile.am │ ├── smt.scr │ ├── smt_conf.scr │ └── smt_cron.scr ├── src │ ├── .cvsignore │ ├── control │ │ └── smt_control.xml │ ├── desktop │ │ ├── smt.desktop │ │ ├── smt-server.desktop │ │ └── smt-wizard.desktop │ ├── clients │ │ ├── smt-wizard.rb │ │ ├── smt.rb │ │ └── smt-server.rb │ └── Makefile.am ├── icons │ ├── 16x16 │ │ ├── yast-smt.png │ │ └── Makefile.am │ ├── 22x22 │ │ ├── yast-smt.png │ │ └── Makefile.am │ ├── 32x32 │ │ ├── yast-smt.png │ │ └── Makefile.am │ ├── 48x48 │ │ ├── yast-smt.png │ │ └── Makefile.am │ ├── 128x128 │ │ ├── yast-smt.png │ │ └── Makefile.am │ ├── Makefile.am │ ├── client_status │ │ ├── Makefile.am │ │ ├── client-updates-available.xpm │ │ ├── client-up-to-date.xpm │ │ ├── repo-up-to-date.xpm │ │ ├── client-critical.xpm │ │ └── repo-not-up-to-date.xpm │ └── patch_status │ │ ├── Makefile.am │ │ ├── patch-remove.xpm │ │ ├── patch-not-used.xpm │ │ ├── patch-use.xpm │ │ └── patch-used.xpm ├── README ├── Rakefile ├── configure.in.in ├── .cvsignore ├── Makefile.cvs └── .gitignore ├── tests ├── integration │ ├── rspec │ │ ├── spec │ │ │ ├── support │ │ │ │ └── aruba.rb │ │ │ ├── spec_helper.rb │ │ │ ├── smt_server │ │ │ │ └── smt_server_spec.rb │ │ │ └── smt_client │ │ │ │ └── smt_client_spec.rb │ │ └── Gemfile │ ├── .gitignore │ ├── .env.example │ ├── smt_client │ │ ├── files │ │ │ └── run.sh │ │ └── Dockerfile │ ├── docker-compose.yml │ ├── smt_server │ │ ├── Dockerfile │ │ └── files │ │ │ ├── p1.patch │ │ │ └── run.sh │ ├── README.md │ └── Jenkinsfile ├── testdata │ ├── rpmmdtest │ │ ├── code11repo │ │ │ ├── repodata │ │ │ │ ├── other.xml.gz │ │ │ │ ├── primary.xml.gz │ │ │ │ ├── deltainfo.xml.gz │ │ │ │ ├── filelists.xml.gz │ │ │ │ ├── susedata.xml.gz │ │ │ │ ├── updateinfo.xml.gz │ │ │ │ └── repomd.xml │ │ │ └── rpm │ │ │ │ ├── ppc │ │ │ │ ├── audacity-1.3.5-49.12.1.ppc.rpm │ │ │ │ ├── sudo-1.6.9p17-10.36.1.ppc.rpm │ │ │ │ ├── imap-lib-2006c1_suse-127.1.ppc.rpm │ │ │ │ ├── perl-DBD-mysql-4.010-1.1.1.ppc.rpm │ │ │ │ ├── imap-devel-2006c1_suse-127.1.ppc.rpm │ │ │ │ ├── audacity-1.3.5-49.10_49.12.1.ppc.delta.rpm │ │ │ │ ├── sudo-1.6.9p17-10.29_10.36.1.ppc.delta.rpm │ │ │ │ ├── imap-devel-2006c1_suse-67.20_127.1.ppc.delta.rpm │ │ │ │ ├── imap-lib-2006c1_suse-67.20_127.1.ppc.delta.rpm │ │ │ │ └── perl-DBD-mysql-4.008_4.010-1.25_1.1.1.ppc.delta.rpm │ │ │ │ ├── src │ │ │ │ ├── audacity-1.3.5-49.12.1.src.rpm │ │ │ │ ├── imap-2006c1_suse-127.1.src.rpm │ │ │ │ ├── logwatch-7.3.6-60.6.1.src.rpm │ │ │ │ ├── sudo-1.6.9p17-10.36.1.src.rpm │ │ │ │ └── perl-DBD-mysql-4.010-1.1.1.src.rpm │ │ │ │ ├── i586 │ │ │ │ ├── audacity-1.3.5-49.12.1.i586.rpm │ │ │ │ ├── sudo-1.6.9p17-10.36.1.i586.rpm │ │ │ │ ├── imap-devel-2006c1_suse-127.1.i586.rpm │ │ │ │ ├── imap-lib-2006c1_suse-127.1.i586.rpm │ │ │ │ ├── perl-DBD-mysql-4.010-1.1.1.i586.rpm │ │ │ │ ├── sudo-1.6.9p17-10.30_10.36.1.i586.delta.rpm │ │ │ │ ├── audacity-1.3.5-49.11_49.12.1.i586.delta.rpm │ │ │ │ ├── imap-lib-2006c1_suse-67.26_127.1.i586.delta.rpm │ │ │ │ ├── imap-devel-2006c1_suse-67.26_127.1.i586.delta.rpm │ │ │ │ └── perl-DBD-mysql-4.008_4.010-1.28_1.1.1.i586.delta.rpm │ │ │ │ ├── noarch │ │ │ │ ├── logwatch-7.3.6-60.6.1.noarch.rpm │ │ │ │ └── logwatch-7.3.6-60.5_60.6.1.noarch.delta.rpm │ │ │ │ └── x86_64 │ │ │ │ ├── sudo-1.6.9p17-10.36.1.x86_64.rpm │ │ │ │ ├── audacity-1.3.5-49.12.1.x86_64.rpm │ │ │ │ ├── imap-lib-2006c1_suse-127.1.x86_64.rpm │ │ │ │ ├── perl-DBD-mysql-4.010-1.1.1.x86_64.rpm │ │ │ │ ├── imap-devel-2006c1_suse-127.1.x86_64.rpm │ │ │ │ ├── audacity-1.3.5-49.11_49.12.1.x86_64.delta.rpm │ │ │ │ ├── sudo-1.6.9p17-10.35_10.36.1.x86_64.delta.rpm │ │ │ │ ├── imap-lib-2006c1_suse-67.26_127.1.x86_64.delta.rpm │ │ │ │ ├── imap-devel-2006c1_suse-67.26_127.1.x86_64.delta.rpm │ │ │ │ └── perl-DBD-mysql-4.008_4.010-1.33_1.1.1.x86_64.delta.rpm │ │ └── sharedpkgs │ │ │ └── repodata │ │ │ ├── primary.xml.gz │ │ │ ├── updateinfo.xml.gz │ │ │ └── repomd.xml │ └── regdatatest │ │ ├── productcatalogs.xml │ │ ├── productdep.xml │ │ ├── targets.xml │ │ ├── catalogs.xml │ │ └── registrations.xml ├── SMT │ ├── Patch.pl │ ├── Parser │ │ ├── ParseListReg.pl │ │ ├── NU.pl │ │ ├── FilteredRepoChecker.pl │ │ ├── RpmMdPrimaryFilter.pl │ │ └── RpmMdOtherFilter.pl │ ├── Mirror │ │ ├── Job.pl │ │ ├── RpmMd.pl │ │ ├── RpmMdWithFilter.pl │ │ └── update-regdata.pl │ └── Filter.pl ├── tests.pl └── 01-compile-test.sh ├── doc ├── Links.txt ├── Breakout API 15.odt ├── SMT-Database-Schema.odg ├── High-Level-Architecture.odp ├── Registrationdata-NCC-YEP.odt ├── NCC-Client-Registration-via-YEP.odt ├── Web Renewals SMT Requirements 3_20.odt ├── SMT-MySQL-Commands.txt ├── SMT-Database-Upgrade.txt ├── Use-smt-User-for-commands.txt ├── Server-Tuning.txt ├── mail-Questions-about-the-Breakout-API.txt ├── Testplan-SLE11-SP3-SCC.txt ├── obs-maintenance-request.md └── yep-design-1.txt ├── db ├── schemas │ └── mysql │ │ ├── 2.03-3.00 │ │ ├── 300-Patches.sql │ │ └── 100-drop-migration-schema-log.sql │ │ ├── 2.04-3.01 │ │ ├── 300-Patches.sql │ │ └── 100-drop-migration-schema-log.sql │ │ ├── 2.05-3.02 │ │ ├── 300-Patches.sql │ │ ├── 100-drop-migration-schema-log.sql │ │ ├── 110-create-drop_index_if_exists-proc.sql │ │ └── 400-fix-index-names.sql │ │ ├── 2.06-3.03 │ │ ├── 300-Patches.sql │ │ ├── 100-drop-migration-schema-log.sql │ │ ├── 999-convert-Patches-table-to-utf8.sql │ │ ├── 110-create-drop_index_if_exists-proc.sql │ │ └── 400-fix-index-names.sql │ │ ├── 2.07-3.04 │ │ ├── 300-Patches.sql │ │ ├── 100-drop-migration-schema-log.sql │ │ ├── 999-convert-Patches-table-to-utf8.sql │ │ ├── 110-create-drop_index_if_exists-proc.sql │ │ └── 400-fix-index-names.sql │ │ ├── 3.06-3.07 │ │ ├── 300-modify-Products-schema.sql │ │ ├── 100-modify-ProductMigrations-schema.sql │ │ └── 200-update-ProductMigrations-entries.sql │ │ ├── 3.05-3.06 │ │ ├── 200-update-ProductExtensions-entries.sql │ │ ├── 300-add-new-ProductExtensions-indices.sql │ │ └── 100-modify-ProductExtensions-schema.sql │ │ ├── 3.08-3.09 │ │ └── 100-modify-Patches-schema.sql │ │ ├── 2.05-2.06 │ │ └── 100-add-shortname-column.sql │ │ ├── 3.02-3.03 │ │ ├── 100-add-shortname-column.sql │ │ └── 999-convert-Patches-table-to-utf8.sql │ │ ├── 3.09-3.10 │ │ └── 100-modify-Catalogs-EXTURL-schema.sql │ │ ├── 2.06-2.07 │ │ ├── 101-add-release_stage-column.sql │ │ ├── 100-add-installer_updates-column.sql │ │ └── 102-modify-Packages-columns.sql │ │ ├── 3.03-3.04 │ │ ├── 101-add-release_stage-column.sql │ │ ├── 100-add-installer_updates-column.sql │ │ └── 102-modify-Packages-columns.sql │ │ ├── 3.04-3.05 │ │ └── 001-convert-PatchRefs-table-to-utf8.sql │ │ ├── 3.10-3.11 │ │ └── 100-modify-Subscriptions-schema.sql │ │ ├── 2.04-2.05 │ │ ├── 200-add-index-on-ProductExtensions.sql │ │ └── 100-create-ProductMigrations.sql │ │ ├── 3.07-3.08 │ │ └── 100-modify-Subscriptions-schema.sql │ │ ├── 2.03-2.04 │ │ └── 100-add-systemid-to-clients.sql │ │ ├── 3.00-3.01 │ │ └── 100-add-systemid-to-clients.sql │ │ └── 3.01-3.02 │ │ ├── 100-create-ProductMigrations.sql │ │ └── 110-create-drop_index_if_exists-proc.sql └── README-DB-IMPORT ├── runtimerequires.sh ├── performance ├── performance-empty-db.ods └── launch.sh ├── config ├── tmpfile-smt.conf ├── smt.target ├── smt.service ├── smt-schema-upgrade.service ├── smt.reg └── installation.xml ├── swig ├── GRP.i ├── ptest.pl └── Makefile ├── devel-scripts ├── testcases │ ├── README │ ├── test1 │ │ └── machinedata.sql │ ├── test2 │ │ └── machinedata.sql │ ├── test7 │ │ └── machinedata.sql │ └── test8 │ │ └── machinedata.sql ├── findProductsWithoutCatalogs.sh ├── testInsertPatchstatusJob.pl ├── reset.sh ├── quickRESTUpdate.pl ├── testClientAuthentication.pl ├── relations-test.pl ├── testClientQueries.pl ├── relations-compare.pl ├── jobapitest.pl └── client-compare.pl ├── xml ├── examples │ ├── product.xml │ ├── repo.xml │ ├── repos.xml │ └── patch.xml ├── product.rnc ├── repos.rnc ├── patches.rnc ├── products.rnc ├── repo.rnc └── patch.rnc ├── client ├── logrotate │ └── smt-client ├── package │ ├── smt-client-rpmlintrc │ └── sysconfig.smt-client ├── README ├── script │ ├── reboot │ ├── servererror │ ├── execute │ ├── report │ ├── eject │ └── smt-agent └── perl-lib │ └── SMT │ └── Agent │ └── Constants.pm ├── www ├── perl-lib │ ├── SMT.pm │ └── SMT │ │ ├── Utils │ │ └── RequestAgent.pm │ │ ├── Client │ │ └── exampleVerify.pm │ │ ├── RESTInfo.pm │ │ ├── ConnectAPI.pm │ │ ├── Error.pm │ │ └── Job │ │ └── Constants.pm └── repo │ └── res-signingkeys.key ├── logrotate └── smt ├── package └── smt-rpmlintrc ├── add-on ├── content ├── Makefile ├── installation.xml └── README ├── apache2 ├── conf.d │ ├── smt_support.conf │ ├── nu_server.conf │ └── smt_mod_perl.conf └── smt-mod_perl-startup.pl ├── cron ├── novell.com-smt ├── smt-run-jobqueue-cleanup ├── smt-cron.conf ├── smt-repeated-register ├── smt-gen-report └── smt-daily ├── script ├── smt-version ├── reschedule-sync.sh └── smt-sync ├── HACKING ├── performance2 ├── README ├── repeatedStart.pl └── launch.sh ├── README ├── .gitignore └── RELEASENOTES--Update-issues /yast/VERSION: -------------------------------------------------------------------------------- 1 | 3.0.49 2 | -------------------------------------------------------------------------------- /yast/RPMNAME: -------------------------------------------------------------------------------- 1 | yast2-smt 2 | -------------------------------------------------------------------------------- /yast/package/.cvsignore: -------------------------------------------------------------------------------- 1 | *.bz2 2 | -------------------------------------------------------------------------------- /yast/testsuite/tests/.cvsignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /yast/doc/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /yast/MAINTAINER: -------------------------------------------------------------------------------- 1 | Lukas Ocilka 2 | -------------------------------------------------------------------------------- /yast/agents/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | -------------------------------------------------------------------------------- /yast/src/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | *.ybc 4 | .dep 5 | -------------------------------------------------------------------------------- /tests/integration/rspec/spec/support/aruba.rb: -------------------------------------------------------------------------------- 1 | require 'aruba/rspec' 2 | -------------------------------------------------------------------------------- /tests/integration/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | smt_server/files/smt_current.rpm 3 | -------------------------------------------------------------------------------- /yast/testsuite/.gitignore: -------------------------------------------------------------------------------- 1 | config 2 | run 3 | *.test 4 | site.exp 5 | *.sum 6 | -------------------------------------------------------------------------------- /doc/Links.txt: -------------------------------------------------------------------------------- 1 | 2 | http://perl.apache.org/docs/2.0/index.html 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /doc/Breakout API 15.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/doc/Breakout API 15.odt -------------------------------------------------------------------------------- /doc/SMT-Database-Schema.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/doc/SMT-Database-Schema.odg -------------------------------------------------------------------------------- /yast/icons/16x16/yast-smt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/yast/icons/16x16/yast-smt.png -------------------------------------------------------------------------------- /yast/icons/22x22/yast-smt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/yast/icons/22x22/yast-smt.png -------------------------------------------------------------------------------- /yast/icons/32x32/yast-smt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/yast/icons/32x32/yast-smt.png -------------------------------------------------------------------------------- /yast/icons/48x48/yast-smt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/yast/icons/48x48/yast-smt.png -------------------------------------------------------------------------------- /doc/High-Level-Architecture.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/doc/High-Level-Architecture.odp -------------------------------------------------------------------------------- /doc/Registrationdata-NCC-YEP.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/doc/Registrationdata-NCC-YEP.odt -------------------------------------------------------------------------------- /yast/README: -------------------------------------------------------------------------------- 1 | How to install this YaST module? 2 | > make -f Makefile.cvs 3 | > make 4 | > make install 5 | -------------------------------------------------------------------------------- /yast/icons/128x128/yast-smt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/yast/icons/128x128/yast-smt.png -------------------------------------------------------------------------------- /db/schemas/mysql/2.03-3.00/300-Patches.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Patches MODIFY COLUMN DESCRIPTION TEXT NOT NULL; 2 | 3 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.04-3.01/300-Patches.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Patches MODIFY COLUMN DESCRIPTION TEXT NOT NULL; 2 | 3 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.05-3.02/300-Patches.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Patches MODIFY COLUMN DESCRIPTION TEXT NOT NULL; 2 | 3 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.06-3.03/300-Patches.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Patches MODIFY COLUMN DESCRIPTION TEXT NOT NULL; 2 | 3 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.07-3.04/300-Patches.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Patches MODIFY COLUMN DESCRIPTION TEXT NOT NULL; 2 | 3 | -------------------------------------------------------------------------------- /runtimerequires.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cat package/smt.spec | grep "^Requires" | awk '{print $2 }' | xargs 3 | 4 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.03-3.00/100-drop-migration-schema-log.sql: -------------------------------------------------------------------------------- 1 | 2 | drop table if exists migration_schema_log; 3 | 4 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.04-3.01/100-drop-migration-schema-log.sql: -------------------------------------------------------------------------------- 1 | 2 | drop table if exists migration_schema_log; 3 | 4 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.05-3.02/100-drop-migration-schema-log.sql: -------------------------------------------------------------------------------- 1 | 2 | drop table if exists migration_schema_log; 3 | 4 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.06-3.03/100-drop-migration-schema-log.sql: -------------------------------------------------------------------------------- 1 | 2 | drop table if exists migration_schema_log; 3 | 4 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.07-3.04/100-drop-migration-schema-log.sql: -------------------------------------------------------------------------------- 1 | 2 | drop table if exists migration_schema_log; 3 | 4 | -------------------------------------------------------------------------------- /performance/performance-empty-db.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/performance/performance-empty-db.ods -------------------------------------------------------------------------------- /db/schemas/mysql/3.06-3.07/300-modify-Products-schema.sql: -------------------------------------------------------------------------------- 1 | alter table Products add column FREE boolean default false; 2 | -------------------------------------------------------------------------------- /doc/NCC-Client-Registration-via-YEP.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/doc/NCC-Client-Registration-via-YEP.odt -------------------------------------------------------------------------------- /db/schemas/mysql/3.05-3.06/200-update-ProductExtensions-entries.sql: -------------------------------------------------------------------------------- 1 | update ProductExtensions set ROOTPRODUCTID = PRODUCTID; 2 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.08-3.09/100-modify-Patches-schema.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Patches 2 | MODIFY COLUMN DESCRIPTION MEDIUMTEXT; 3 | -------------------------------------------------------------------------------- /doc/Web Renewals SMT Requirements 3_20.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/doc/Web Renewals SMT Requirements 3_20.odt -------------------------------------------------------------------------------- /tests/integration/rspec/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'rspec', '~> 3.5' 4 | gem 'aruba', '~> 0.14.2' 5 | -------------------------------------------------------------------------------- /config/tmpfile-smt.conf: -------------------------------------------------------------------------------- 1 | # create /var/run/smt directory with permissions 0775 owned by smt:www 2 | d /var/run/smt 0775 smt www 3 | -------------------------------------------------------------------------------- /db/README-DB-IMPORT: -------------------------------------------------------------------------------- 1 | Dump old SMT database. Data only: 2 | 3 | $> mysqldump -u -p --no-create-info smt > smt-dump.sql 4 | 5 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.05-2.06/100-add-shortname-column.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Products ADD COLUMN SHORTNAME VARCHAR(255) NOT NULL DEFAULT ''; 2 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.02-3.03/100-add-shortname-column.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Products ADD COLUMN SHORTNAME VARCHAR(255) NOT NULL DEFAULT ''; 2 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.09-3.10/100-modify-Catalogs-EXTURL-schema.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Catalogs 2 | MODIFY COLUMN EXTURL varchar(2048); 3 | 4 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.06-2.07/101-add-release_stage-column.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Products ADD COLUMN RELEASE_STAGE VARCHAR(255) NOT NULL DEFAULT ''; 2 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.03-3.04/101-add-release_stage-column.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Products ADD COLUMN RELEASE_STAGE VARCHAR(255) NOT NULL DEFAULT ''; 2 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.06-3.07/100-modify-ProductMigrations-schema.sql: -------------------------------------------------------------------------------- 1 | alter table ProductMigrations add column KIND enum('online', 'offline'); 2 | -------------------------------------------------------------------------------- /yast/icons/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am for icons 3 | # 4 | 5 | SUBDIRS = 16x16 22x22 32x32 48x48 128x128 client_status patch_status 6 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.06-2.07/100-add-installer_updates-column.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE ProductCatalogs ADD COLUMN INSTALLER_UPDATES CHAR(1) DEFAULT 'N'; 2 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.06-3.03/999-convert-Patches-table-to-utf8.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Patches CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci; 2 | 3 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.07-3.04/999-convert-Patches-table-to-utf8.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Patches CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci; 2 | 3 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.02-3.03/999-convert-Patches-table-to-utf8.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Patches CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci; 2 | 3 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.03-3.04/100-add-installer_updates-column.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE ProductCatalogs ADD COLUMN INSTALLER_UPDATES CHAR(1) DEFAULT 'N'; 2 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.04-3.05/001-convert-PatchRefs-table-to-utf8.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE PatchRefs CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci; 2 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.10-3.11/100-modify-Subscriptions-schema.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Subscriptions 2 | MODIFY COLUMN PRODUCT_CLASS varchar(512); 3 | 4 | -------------------------------------------------------------------------------- /swig/GRP.i: -------------------------------------------------------------------------------- 1 | %module "Sys::GRP" 2 | 3 | %{ 4 | #include 5 | %} 6 | 7 | extern int initgroups (const char *user, unsigned int group); 8 | 9 | -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/repodata/other.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/repodata/other.xml.gz -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/repodata/primary.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/repodata/primary.xml.gz -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/sharedpkgs/repodata/primary.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/sharedpkgs/repodata/primary.xml.gz -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/repodata/deltainfo.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/repodata/deltainfo.xml.gz -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/repodata/filelists.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/repodata/filelists.xml.gz -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/repodata/susedata.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/repodata/susedata.xml.gz -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/repodata/updateinfo.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/repodata/updateinfo.xml.gz -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/sharedpkgs/repodata/updateinfo.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/sharedpkgs/repodata/updateinfo.xml.gz -------------------------------------------------------------------------------- /yast/testsuite/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | site.exp 4 | *.sum 5 | *.log 6 | tmp.out* 7 | tmp.err* 8 | tmp.log* 9 | config 10 | run 11 | *.test 12 | -------------------------------------------------------------------------------- /yast/Rakefile: -------------------------------------------------------------------------------- 1 | require "yast/rake" 2 | 3 | Yast::Tasks.configuration do |conf| 4 | #lets ignore license check for now 5 | conf.skip_license_check << /.*/ 6 | end 7 | -------------------------------------------------------------------------------- /devel-scripts/testcases/README: -------------------------------------------------------------------------------- 1 | 2 | testcases for smt-report 3 | 4 | $> cat *.sql | mysql -usmt -p smt 5 | Password:... 6 | $> smt-report --nonccsync [--local|--ncc] 7 | 8 | -------------------------------------------------------------------------------- /xml/examples/product.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.04-2.05/200-add-index-on-ProductExtensions.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX IF NOT EXISTS ProductExtensions_pdid_extid_src_idx ON ProductExtensions (PRODUCTID, EXTENSIONID, SRC); 2 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.07-3.08/100-modify-Subscriptions-schema.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Subscriptions 2 | MODIFY COLUMN SUBNAME varchar(256), 3 | MODIFY COLUMN PRODUCT_CLASS varchar(256); 4 | 5 | -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/ppc/audacity-1.3.5-49.12.1.ppc.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/ppc/audacity-1.3.5-49.12.1.ppc.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/ppc/sudo-1.6.9p17-10.36.1.ppc.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/ppc/sudo-1.6.9p17-10.36.1.ppc.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/src/audacity-1.3.5-49.12.1.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/src/audacity-1.3.5-49.12.1.src.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/src/imap-2006c1_suse-127.1.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/src/imap-2006c1_suse-127.1.src.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/src/logwatch-7.3.6-60.6.1.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/src/logwatch-7.3.6-60.6.1.src.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/src/sudo-1.6.9p17-10.36.1.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/src/sudo-1.6.9p17-10.36.1.src.rpm -------------------------------------------------------------------------------- /yast/doc/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for smt/doc 2 | 3 | SUBDIRS = 4 | 5 | htmldir = $(docdir) 6 | 7 | doc_DATA = 8 | html_DATA = 9 | 10 | EXTRA_DIST = $(doc_DATA) $(html_DATA) 11 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.03-2.04/100-add-systemid-to-clients.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Clients ADD COLUMN SYSTEMID INT UNSIGNED ; 2 | 3 | ALTER TABLE Clients ADD INDEX Clients_systemid_idx (SYSTEMID); 4 | 5 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.00-3.01/100-add-systemid-to-clients.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Clients ADD COLUMN SYSTEMID INT UNSIGNED ; 2 | 3 | ALTER TABLE Clients ADD INDEX Clients_systemid_idx (SYSTEMID); 4 | 5 | -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/i586/audacity-1.3.5-49.12.1.i586.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/i586/audacity-1.3.5-49.12.1.i586.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/i586/sudo-1.6.9p17-10.36.1.i586.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/i586/sudo-1.6.9p17-10.36.1.i586.rpm -------------------------------------------------------------------------------- /yast/agents/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for smt/agents 2 | 3 | agent_SCRIPTS = $(wildcard ag_*) 4 | 5 | scrconf_DATA = $(wildcard *.scr) 6 | 7 | EXTRA_DIST = $(agent_SCRIPTS) $(scrconf_DATA) 8 | -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/noarch/logwatch-7.3.6-60.6.1.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/noarch/logwatch-7.3.6-60.6.1.noarch.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/ppc/imap-lib-2006c1_suse-127.1.ppc.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/ppc/imap-lib-2006c1_suse-127.1.ppc.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/ppc/perl-DBD-mysql-4.010-1.1.1.ppc.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/ppc/perl-DBD-mysql-4.010-1.1.1.ppc.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/src/perl-DBD-mysql-4.010-1.1.1.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/src/perl-DBD-mysql-4.010-1.1.1.src.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/x86_64/sudo-1.6.9p17-10.36.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/x86_64/sudo-1.6.9p17-10.36.1.x86_64.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/i586/imap-devel-2006c1_suse-127.1.i586.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/i586/imap-devel-2006c1_suse-127.1.i586.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/i586/imap-lib-2006c1_suse-127.1.i586.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/i586/imap-lib-2006c1_suse-127.1.i586.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/i586/perl-DBD-mysql-4.010-1.1.1.i586.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/i586/perl-DBD-mysql-4.010-1.1.1.i586.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/ppc/imap-devel-2006c1_suse-127.1.ppc.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/ppc/imap-devel-2006c1_suse-127.1.ppc.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/x86_64/audacity-1.3.5-49.12.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/x86_64/audacity-1.3.5-49.12.1.x86_64.rpm -------------------------------------------------------------------------------- /client/logrotate/smt-client: -------------------------------------------------------------------------------- 1 | /var/log/smtclient.log { 2 | compress 3 | missingok 4 | notifempty 5 | maxage 365 6 | rotate 8 7 | size 4096k 8 | #create 0600 root root 9 | } 10 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.06-3.07/200-update-ProductMigrations-entries.sql: -------------------------------------------------------------------------------- 1 | update ProductMigrations set KIND = 'online'; 2 | alter table ProductMigrations change column KIND KIND enum('online', 'offline') not null; 3 | -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/x86_64/imap-lib-2006c1_suse-127.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/x86_64/imap-lib-2006c1_suse-127.1.x86_64.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/x86_64/perl-DBD-mysql-4.010-1.1.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/x86_64/perl-DBD-mysql-4.010-1.1.1.x86_64.rpm -------------------------------------------------------------------------------- /www/perl-lib/SMT.pm: -------------------------------------------------------------------------------- 1 | 2 | package SMT; 3 | use strict; 4 | use warnings; 5 | 6 | use vars qw($SCHEMA_VERSION $SMT_VERSION); 7 | 8 | $SCHEMA_VERSION = 3.11; 9 | $SMT_VERSION = '3.0.53'; 10 | 11 | 1; 12 | -------------------------------------------------------------------------------- /client/package/smt-client-rpmlintrc: -------------------------------------------------------------------------------- 1 | addFilter("no-binary") 2 | addFilter("non-standard-uid /var/log/smt.*") 3 | addFilter("no-manual-page-for-binary smt-agent") 4 | addFilter("perl5-naming-policy-not-applied .*") 5 | -------------------------------------------------------------------------------- /logrotate/smt: -------------------------------------------------------------------------------- 1 | /var/log/smt/smt-*.log { 2 | compress 3 | missingok 4 | notifempty 5 | maxage 365 6 | rotate 8 7 | size 4096k 8 | su smt www 9 | #create 0600 root root 10 | } 11 | -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/i586/sudo-1.6.9p17-10.30_10.36.1.i586.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/i586/sudo-1.6.9p17-10.30_10.36.1.i586.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/ppc/audacity-1.3.5-49.10_49.12.1.ppc.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/ppc/audacity-1.3.5-49.10_49.12.1.ppc.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/ppc/sudo-1.6.9p17-10.29_10.36.1.ppc.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/ppc/sudo-1.6.9p17-10.29_10.36.1.ppc.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/x86_64/imap-devel-2006c1_suse-127.1.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/x86_64/imap-devel-2006c1_suse-127.1.x86_64.rpm -------------------------------------------------------------------------------- /yast/icons/16x16/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am for icons/16x16 3 | # 4 | 5 | icondir = @themedir@/current/icons/16x16/apps 6 | 7 | icon_DATA = $(wildcard *.png ) 8 | 9 | EXTRA_DIST = $(icon_DATA) 10 | -------------------------------------------------------------------------------- /yast/icons/22x22/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am for icons/22x22 3 | # 4 | 5 | icondir = @themedir@/current/icons/22x22/apps 6 | 7 | icon_DATA = $(wildcard *.png ) 8 | 9 | EXTRA_DIST = $(icon_DATA) 10 | -------------------------------------------------------------------------------- /yast/icons/32x32/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am for icons/32x32 3 | # 4 | 5 | icondir = @themedir@/current/icons/32x32/apps 6 | 7 | icon_DATA = $(wildcard *.png ) 8 | 9 | EXTRA_DIST = $(icon_DATA) 10 | -------------------------------------------------------------------------------- /yast/icons/48x48/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am for icons/48x48 3 | # 4 | 5 | icondir = @themedir@/current/icons/48x48/apps 6 | 7 | icon_DATA = $(wildcard *.png ) 8 | 9 | EXTRA_DIST = $(icon_DATA) 10 | -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/i586/audacity-1.3.5-49.11_49.12.1.i586.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/i586/audacity-1.3.5-49.11_49.12.1.i586.delta.rpm -------------------------------------------------------------------------------- /yast/icons/128x128/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am for icons/128x128 3 | # 4 | 5 | icondir = @themedir@/current/icons/128x128/apps 6 | 7 | icon_DATA = $(wildcard *.png ) 8 | 9 | EXTRA_DIST = $(icon_DATA) 10 | -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/i586/imap-lib-2006c1_suse-67.26_127.1.i586.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/i586/imap-lib-2006c1_suse-67.26_127.1.i586.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/noarch/logwatch-7.3.6-60.5_60.6.1.noarch.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/noarch/logwatch-7.3.6-60.5_60.6.1.noarch.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/ppc/imap-devel-2006c1_suse-67.20_127.1.ppc.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/ppc/imap-devel-2006c1_suse-67.20_127.1.ppc.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/ppc/imap-lib-2006c1_suse-67.20_127.1.ppc.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/ppc/imap-lib-2006c1_suse-67.20_127.1.ppc.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/x86_64/audacity-1.3.5-49.11_49.12.1.x86_64.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/x86_64/audacity-1.3.5-49.11_49.12.1.x86_64.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/x86_64/sudo-1.6.9p17-10.35_10.36.1.x86_64.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/x86_64/sudo-1.6.9p17-10.35_10.36.1.x86_64.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/i586/imap-devel-2006c1_suse-67.26_127.1.i586.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/i586/imap-devel-2006c1_suse-67.26_127.1.i586.delta.rpm -------------------------------------------------------------------------------- /yast/icons/client_status/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am for icons/client_status 3 | # 4 | 5 | icondir = /usr/share/icons/hicolor/16x16/status 6 | 7 | icon_DATA = $(wildcard *.xpm ) 8 | 9 | EXTRA_DIST = $(icon_DATA) 10 | -------------------------------------------------------------------------------- /yast/icons/patch_status/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am for icons/client_status 3 | # 4 | 5 | icondir = /usr/share/icons/hicolor/16x16/status 6 | 7 | icon_DATA = $(wildcard *.xpm ) 8 | 9 | EXTRA_DIST = $(icon_DATA) 10 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.06-2.07/102-modify-Packages-columns.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Packages MODIFY NAME VARCHAR(255) NOT NULL; 2 | ALTER TABLE Packages MODIFY VER VARCHAR(255) NOT NULL; 3 | ALTER TABLE Packages MODIFY REL VARCHAR(255) NOT NULL; 4 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.03-3.04/102-modify-Packages-columns.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Packages MODIFY NAME VARCHAR(255) NOT NULL; 2 | ALTER TABLE Packages MODIFY VER VARCHAR(255) NOT NULL; 3 | ALTER TABLE Packages MODIFY REL VARCHAR(255) NOT NULL; 4 | -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/i586/perl-DBD-mysql-4.008_4.010-1.28_1.1.1.i586.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/i586/perl-DBD-mysql-4.008_4.010-1.28_1.1.1.i586.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/ppc/perl-DBD-mysql-4.008_4.010-1.25_1.1.1.ppc.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/ppc/perl-DBD-mysql-4.008_4.010-1.25_1.1.1.ppc.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/x86_64/imap-lib-2006c1_suse-67.26_127.1.x86_64.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/x86_64/imap-lib-2006c1_suse-67.26_127.1.x86_64.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/x86_64/imap-devel-2006c1_suse-67.26_127.1.x86_64.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/x86_64/imap-devel-2006c1_suse-67.26_127.1.x86_64.delta.rpm -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/rpm/x86_64/perl-DBD-mysql-4.008_4.010-1.33_1.1.1.x86_64.delta.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SUSE/smt/HEAD/tests/testdata/rpmmdtest/code11repo/rpm/x86_64/perl-DBD-mysql-4.008_4.010-1.33_1.1.1.x86_64.delta.rpm -------------------------------------------------------------------------------- /tests/integration/.env.example: -------------------------------------------------------------------------------- 1 | # Make sure that regserver is suffixed with /connect 2 | # E.g. https://scc.suse.com/connect 3 | SCC_REGSERVER_URL= 4 | SCC_USERNAME= 5 | SCC_PASSWORD= 6 | SMT_DB_USER= 7 | SMT_DB_PASSWORD= 8 | MYSQL_ROOT_PASSWORD= 9 | -------------------------------------------------------------------------------- /config/smt.target: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=SMT 3 | Requires=cron.service 4 | Requires=mysql.service 5 | Requires=smt.service 6 | Requires=apache2.service 7 | Requires=smt-schema-upgrade.service 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | -------------------------------------------------------------------------------- /yast/configure.in.in: -------------------------------------------------------------------------------- 1 | ## YCP module configure.in.in 2 | 3 | ## Initialize 4 | @YAST2-INIT-COMMON@ 5 | @YAST2-INIT-YCP@ 6 | 7 | ## some common checks 8 | @YAST2-CHECKS-COMMON@ 9 | @YAST2-CHECKS-YCP@ 10 | 11 | ## and generate the output... 12 | @YAST2-OUTPUT@ 13 | -------------------------------------------------------------------------------- /config/smt.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=SMT Maintenance tasks 3 | Requires=mysql.service 4 | After=mysql.service 5 | Before=apache2.service 6 | 7 | [Service] 8 | Type=oneshot 9 | ExecStart=/usr/lib/SMT/bin/smt-maintenance 10 | 11 | [Install] 12 | WantedBy=smt.target 13 | -------------------------------------------------------------------------------- /tests/integration/smt_client/files/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while [ "$(wget -qO - http://smt-server/status)" != "OK" ]; do 4 | echo "$(date) - still waiting for SMT server to sync" 5 | sleep 5 6 | done 7 | 8 | SUSEConnect --url http://smt-server/ 9 | 10 | exec "$@" 11 | -------------------------------------------------------------------------------- /config/smt-schema-upgrade.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=SMT database and schema upgrade service 3 | Requires=mysql.service 4 | After=mysql.service 5 | Before=apache2.service 6 | 7 | [Service] 8 | Type=oneshot 9 | ExecStart=/usr/bin/smt-schema-upgrade --yes 10 | 11 | [Install] 12 | WantedBy=smt.target -------------------------------------------------------------------------------- /devel-scripts/findProductsWithoutCatalogs.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | echo "select p.PRODUCTDATAID, p.PRODUCT, p.VERSION, p.REL, p.ARCH, p.PRODUCT_LIST from Products p where p.PRODUCTDATAID not in (select distinct pc.PRODUCTDATAID from ProductCatalogs pc) order by p.PRODUCTDATAID" | mysql -usmt -p smt -t 4 | 5 | -------------------------------------------------------------------------------- /package/smt-rpmlintrc: -------------------------------------------------------------------------------- 1 | addFilter("no-binary") 2 | addFilter("non-standard-uid /srv.*") 3 | addFilter("non-standard-uid /var/log/smt.*") 4 | addFilter("non-standard-uid /var/run/smt.*") 5 | addFilter("perl5-naming-policy-not-applied .*") 6 | addFilter("files-duplicate /usr/share/schemas.*") 7 | addFilter("files-duplicated-waste .*") -------------------------------------------------------------------------------- /add-on/content: -------------------------------------------------------------------------------- 1 | PRODUCT YaST_Enterprise_Proxy 2 | VERSION %{BASE_VERSION} 3 | DISTPRODUCT SUSE-SLE-YEP 4 | DISTVERSION %{BASE_VERSION}-%{VERSION} 5 | TYPE add-on 6 | VENDOR SUSE LINUX Products GmbH, Nuernberg, Germany 7 | RELNOTESURL %{RELNOTESURL} 8 | LABEL YaST Enterprise Proxy 9 | REQUIRES sles-release-10-sp1 pattern:yep-base 10 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.05-3.06/300-add-new-ProductExtensions-indices.sql: -------------------------------------------------------------------------------- 1 | alter table ProductExtensions ADD UNIQUE KEY `ProductExtensions_pdid_extid_rtpdid_uq` (`PRODUCTID`,`EXTENSIONID`, `ROOTPRODUCTID`); 2 | alter table ProductExtensions ADD KEY `ProductExtensions_pdid_extid_rtpdid_src_idx` (`PRODUCTID`,`EXTENSIONID`,`ROOTPRODUCTID`,`SRC`); 3 | -------------------------------------------------------------------------------- /yast/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.am 3 | Makefile.am.common 4 | Makefile.in 5 | aclocal.m4 6 | config.cache 7 | config.guess 8 | config.h.in 9 | config.log 10 | config.status 11 | config.sub 12 | configure 13 | configure.in 14 | depcomp 15 | install-sh 16 | missing 17 | mkinstalldirs 18 | stamp-h 19 | smt.pot 20 | autom4te.cache 21 | -------------------------------------------------------------------------------- /devel-scripts/testInsertPatchstatusJob.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -wT 2 | 3 | use SMT::Client; 4 | use Data::Dumper; 5 | use SMT::Utils; 6 | 7 | $dbh = SMT::Utils::db_connect(); 8 | exit 1 unless defined $dbh; 9 | 10 | $client = SMT::Client->new({'dbh' => $dbh}); 11 | if ( $client->insertPatchstatusJob("guid17") ) 12 | { print "yes\n"; } 13 | 14 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.04-2.05/100-create-ProductMigrations.sql: -------------------------------------------------------------------------------- 1 | 2 | create table ProductMigrations ( 3 | SRCPDID integer NOT NULL, 4 | TGTPDID integer NOT NULL, 5 | SRC CHAR(1) DEFAULT 'S', 6 | UNIQUE INDEX ProductMigrations_srcpdid_tgtpdid_uq (SRCPDID, TGTPDID), 7 | INDEX ProductMigrations_srcpdid_tgtpdid_src_idx (SRCPDID, TGTPDID, SRC) 8 | ); 9 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.01-3.02/100-create-ProductMigrations.sql: -------------------------------------------------------------------------------- 1 | 2 | create table ProductMigrations ( 3 | SRCPDID integer NOT NULL, 4 | TGTPDID integer NOT NULL, 5 | SRC CHAR(1) DEFAULT 'S', 6 | UNIQUE INDEX ProductMigrations_srcpdid_tgtpdid_uq (SRCPDID, TGTPDID), 7 | INDEX ProductMigrations_srcpdid_tgtpdid_src_idx (SRCPDID, TGTPDID, SRC) 8 | ); 9 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.05-3.06/100-modify-ProductExtensions-schema.sql: -------------------------------------------------------------------------------- 1 | alter table ProductExtensions add column ROOTPRODUCTID int not null; 2 | alter table ProductExtensions add column RECOMMENDED bool default false; 3 | alter table ProductExtensions drop index ProductExtensions_pdid_extid_uq; 4 | alter table ProductExtensions drop index ProductExtensions_pdid_extid_src_idx; 5 | -------------------------------------------------------------------------------- /tests/testdata/regdatatest/productcatalogs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 431 5 | 61cecf62a9a8d4edbae120e384f58501dc7d5cd6 6 | N 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /apache2/conf.d/smt_support.conf: -------------------------------------------------------------------------------- 1 | 2 | PerlRequire "/etc/apache2/smt-mod_perl-startup.pl" 3 | 4 | # perl cgi mode 5 | SetHandler perl-script 6 | PerlResponseHandler SMT::Support 7 | 8 | # The /cgi-bin/ ScriptAlias is already set up in httpd.conf 9 | 10 | # vim: ft=apache 11 | -------------------------------------------------------------------------------- /xml/examples/repo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SLES11-SP1-Updates for sle-11-i586 4 | /local/htdocs/repo/$RCE/SLES11-SP1-Updates/sle-11-i586 5 | 6 | https://nu.novell.com/repo/$RCE/SLES11-SP1-Updates/sle-11-i586/ 7 | -------------------------------------------------------------------------------- /cron/novell.com-smt: -------------------------------------------------------------------------------- 1 | # This file needs to be processed by reschedule-sync.sh first in order to randomize the job times 2 | 3 | ### */15 * * * * root /usr/lib/SMT/bin/smt-repeated-register 4 | ### 0 1 * * * root /usr/lib/SMT/bin/smt-daily 5 | ### 0 2 * * * root /usr/lib/SMT/bin/smt-run-jobqueue-cleanup 6 | ### 0 5 * * 1 root /usr/lib/SMT/bin/smt-gen-report 7 | -------------------------------------------------------------------------------- /tests/testdata/regdatatest/productdep.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 416 5 | 498 6 | 7 | 8 | 416 9 | 499 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /yast/Makefile.cvs: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.cvs 3 | # 4 | PREFIX = /usr 5 | 6 | LIB = $(shell y2tool get-lib) 7 | 8 | configure: all 9 | ./configure --prefix=$(PREFIX) --libdir=$(PREFIX)/$(LIB) 10 | 11 | all: 12 | y2tool y2autoconf 13 | y2tool y2automake 14 | autoreconf --force --install 15 | 16 | install: configure 17 | make 18 | make install 19 | 20 | reconf: all 21 | ./config.status --recheck 22 | ./config.status 23 | -------------------------------------------------------------------------------- /tests/SMT/Patch.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | BEGIN { 4 | push @INC, "../www/perl-lib"; 5 | } 6 | 7 | use Test::Simple tests => 1; 8 | 9 | use SMT::Patch; 10 | use Data::Dumper; 11 | 12 | my $patch = SMT::Patch::new(); 13 | $patch->setFromHash({name=>'mypatch', version=>'1.2.3', title=>'My Patch', type=>'security', description=>undef}); 14 | 15 | ok ($patch->asXML() =~ '', 'The tag must be present even if description is empty.'); 16 | -------------------------------------------------------------------------------- /xml/product.rnc: -------------------------------------------------------------------------------- 1 | start = element product { 2 | attribute id {xsd:integer}, # SMT ID of the product 3 | attribute name {xsd:string}, # Unix name of the product 4 | attribute version {xsd:string}, # version string 5 | attribute rel {xsd:string}, # release string 6 | attribute arch {xsd:string}, # target machine architecture string 7 | attribute uiname {xsd:string} # name of the product to be displayed to users 8 | } 9 | 10 | -------------------------------------------------------------------------------- /tests/tests.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | BEGIN { 4 | push @INC, "../www/perl-lib"; 5 | } 6 | 7 | use File::Find; 8 | use Test::Harness qw(&runtests); 9 | 10 | my @tests; 11 | find ( { wanted => 12 | sub 13 | { 14 | if ( $_ =~ /\.pl$/ && $_ !~ /tests\.pl$/ ) 15 | { push( @tests, $_); } 16 | } 17 | , no_chdir => 1 }, "."); 18 | 19 | foreach ( @tests ) 20 | { 21 | print $_, "\n"; 22 | } 23 | #@tests = @ARGV ? @ARGV : <*.pl>; 24 | runtests @tests; 25 | -------------------------------------------------------------------------------- /xml/repos.rnc: -------------------------------------------------------------------------------- 1 | start = element repos { 2 | element repo { 3 | attribute id {xsd:integer}, # SMT ID of the repository 4 | attribute name {xsd:string}, # repository's Unix name 5 | attribute target {xsd:string}, # repository's target product 6 | attribute mirrored {xsd:integer|""} # time stamp of the last successful mirror 7 | # (empty if not mirrored yet) 8 | }* 9 | } 10 | -------------------------------------------------------------------------------- /yast/src/control/smt_control.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | smt_ca 8 | firstboot,continue,normal 9 | 10 | ca_mgm 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/testdata/regdatatest/targets.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SUSE Linux Enterprise Desktop 10 (i586) 5 | i686 6 | sled-10-i586 7 | 8 | 9 | SUSE Linux Enterprise Desktop 10 (x86_64) 10 | x86_64 11 | sled-10-x86_64 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /xml/patches.rnc: -------------------------------------------------------------------------------- 1 | start = element patches { 2 | element patch { 3 | attribute id {xsd:integer}, # SMT ID of the patch 4 | attribute name {xsd:string}, # patch's Unix name 5 | attribute version {xsd:integer|""}, # patch's version number 6 | attribute category { # patch importance category 7 | "security" | 8 | "recommended" | 9 | "optional" | 10 | "mandatory" | 11 | "featire"} 12 | }* 13 | } 14 | 15 | -------------------------------------------------------------------------------- /devel-scripts/reset.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh -x 2 | 3 | if [ -z "$1" ]; then 4 | echo "Password required as first parameter" 5 | exit 1 6 | fi 7 | 8 | rpm -Uhv --force OLD/*.rpm 9 | 10 | echo "drop database smt;" | mysql -u root -h localhost --password="$1" 11 | 12 | echo -e "$1\nsmt\nsystem\nsystem\n" | /usr/lib/SMT/bin/smt-db setup --yast 13 | 14 | sed -i 's/^NURegUrl=.*/NURegUrl = https:\/\/secure-www.novell.com\/center\/regsvc\//' /etc/smt.conf 15 | 16 | /etc/init.d/smt restart 17 | 18 | smt-ncc-sync 19 | 20 | -------------------------------------------------------------------------------- /script/smt-version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use SMT::Utils; 4 | use Getopt::Long; 5 | use File::Basename; 6 | 7 | sub printUsage 8 | { 9 | print basename($0) . " : " . __("show version information")."\n"; 10 | } 11 | 12 | my $optres = Getopt::Long::GetOptions('help|h' => \$help); 13 | 14 | if ( (defined $help && $help == 1 ) || !$optres ) 15 | { 16 | printUsage(); 17 | exit 0; 18 | } 19 | 20 | printf __("Version: %s \n"), $SMT::SMT_VERSION; 21 | printf __("User-Agent: %s \n"), SMT::Utils::SMT_USER_AGENT; 22 | -------------------------------------------------------------------------------- /xml/products.rnc: -------------------------------------------------------------------------------- 1 | start = element products { 2 | element product { 3 | attribute id {xsd:integer}, # SMT ID of the product 4 | attribute name {xsd:string}, # Unix name of the product 5 | attribute version {xsd:string}, # version string 6 | attribute rel {xsd:string}, # release string 7 | attribute arch {xsd:string}, # target machine architecture string 8 | attribute uiname {xsd:string} # name of the product to be displayed to users 9 | }* 10 | } 11 | -------------------------------------------------------------------------------- /config/smt.reg: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # 3 | # OpenSLP registration file 4 | # 5 | # register Subscription Management Tool registration service 6 | # 7 | ############################################################################# 8 | 9 | # Register the SUSE Manager server, if it is running 10 | service:registration.suse:smt:https://$HOSTNAME/connect,en,65535 11 | tcp-port=443 12 | type=server 13 | description=Subscription Management Tool registration URL for clients 14 | -------------------------------------------------------------------------------- /doc/SMT-MySQL-Commands.txt: -------------------------------------------------------------------------------- 1 | 2 | mysqladmin -u root password "" 3 | (this command failes, if the root password is not empty) 4 | 5 | or sql command: 6 | SET PASSWORD FOR root@localhost=PASSWORD('rubberchicken'); 7 | 8 | give access to some user in database: 9 | 10 | grant all on database1.* to user1@host identified by "secret"; 11 | revoke all on database1.* from user1@host; 12 | 13 | To check whether the password for root is null: 14 | select Password from user where user="root" and host="localhost"; 15 | -------------------------------------------------------------------------------- /yast/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | /Makefile.am 3 | Makefile.in 4 | aclocal.m4 5 | autom4te.cache 6 | /coverage 7 | config.cache 8 | config.guess 9 | config.h 10 | config.h.in 11 | config.log 12 | config.status 13 | config.sub 14 | configure 15 | configure.ac 16 | depcomp 17 | install-sh 18 | *.pot 19 | libtool 20 | ltconfig 21 | ltmain.sh 22 | missing 23 | mkinstalldirs 24 | stamp-h* 25 | Makefile.am.common 26 | *.ami 27 | *.bz2 28 | .dep 29 | tmp.* 30 | *.log 31 | *.ybc 32 | /test-driver 33 | /testsuite/site.bak 34 | /test/*.trs 35 | -------------------------------------------------------------------------------- /HACKING: -------------------------------------------------------------------------------- 1 | 2 | = Development conventions = 3 | 4 | == Test oriented development == 5 | 6 | Don't commit code which does not have it test. 7 | 8 | This is a good read for everyone: 9 | 10 | Start by reading this: 11 | 12 | * http://petdance.com/perl/automated-testing/ 13 | 14 | Note: Test::Simple and Test::More are included in perl. 15 | 16 | Reference card pdf: 17 | http://pub.langworth.com/perl_test_refcard.pdf 18 | 19 | This one goes a little bit further but nice to read 20 | http://www.extremeperl.org/bk/unit-testing 21 | 22 | - Code conventions -------------------------------------------------------------------------------- /add-on/Makefile: -------------------------------------------------------------------------------- 1 | clean: 2 | rm -rf usr 3 | rm -rf y2update.tgz 4 | 5 | dist: 6 | mkdir -p usr/share/YaST2/ 7 | mkdir -p usr/share/YaST2/clients/ 8 | mkdir -p usr/share/YaST2/modules/ 9 | mkdir -p usr/share/YaST2/include/yep/ 10 | cp ../yast/src/inst_yep.ycp usr/share/YaST2/clients/ 11 | cp ../yast/src/complex.ycp usr/share/YaST2/include/yep/ 12 | cp ../yast/src/dialogs.ycp usr/share/YaST2/include/yep/ 13 | cp ../yast/src/helps.ycp usr/share/YaST2/include/yep/ 14 | cp ../yast/src/YEPData.ycp usr/share/YaST2/modules/ 15 | cp ../yast/src/YEPData.ybc usr/share/YaST2/modules/ 16 | tar -zcf y2update.tgz usr 17 | -------------------------------------------------------------------------------- /tests/SMT/Parser/ParseListReg.pl: -------------------------------------------------------------------------------- 1 | #! /usr/bin/perl -w 2 | 3 | BEGIN { 4 | push @INC, "../www/perl-lib"; 5 | } 6 | 7 | use strict; 8 | use SMT::Parser::ListReg; 9 | use Test::Simple tests => 3; 10 | use Data::Dumper; 11 | 12 | my $rd = SMT::Parser::ListReg->new(); 13 | $rd->parse("./testdata/regdatatest/registrations.xml", sub { test_handler(@_)}); 14 | 15 | 16 | sub test_handler 17 | { 18 | my $data = shift; 19 | 20 | #print STDERR Data::Dumper->Dump([$data])."\n"; 21 | 22 | ok(exists $data->{GUID}); 23 | } 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/integration/rspec/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) 2 | 3 | if RUBY_VERSION < '1.9.3' 4 | ::Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) } 5 | ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) } 6 | else 7 | ::Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f } 8 | ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f } 9 | end 10 | -------------------------------------------------------------------------------- /yast/src/desktop/smt.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Net_advanced; 4 | 5 | X-KDE-ModuleType=Library 6 | X-KDE-RootOnly=true 7 | X-KDE-HasReadOnlyMode=true 8 | X-KDE-Library=yast2 9 | X-SuSE-YaST-Call=smt 10 | 11 | X-SuSE-YaST-Group=Net_advanced 12 | X-SuSE-YaST-Argument= 13 | X-SuSE-YaST-RootOnly=true 14 | X-SuSE-YaST-AutoInst= 15 | X-SuSE-YaST-Geometry= 16 | X-SuSE-YaST-SortKey= 17 | X-SuSE-YaST-AutoInstResource=smt 18 | 19 | Icon=yast-smt 20 | Exec=/sbin/yast2 smt 21 | 22 | Name=SMT Server Management 23 | GenericName=SMT Server Management 24 | X-KDE-SubstituteUID=true 25 | -------------------------------------------------------------------------------- /apache2/conf.d/nu_server.conf: -------------------------------------------------------------------------------- 1 | 2 | PerlRequire "/etc/apache2/smt-mod_perl-startup.pl" 3 | 4 | Alias "/SUSE" "/srv/www/htdocs/repo/SUSE" 5 | Alias repo "/srv/www/htdocs/repo" 6 | 7 | 8 | Options +Indexes +FollowSymLinks 9 | IndexOptions +NameWidth=* 10 | 11 | PerlAuthenHandler NU::SMTAuth 12 | AuthName SMTAuth 13 | AuthType Basic 14 | Require valid-user 15 | 16 | # Allow unauthenticated access to /repo/tools/ directory 17 | Require expr %{REQUEST_URI} =~ m#^/repo/tools/.*# 18 | 19 | 20 | -------------------------------------------------------------------------------- /yast/src/desktop/smt-server.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Net_advanced; 4 | 5 | X-KDE-ModuleType=Library 6 | X-KDE-RootOnly=true 7 | X-KDE-HasReadOnlyMode=true 8 | X-KDE-Library=yast2 9 | X-SuSE-YaST-Call=smt-server 10 | 11 | X-SuSE-YaST-Group=Net_advanced 12 | X-SuSE-YaST-Argument= 13 | X-SuSE-YaST-RootOnly=true 14 | X-SuSE-YaST-AutoInst= 15 | X-SuSE-YaST-Geometry= 16 | X-SuSE-YaST-SortKey= 17 | X-SuSE-YaST-AutoInstResource=smt 18 | 19 | Icon=yast-smt 20 | Exec=/sbin/yast2 smt-server 21 | 22 | Name=SMT Server Configuration 23 | GenericName=SMT Server Configuration 24 | X-KDE-SubstituteUID=true 25 | -------------------------------------------------------------------------------- /yast/src/desktop/smt-wizard.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Net_advanced; 4 | 5 | X-KDE-ModuleType=Library 6 | X-KDE-RootOnly=true 7 | X-KDE-HasReadOnlyMode=true 8 | X-KDE-Library=yast2 9 | X-SuSE-YaST-Call=smt-wizard 10 | 11 | X-SuSE-YaST-Group=Net_advanced 12 | X-SuSE-YaST-Argument= 13 | X-SuSE-YaST-RootOnly=true 14 | X-SuSE-YaST-AutoInst= 15 | X-SuSE-YaST-Geometry= 16 | X-SuSE-YaST-SortKey= 17 | X-SuSE-YaST-AutoInstResource=smt 18 | 19 | Icon=yast-smt 20 | Exec=/sbin/yast2 smt-wizard 21 | 22 | Name=SMT Configuration Wizard 23 | GenericName=SMT Server Configuration Wizard 24 | X-KDE-SubstituteUID=true 25 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.05-3.02/110-create-drop_index_if_exists-proc.sql: -------------------------------------------------------------------------------- 1 | DROP PROCEDURE IF EXISTS smt.drop_index_if_exists; 2 | 3 | DELIMITER // 4 | 5 | CREATE PROCEDURE smt.drop_index_if_exists(in theTable varchar(128), in theIndexName varchar(128) ) 6 | BEGIN 7 | IF((SELECT COUNT(*) AS index_exists 8 | FROM information_schema.statistics 9 | WHERE TABLE_SCHEMA = DATABASE() 10 | AND table_name = theTable 11 | AND index_name = theIndexName) > 0) THEN 12 | SET @s = CONCAT('DROP INDEX ' , theIndexName , ' ON ' , theTable); 13 | PREPARE stmt FROM @s; 14 | EXECUTE stmt; 15 | END IF; 16 | END; 17 | 18 | // 19 | 20 | DELIMITER ; 21 | 22 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.06-3.03/110-create-drop_index_if_exists-proc.sql: -------------------------------------------------------------------------------- 1 | DROP PROCEDURE IF EXISTS smt.drop_index_if_exists; 2 | 3 | DELIMITER // 4 | 5 | CREATE PROCEDURE smt.drop_index_if_exists(in theTable varchar(128), in theIndexName varchar(128) ) 6 | BEGIN 7 | IF((SELECT COUNT(*) AS index_exists 8 | FROM information_schema.statistics 9 | WHERE TABLE_SCHEMA = DATABASE() 10 | AND table_name = theTable 11 | AND index_name = theIndexName) > 0) THEN 12 | SET @s = CONCAT('DROP INDEX ' , theIndexName , ' ON ' , theTable); 13 | PREPARE stmt FROM @s; 14 | EXECUTE stmt; 15 | END IF; 16 | END; 17 | 18 | // 19 | 20 | DELIMITER ; 21 | 22 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.07-3.04/110-create-drop_index_if_exists-proc.sql: -------------------------------------------------------------------------------- 1 | DROP PROCEDURE IF EXISTS smt.drop_index_if_exists; 2 | 3 | DELIMITER // 4 | 5 | CREATE PROCEDURE smt.drop_index_if_exists(in theTable varchar(128), in theIndexName varchar(128) ) 6 | BEGIN 7 | IF((SELECT COUNT(*) AS index_exists 8 | FROM information_schema.statistics 9 | WHERE TABLE_SCHEMA = DATABASE() 10 | AND table_name = theTable 11 | AND index_name = theIndexName) > 0) THEN 12 | SET @s = CONCAT('DROP INDEX ' , theIndexName , ' ON ' , theTable); 13 | PREPARE stmt FROM @s; 14 | EXECUTE stmt; 15 | END IF; 16 | END; 17 | 18 | // 19 | 20 | DELIMITER ; 21 | 22 | -------------------------------------------------------------------------------- /db/schemas/mysql/3.01-3.02/110-create-drop_index_if_exists-proc.sql: -------------------------------------------------------------------------------- 1 | DROP PROCEDURE IF EXISTS smt.drop_index_if_exists; 2 | 3 | DELIMITER // 4 | 5 | CREATE PROCEDURE smt.drop_index_if_exists(in theTable varchar(128), in theIndexName varchar(128) ) 6 | BEGIN 7 | IF((SELECT COUNT(*) AS index_exists 8 | FROM information_schema.statistics 9 | WHERE TABLE_SCHEMA = DATABASE() 10 | AND table_name = theTable 11 | AND index_name = theIndexName) > 0) THEN 12 | SET @s = CONCAT('DROP INDEX ' , theIndexName , ' ON ' , theTable); 13 | PREPARE stmt FROM @s; 14 | EXECUTE stmt; 15 | END IF; 16 | END; 17 | 18 | // 19 | 20 | DELIMITER ; 21 | 22 | -------------------------------------------------------------------------------- /xml/examples/repos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tests/SMT/Mirror/Job.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use File::Temp; 4 | use Test::Simple tests => 2; 5 | 6 | use SMT::Mirror::Job; 7 | 8 | my $tempdir = File::Temp::tempdir(CLEANUP => 1); 9 | 10 | $job = SMT::Mirror::Job->new(); 11 | # FIXME need some solid URI, ideally an ad hoc local http server 12 | $job->uri( 'http://download.opensuse.org/repositories/home:/jkupec/openSUSE_11.1/' ); 13 | $job->localBasePath( "$tempdir" ); 14 | $job->localRepoPath( '' ); 15 | $job->localFileLocation( 'repodata/repomd.xml' ); 16 | 17 | #$job->resource( "/repodata/repomd.xml" ); 18 | #$job->localdir( "./testdata/jobtest/" ); 19 | 20 | ok($job->modified() > 0); 21 | ok($job->outdated()); 22 | -------------------------------------------------------------------------------- /devel-scripts/quickRESTUpdate.pl: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # empty prefix for relative paths 4 | PRE=. 5 | 6 | cp -av $PRE/www/perl-lib/SMT/REST*pm /srv/www/perl-lib/SMT/ 7 | cp -av $PRE/www/perl-lib/SMT/Client/Auth.pm /srv/www/perl-lib/SMT/Client/ 8 | cp -av $PRE/www/perl-lib/SMT/Job[Q\.]*pm /usr/lib/perl5/vendor_perl/5.10.0/SMT/ 9 | cp -av $PRE/www/perl-lib/SMT/Client.pm /usr/lib/perl5/vendor_perl/5.10.0/SMT/ 10 | cp -av $PRE/www/perl-lib/SMT.pm /usr/lib/perl5/vendor_perl/5.10.0/ 11 | cp -av $PRE/script/smt* /usr/sbin/ 12 | cp -av $PRE/cron/smt* /usr/lib/SMT/bin/ 13 | chmod 755 /usr/sbin/smt* 14 | 15 | 16 | # enable to restart apache after copying new files 17 | # rcapache2 restart 18 | -------------------------------------------------------------------------------- /swig/ptest.pl: -------------------------------------------------------------------------------- 1 | #! /usr/bin/perl -w 2 | 3 | BEGIN 4 | { 5 | push @INC, "."; 6 | }; 7 | 8 | use strict; 9 | use English; 10 | use Sys::GRP; 11 | use POSIX; 12 | use User::pwent; 13 | my $user = "tux"; 14 | 15 | my $pw = getpwnam($user) || return 0; 16 | my $primgroup= $pw->gid(); 17 | 18 | print "UID: $UID\n"; 19 | print "EUID: $EUID\n"; 20 | print "GID: $GID\n"; 21 | print "EGID: $EGID\n"; 22 | 23 | $GID = $primgroup; 24 | $EGID = $primgroup; 25 | my $ret = Sys::GRP::initgroups($user, $primgroup); 26 | print "RET: $ret \n"; 27 | 28 | POSIX::setuid( $pw->uid() ) || return 0; 29 | 30 | print "UID: $UID\n"; 31 | print "EUID: $EUID\n"; 32 | print "GID: $GID\n"; 33 | print "EGID: $EGID\n"; 34 | -------------------------------------------------------------------------------- /yast/src/clients/smt-wizard.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | # File: clients/smt.ycp 4 | # Package: Configuration of smt 5 | # Summary: Main file 6 | # Authors: Lukas Ocilka 7 | # 8 | # $Id: smt.ycp 27914 2006-02-13 14:32:08Z locilka $ 9 | # 10 | # Main file for smt configuration. Uses all other files. 11 | module Yast 12 | class InstSmtClient < Client 13 | def main 14 | Yast.import "UI" 15 | Yast.import "Mode" 16 | 17 | textdomain "smt" 18 | 19 | Yast.include self, "smt/wizard.rb" 20 | 21 | Wizard.CreateDialog() 22 | 23 | SMTInstallSequence() 24 | 25 | UI.CloseDialog() 26 | end 27 | end 28 | end 29 | 30 | Yast::InstSmtClient.new.main 31 | -------------------------------------------------------------------------------- /cron/smt-run-jobqueue-cleanup: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # smt-run-cleanup-jobqueue 4 | # This script calls the clean-up script of the SMT JobQueue. 5 | 6 | PATH="/sbin:/usr/sbin:/usr/bin:/bin" 7 | 8 | . /etc/smt.d/smt-cron.conf 9 | 10 | # source the profile to get the proxy settings 11 | . /etc/profile.d/profile.sh 12 | 13 | if [ -x /usr/lib/SMT/bin/smt-jobqueue-cleanup ] 14 | then 15 | /usr/lib/SMT/bin/smt-jobqueue-cleanup ${JOBQUEUECLEANUP_PARAMS} 16 | else 17 | echo "WARNING: Could not find the SMT binary smt-jobqueue-cleanup" 18 | echo " Please make sure SMT is properly installed." 19 | fi 20 | 21 | # in cronjobs always do an exit 0 - even on errors - exit 1 only in case of real panic 22 | exit 0 23 | 24 | -------------------------------------------------------------------------------- /yast/icons/client_status/client-updates-available.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *upgrade_available[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 16 7 1", 5 | " c #E35302", 6 | ". c #E35708", 7 | "X c #E45808", 8 | "o c #EEE9E5", 9 | "O c #EEEAE5", 10 | "+ c #EEEEEC", 11 | "@ c None", 12 | /* pixels */ 13 | "@@@@@@@@@@@@@@@@", 14 | "@@@@@@@@@@@@@@@@", 15 | "@@@++++++++++@@@", 16 | "@@@+X O+X O@@@", 17 | "@@@+X O+X O@@@", 18 | "++++X O+X O+++", 19 | "+. o", 20 | "+. o", 21 | "+. o", 22 | "++++X O+X O+++", 23 | "@@@+X O+X O@@@", 24 | "@@@+X O+X O@@@", 25 | "@@@++++++++++@@@", 26 | "@@@@@@@@@@@@@@@@", 27 | "@@@@@@@@@@@@@@@@", 28 | "@@@@@@@@@@@@@@@@" 29 | }; 30 | -------------------------------------------------------------------------------- /performance2/README: -------------------------------------------------------------------------------- 1 | 2 | scp -r performance2 root@my.test.host: 3 | 4 | If you want to start only on client which performs 5 | registrations again and again, then call: 6 | 7 | my.test.host:performance2> ./repeatedStart.pl 0 100 prfx 8 | 9 | This performes 100 registrations with GUIDs from prfx-0 - prfx-99 10 | 11 | 12 | If you want to start registrations in parallel on one client 13 | call: 14 | 15 | my.test.host:performance2> ./launch.sh 2 100 prfx 16 | 17 | This starts 2 clients. Every client performes 100 registrations. 18 | The first starting with GUID prfx-0 the second with GUID prfx-100. 19 | 20 | The prefix can be used to prevend overlapping guids, if you want 21 | to run performance tests from different hosts. 22 | -------------------------------------------------------------------------------- /yast/testsuite/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am for .../testsuite 3 | # 4 | # Do not edit this file (Makefile.am) as it will be overwritten! 5 | # 6 | 7 | AUTOMAKE_OPTIONS = dejagnu 8 | EXTRA_DIST = $(wildcard tests/*.out) $(wildcard tests/*.err) $(wildcard tests/*.ycp) $(wildcard tests/*.yh) 9 | 10 | testsuite_prepare = @ydatadir@/testsuite/Makefile.testsuite 11 | 12 | all-local: $(testsuite_prepare) 13 | make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) 14 | 15 | clean-local: $(testsuite_prepare) 16 | make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) clean 17 | 18 | check-local: $(testsuite_prepare) 19 | make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) check 20 | 21 | # EOF 22 | -------------------------------------------------------------------------------- /cron/smt-cron.conf: -------------------------------------------------------------------------------- 1 | # 2 | # Parameter for smt ncc-sync, if called in the cronjob 3 | # 4 | SCC_SYNC_PARAMS="-L /var/log/smt/smt-sync.log --mail" 5 | 6 | # 7 | # Parameter for smt mirror, if called in the cronjob 8 | # 9 | MIRROR_PARAMS="-L /var/log/smt/smt-mirror.log --mail" 10 | 11 | # 12 | # Parameter for smt register, if called in the cronjob 13 | # 14 | REGISTER_PARAMS="-r -L /var/log/smt/smt-register.log --mail" 15 | 16 | # 17 | # Parameter for smt report, if called in the cronjob 18 | # 19 | REPORT_PARAMS="--mail --attach -L /var/log/smt/smt-report.log" 20 | 21 | # 22 | # Parameter for smt jobqueue cleanup, if called in the cronjob 23 | # 24 | JOBQUEUECLEANUP_PARAMS="--mail -L /var/log/smt/smt-jobqueuecleanup.log" 25 | 26 | 27 | -------------------------------------------------------------------------------- /yast/icons/patch_status/patch-remove.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * del_xpm[] = { 3 | "22 16 9 1", 4 | " c None", 5 | ". c #EEEEEC", 6 | "+ c #EEEDEB", 7 | "@ c #BD7776", 8 | "# c #B25B5A", 9 | "$ c #EDECEA", 10 | "% c #8C0000", 11 | "& c #ECEAE8", 12 | "* c #9A2120", 13 | " ", 14 | " .+ +. ", 15 | " .@#$ $#@. ", 16 | " .@%%#$ $#%%@. ", 17 | " +#%%%#&#%%%#+ ", 18 | " $#%%%*%%%#$ ", 19 | " $#%%%%%#$ ", 20 | " &*%%%*& ", 21 | " $#%%%%%#$ ", 22 | " $#%%%*%%%#$ ", 23 | " +#%%%#&#%%%#+ ", 24 | " .@%%#$ $#%%@. ", 25 | " .@#$ $#@. ", 26 | " .+ +. ", 27 | " ", 28 | " "}; 29 | -------------------------------------------------------------------------------- /tests/integration/smt_client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.suse.com/sles12sp2 2 | 3 | RUN zypper --non-interactive rm container-suseconnect &&\ 4 | zypper --non-interactive ar \ 5 | http://download.suse.de/ibs/SUSE/Products/SLE-SERVER/12-SP2/x86_64/product/ sles12sp2_pool &&\ 6 | zypper --non-interactive ar \ 7 | http://download.suse.de/ibs/SUSE/Updates/SLE-SERVER/12-SP2/x86_64/update sles12sp2_updates &&\ 8 | zypper ar http://download.suse.de/ibs/SUSE/Products/SLE-SDK/12-SP2/x86_64/product sles12sp2_sdk &&\ 9 | zypper ref && zypper --non-interactive install --no-recommend \ 10 | timezone patch mariadb-client libopenssl-devel 11 | 12 | ADD files/run.sh /root/run.sh 13 | 14 | ENTRYPOINT ["/root/run.sh"] 15 | CMD ["tail", "-f", "/dev/null"] 16 | -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/sharedpkgs/repodata/repomd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | e66319eaf87b1384e4582ed1e3ecc7202f108b8a 6 | 1243611201 7 | 4d0580d9529364f64d1098a50966ab7075652a9a 8 | 9 | 10 | 11 | 6582daa035b6d7d96283e7f91de294055d8529d0 12 | 1245244401.0 13 | 5c3a70a0d4679f6890f4a4ed43887eb74f2885de 14 | 15 | 16 | -------------------------------------------------------------------------------- /yast/icons/patch_status/patch-not-used.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * noinst_xpm[] = { 3 | "22 16 10 1", 4 | " c None", 5 | ". c #FFFFFF", 6 | "+ c #000200", 7 | "@ c #1C1E1B", 8 | "# c #070C08", 9 | "$ c #050805", 10 | "% c #0B0D0A", 11 | "& c #10120F", 12 | "* c #1D221E", 13 | "= c #151A16", 14 | " ................ ", 15 | " .+@++#++$+$++%&. ", 16 | " .%............+. ", 17 | " .+............+. ", 18 | " .+............+. ", 19 | " .+............+. ", 20 | " .+............+. ", 21 | " .+............+. ", 22 | " .+............+. ", 23 | " .+............+. ", 24 | " .+............+. ", 25 | " .+............+. ", 26 | " .$............+. ", 27 | " .+............+. ", 28 | " .+*+++$++++++=$. ", 29 | " ................ "}; 30 | -------------------------------------------------------------------------------- /tests/integration/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | networks: 3 | default: 4 | driver: bridge 5 | driver_opts: 6 | com.docker.network.driver.mtu: 1350 7 | services: 8 | db: 9 | image: library/mariadb:10.0.27 10 | env_file: .env 11 | 12 | smt_server: 13 | build: ./smt_server 14 | #ports: 15 | # - 80:80 16 | expose: 17 | - 80 18 | - 443 19 | depends_on: 20 | - db 21 | links: 22 | - db 23 | env_file: .env 24 | #external_links: 25 | # - glue_web_1 26 | 27 | volumes: 28 | - ./rspec:/rspec 29 | 30 | smt_client: 31 | build: ./smt_client 32 | depends_on: 33 | - smt_server 34 | links: 35 | - smt_server:smt-server 36 | env_file: .env 37 | 38 | volumes: 39 | - ./rspec:/rspec 40 | -------------------------------------------------------------------------------- /client/README: -------------------------------------------------------------------------------- 1 | smt-client -- Client for the Subscription Management Tool 2 | Copyright (C) 2009 Thomas Göttlicher, J. Daniel Schmidt, SUSE LINUX Products GmbH 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License Version 2 as published by 6 | the Free Software Foundation. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 | 17 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | smt -- Subscription Management Tool 2 | Copyright (C) 2008-2012 Michael Calmer, SUSE LINUX Products GmbH 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | -------------------------------------------------------------------------------- /xml/repo.rnc: -------------------------------------------------------------------------------- 1 | 2 | start = element repo { # repository 3 | attribute id {xsd:integer}, # SMT ID of the repository 4 | attribute name {xsd:string}, # repository's Unix name 5 | attribute target {xsd:string}, # repository's target product 6 | attribute type {"nu" | "yum" | "zypp" | "pum"}, # type of repository 7 | element description {xsd:string}, # description of the repository 8 | element localpath {xsd:string}, # path to local SMT mirror of the repository 9 | element mirrored { 10 | attribute date {xsd:integer|""} # timestamp of the last successful mirror 11 | # (empty if not mirrored yet) 12 | }, 13 | element url {xsd:anyURI} # original URL of the repository 14 | } 15 | 16 | -------------------------------------------------------------------------------- /yast/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for smt/src 2 | 3 | yncludedir = @yncludedir@/smt 4 | 5 | client_DATA = \ 6 | clients/smt.rb \ 7 | clients/smt-server.rb \ 8 | clients/smt-wizard.rb 9 | 10 | ynclude_DATA = \ 11 | include/smt/dialogs.rb \ 12 | include/smt/helps.rb \ 13 | include/smt/complex.rb \ 14 | include/smt/wizard.rb 15 | 16 | control_DATA = \ 17 | control/smt_control.xml 18 | 19 | ybin_SCRIPTS = scripts/regsrv-check-creds 20 | 21 | desktop_DATA = $(wildcard desktop/*.desktop) 22 | 23 | module_DATA = $(wildcard modules/SMT*.rb) 24 | 25 | # create a symlink for local build, #145327 26 | #smt: 27 | # ln -sf . $@ 28 | #ycpchook = smt 29 | 30 | controldir = $(yast2dir)/control 31 | 32 | EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(desktop_DATA) $(control_DATA) $(ybin_SCRIPTS) 33 | 34 | include $(top_srcdir)/Makefile.am.common 35 | -------------------------------------------------------------------------------- /performance2/repeatedStart.pl: -------------------------------------------------------------------------------- 1 | #! /usr/bin/perl -w 2 | 3 | use strict; 4 | use Time::HiRes qw(gettimeofday tv_interval); 5 | 6 | open(PERF, ">> ./performance2.log") or do 7 | { 8 | die "Cannot open logfile: $!"; 9 | }; 10 | 11 | print "GUID\t| Time\n"; 12 | print PERF "GUID\t| Time\n"; 13 | 14 | my ($start, $end); 15 | $start=shift or $start=0; 16 | $end=shift or $end=10000; 17 | $guidprefix = shift; 18 | 19 | my $opts = shift || ""; 20 | 21 | if(! -x "./suse_register") 22 | { 23 | die "./suse_register client not found"; 24 | } 25 | 26 | 27 | for( my $cnt = $start; $cnt <= $end; $cnt++) 28 | { 29 | my $t0 = [gettimeofday]; 30 | 31 | `./suse_register --fakeguid "$guidprefix-$cnt" $opts`; 32 | 33 | print PERF "$cnt\t|".(tv_interval($t0))."\n"; 34 | print "$cnt\t|".(tv_interval($t0))."\n"; 35 | } 36 | 37 | close PERF; 38 | 39 | exit 0; 40 | -------------------------------------------------------------------------------- /tests/SMT/Parser/NU.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | use SMT::Parser::NU; 4 | use Test::Simple tests => 6; 5 | 6 | my $counter = 0; 7 | 8 | sub handler() 9 | { 10 | my $data = shift; 11 | #print STDERR " - " .$data->{NAME} ." REPO\n"; 12 | if ($counter == 0 ) 13 | { 14 | ok($data->{NAME} eq "SLE10-SDK-Updates"); 15 | ok($data->{DISTRO_TARGET} eq "sles-10-i586"); 16 | ok($data->{PATH} eq "\$RCE/SLE10-SDK-Updates/sles-10-i586"); 17 | ok($data->{DESCRIPTION} eq "SLE10-SDK-Updates for sles-10-i586"); 18 | ok($data->{PRIORITY} == 0); 19 | } 20 | $counter += 1; 21 | 22 | } 23 | 24 | $parser = SMT::Parser::NU->new(); 25 | $parser->parse("./testdata/repoindex.xml", \&handler); 26 | 27 | # the data file contains 70 entries 28 | #print STDERR " - " .$counter ." ENTRIES\n"; 29 | ok($counter == 70); 30 | 31 | 32 | -------------------------------------------------------------------------------- /apache2/smt-mod_perl-startup.pl: -------------------------------------------------------------------------------- 1 | # Taken from http://perl.apache.org/docs/2.0/user/handlers/server.html#Startup_File 2 | if ( ! $ENV{MOD_PERL}) { die "GATEWAY_INTERFACE not Perl!"; } 3 | use lib qw(/srv/www/perl-lib); 4 | # enable if the mod_perl 1.0 compatibility is needed 5 | # use Apache2::compat (); 6 | # preload all mp2 modules 7 | # use ModPerl::MethodLookup; 8 | # ModPerl::MethodLookup::preload_all_modules(); 9 | use ModPerl::Util (); #for CORE::GLOBAL::exit 10 | use Apache2::RequestRec (); 11 | use Apache2::RequestIO (); 12 | use Apache2::RequestUtil (); 13 | use Apache2::ServerRec (); 14 | use Apache2::ServerUtil (); 15 | use Apache2::Connection (); 16 | use Apache2::Log (); 17 | use APR::Table (); 18 | use ModPerl::Registry (); 19 | use Apache2::Const -compile => ':common'; 20 | use APR::Const -compile => ':common'; 21 | 1; 22 | -------------------------------------------------------------------------------- /tests/integration/rspec/spec/smt_server/smt_server_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'smt-repos', :type => :aruba do 4 | before(:each) { run('smt-repos') } 5 | before(:each) { stop_all_commands } 6 | 7 | it "executes without errors" do 8 | expect( last_command_started ).to be_successfully_executed 9 | end 10 | 11 | it "has at least one repo" do 12 | expect( last_command_started.stdout.split("\n").count ).to be > 4 13 | end 14 | end 15 | 16 | describe 'smt-repos -o', :type => :aruba do 17 | before(:each) { run('smt-repos -o') } 18 | before(:each) { stop_all_commands } 19 | 20 | it "executes without errors" do 21 | expect( last_command_started ).to be_successfully_executed 22 | end 23 | 24 | it "has at least one repo with enabled mirroring" do 25 | expect( last_command_started.stdout.split("\n").count ).to be > 4 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | smt-*/ 3 | package/smt-*.tar.bz2 4 | client/smt-client-*/ 5 | client/package/smt-client-*.tar.bz2 6 | yast/Makefile.am 7 | yast/Makefile.am.common 8 | yast/Makefile.in 9 | yast/aclocal.m4 10 | yast/agents/Makefile.in 11 | yast/autodocs-cc-base.ami 12 | yast/autodocs-cc-off.ami 13 | yast/autodocs-cc.ami 14 | yast/autodocs-ycp.ami 15 | yast/config.guess 16 | yast/config.sub 17 | yast/configure 18 | yast/configure.in 19 | yast/doc/Makefile.in 20 | yast/doc/autodocs/Makefile.in 21 | yast/icons/16x16/Makefile.in 22 | yast/icons/22x22/Makefile.in 23 | yast/icons/32x32/Makefile.in 24 | yast/icons/48x48/Makefile.in 25 | yast/icons/Makefile.in 26 | yast/icons/client_status/Makefile.in 27 | yast/icons/patch_status/Makefile.in 28 | yast/install-sh 29 | yast/missing 30 | yast/pluglib-bindings.ami 31 | yast/src/Makefile.in 32 | yast/src/smt 33 | yast/testsuite/Makefile.in 34 | obs 35 | 36 | -------------------------------------------------------------------------------- /client/script/reboot: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use SMT::Agent::Utils; 5 | 6 | sub jobhandler 7 | { 8 | my ($jobtype, $jobid, $args, $verbose) = @_; 9 | 10 | SMT::Agent::Utils::logger ("jobhandler for reboot called", $jobid); 11 | SMT::Agent::Utils::logger ("reboot runs jobid \"$jobid\"", $jobid); 12 | 13 | # check whether this handler can handle requested jobtype 14 | SMT::Agent::Utils::error ("wrong job handler: \"reboot\" cannot handle \"$jobtype\"", $jobid) if ( $jobtype ne "reboot" ); 15 | 16 | #== run shutdown == 17 | `/sbin/shutdown -r +1 > /dev/null 2>&1 &`; 18 | 19 | return ( 20 | stdout => "", 21 | stderr => "", 22 | exitcode => 0, 23 | success => "true", 24 | message => "reboot triggered" 25 | ); 26 | 27 | } 28 | 29 | SMT::Agent::Utils::logger ("successfully loaded handler for jobtype \"reboot\""); 30 | 31 | return 1; 32 | 33 | -------------------------------------------------------------------------------- /yast/icons/patch_status/patch-use.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * install_xpm[] = { 3 | "22 16 17 1", 4 | " c None", 5 | ". c #EEEEEC", 6 | "+ c #BFD3B7", 7 | "@ c #CEDBC8", 8 | "# c #BED2B6", 9 | "$ c #2B7E13", 10 | "% c #34831D", 11 | "& c #217808", 12 | "* c #488E33", 13 | "= c #EDEEEB", 14 | "- c #E0E6DC", 15 | "; c #CFDCCA", 16 | "> c #488F34", 17 | ", c #53953F", 18 | "' c #33831D", 19 | ") c #4C9138", 20 | "! c #4A9036", 21 | " ", 22 | " .. ", 23 | " .+@. ", 24 | " .#$%@. ", 25 | " .#$&&*= ", 26 | " . .#$&&%@ ", 27 | " .-; .#$&&%@ ", 28 | " .->%@ .#$&&%@ ", 29 | " .,&&%@#$&&%@ ", 30 | " .#$&&'$&&%@ ", 31 | " .#$&&&&%@ ", 32 | " .#$&&%@ ", 33 | " .+)!@ ", 34 | " .. ", 35 | " ", 36 | " "}; 37 | -------------------------------------------------------------------------------- /yast/icons/client_status/client-up-to-date.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * install_xpm[] = { 3 | "22 16 17 1", 4 | " c None", 5 | ". c #EEEEEC", 6 | "+ c #BFD3B7", 7 | "@ c #CEDBC8", 8 | "# c #BED2B6", 9 | "$ c #2B7E13", 10 | "% c #34831D", 11 | "& c #217808", 12 | "* c #488E33", 13 | "= c #EDEEEB", 14 | "- c #E0E6DC", 15 | "; c #CFDCCA", 16 | "> c #488F34", 17 | ", c #53953F", 18 | "' c #33831D", 19 | ") c #4C9138", 20 | "! c #4A9036", 21 | " ", 22 | " .. ", 23 | " .+@. ", 24 | " .#$%@. ", 25 | " .#$&&*= ", 26 | " . .#$&&%@ ", 27 | " .-; .#$&&%@ ", 28 | " .->%@ .#$&&%@ ", 29 | " .,&&%@#$&&%@ ", 30 | " .#$&&'$&&%@ ", 31 | " .#$&&&&%@ ", 32 | " .#$&&%@ ", 33 | " .+)!@ ", 34 | " .. ", 35 | " ", 36 | " "}; 37 | -------------------------------------------------------------------------------- /yast/icons/client_status/repo-up-to-date.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * install_xpm[] = { 3 | "22 16 17 1", 4 | " c None", 5 | ". c #EEEEEC", 6 | "+ c #BFD3B7", 7 | "@ c #CEDBC8", 8 | "# c #BED2B6", 9 | "$ c #2B7E13", 10 | "% c #34831D", 11 | "& c #217808", 12 | "* c #488E33", 13 | "= c #EDEEEB", 14 | "- c #E0E6DC", 15 | "; c #CFDCCA", 16 | "> c #488F34", 17 | ", c #53953F", 18 | "' c #33831D", 19 | ") c #4C9138", 20 | "! c #4A9036", 21 | " ", 22 | " .. ", 23 | " .+@. ", 24 | " .#$%@. ", 25 | " .#$&&*= ", 26 | " . .#$&&%@ ", 27 | " .-; .#$&&%@ ", 28 | " .->%@ .#$&&%@ ", 29 | " .,&&%@#$&&%@ ", 30 | " .#$&&'$&&%@ ", 31 | " .#$&&&&%@ ", 32 | " .#$&&%@ ", 33 | " .+)!@ ", 34 | " .. ", 35 | " ", 36 | " "}; 37 | -------------------------------------------------------------------------------- /client/script/servererror: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use SMT::Agent::Utils; 5 | 6 | sub jobhandler 7 | { 8 | my ($jobtype, $jobid, $args, $verbose) = @_; 9 | 10 | SMT::Agent::Utils::logger("jobhandler for servererror job called", $jobid); 11 | SMT::Agent::Utils::logger("servererror runs jobid \"$jobid\"", $jobid); 12 | SMT::Agent::Utils::error("wrong job handler: \"servererror\" cannot handle \"$jobtype\"", $jobid) unless ( $jobtype eq 'servererror' ); 13 | 14 | return ( 15 | stdout => '', 16 | stderr => "This job (id $jobid) caused a servererror when it was retrieved by the client.", 17 | exitcode => 1, 18 | success => 'false', 19 | result => undef, 20 | message => "Error: Servererror when client retrieved the job." 21 | ); 22 | 23 | } 24 | 25 | SMT::Agent::Utils::logger("successfully loaded handler for jobtype \"createjob\""); 26 | 27 | return 1; 28 | 29 | -------------------------------------------------------------------------------- /RELEASENOTES--Update-issues: -------------------------------------------------------------------------------- 1 | 2 | * new value "requiredAuthType" in /etc/smt.conf 3 | 4 | * /etc/apache2/conf.d/nu_server.conf got an update 5 | and replaces the installed version on update. 6 | 7 | * new smt user (all scripts are running as an unprivileged user) 8 | Which user, can be defined in smt.conf 9 | 10 | * inform the user about how to change permissions on 11 | some files and directories after update SMT10 => SMT11 12 | (most things should be done by the yast module) 13 | note changeSMTUserPermissions.sh 14 | 15 | * new value "[NU] NURegUrl" in /etc/smt.conf 16 | If this key is not available, fallback to /etc/suseRegister.conf 17 | 18 | * SMT11 and defining proxy user. yast2-proxy write this information 19 | into /root/.curlrc. In SMT11 the scripts are running not as root. 20 | .curlrc in the home directory of the used user must be edited 21 | or use smt.conf to define the proxy settings. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /performance/launch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | free=$(free | grep ^Mem: | awk '{ print $4; }') 4 | maxclients=$[ $free / 10240 ] 5 | progname=${0##*/} 6 | 7 | if [ -z "$1" -o -z "$2" -o "$1" = "-h" ]; then 8 | echo "usage: $progname " 9 | exit 1 10 | fi 11 | 12 | concurrency=$1 13 | registrations=$2 14 | 15 | if [ $maxclients -lt $concurrency ]; then 16 | echo "too much clients requested (max=$maxclients) ... aborting." 17 | exit 1 18 | else 19 | echo "launching $concurrency clients" 20 | fi 21 | 22 | for i in `seq 0 $[ $concurrency - 1 ]` 23 | do 24 | mkdir -p run-$i 25 | pushd run-$i > /dev/null || continue 26 | start=$[ $i * $registrations ] 27 | end=$[ $start + $registrations - 1 ] 28 | echo "launching ../register_performance.pl $start $end" 29 | ../register_performance.pl $start $end & 30 | popd > /dev/null || continue 31 | done 2>&1 | tee log 32 | -------------------------------------------------------------------------------- /tests/01-compile-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=$(dirname $0) 4 | 5 | res=0 6 | for ldir in 'www' 'client'; do 7 | echo "Checking $ldir" 8 | echo "Compile checking perl modules" 9 | find "$DIR/../$ldir/perl-lib" -name *.pm -exec perl -I "$DIR/../www/perl-lib" -I "$DIR/../client/perl-lib" -c '{}' \; 10 | 11 | echo "Compile checking scripts" 12 | if [ ! -d "$DIR/../$ldir/script" ]; then 13 | ldir="$ldir/../" 14 | fi 15 | for f in `find "$DIR/../$ldir/script" -executable -type f`; do 16 | t=$(file "$f") 17 | if echo "$t" | grep -q Perl; then 18 | f=$(echo "$t" | cut -d: -f1) 19 | perl -I "$DIR/../www/perl-lib" -I "$DIR/../client/perl-lib" -c "$f" || res=1 20 | elif echo "$t" | grep -q Bourne; then 21 | f=$(echo "$t" | cut -d: -f1) 22 | bash -n "$f" && echo "$f syntax OK" || (echo "$f syntax FAIL" && res=1) 23 | fi 24 | done 25 | done 26 | 27 | exit $res 28 | -------------------------------------------------------------------------------- /www/perl-lib/SMT/Utils/RequestAgent.pm: -------------------------------------------------------------------------------- 1 | package SMT::Utils::RequestAgent; 2 | 3 | # 4 | # SMT::Utils::RequestAgent 5 | # Originally part of SMT::Utils. 6 | # It was taken out and into its own module file to prevent "subroutine redefined" errors. 7 | # 8 | 9 | use strict; 10 | use warnings; 11 | 12 | use LWP; 13 | use LWP::UserAgent; 14 | 15 | @SMT::Utils::RequestAgent::ISA = qw(LWP::UserAgent); 16 | 17 | sub new 18 | { 19 | my($class, $puser, $ppass, %cnf) = @_; 20 | 21 | my $self = $class->SUPER::new(%cnf); 22 | 23 | bless { 24 | puser => $puser, 25 | ppass => $ppass 26 | }, $class; 27 | } 28 | 29 | sub get_basic_credentials 30 | { 31 | my($self, $realm, $uri, $proxy) = @_; 32 | 33 | if($proxy) 34 | { 35 | if(defined $self->{puser} && defined $self->{ppass}) 36 | { 37 | return ($self->{puser}, $self->{ppass}); 38 | } 39 | } 40 | return (undef, undef); 41 | } 42 | 43 | 1; 44 | -------------------------------------------------------------------------------- /yast/agents/smt.scr: -------------------------------------------------------------------------------- 1 | /** 2 | * File: smt_staging.scr 3 | * 4 | * Summary: Agent for managing/filtering patches in mirrored repositories (.staging) 5 | * and for managing repositories (.repositories). 6 | * 7 | * Authors: Lukas Ocilka 8 | * 9 | * Example: 10 | * // Returns list of catalog maps, one map for each catalog 11 | * Read (.smt.staging.repositories) -> (list ) [ 12 | * $["CATALOGID":"6df36d5532f9a85b362a93a55f8452c6adb72165", 13 | * "CATALOGTYPE":"zypp", "DESCRIPTION":"openSUSE-11.0-Updates", 14 | * "DOMIRROR":"Y", "EXTHOST":"http://download.opensuse.org", 15 | * "EXTURL":"http://download.opensuse.org/update/11.0", 16 | * "LOCALPATH":"RPMMD/openSUSE-11.0-Updates", "MIRRORABLE":"Y", 17 | * "NAME":"openSUSE-11.0-Updates", "SRC":"N", "STAGING":"Y", "TARGET":" 18 | * ], 19 | * ... 20 | * ] 21 | * Read (.smt.staging.patches) 22 | * 23 | * FIXME: Add more examples 24 | */ 25 | 26 | .smt 27 | 28 | `ag_smt () 29 | -------------------------------------------------------------------------------- /yast/icons/patch_status/patch-used.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * keepinstalled_xpm[] = { 3 | "22 16 21 1", 4 | " c None", 5 | ". c #EEEEEC", 6 | "+ c #2E3436", 7 | "@ c #919494", 8 | "# c #989A9A", 9 | "$ c #2F3537", 10 | "% c #9EA1A0", 11 | "& c #8E9191", 12 | "* c #939696", 13 | "= c #303638", 14 | "- c #A5A7A6", 15 | "; c #EEEEED", 16 | "> c #EDEDEC", 17 | ", c #9C9F9F", 18 | "' c #32383A", 19 | ") c #A9ACAB", 20 | "! c #EFEFEC", 21 | "~ c #D7D7D6", 22 | "{ c #EDEDEB", 23 | "] c #5E6263", 24 | "^ c #A5A8A7", 25 | " ", 26 | " .............. ", 27 | " .++++++++++++. ", 28 | " .++++++++++++. ", 29 | " .+++++++++++@. ", 30 | " .++++++++++#. ", 31 | " .++++++++$%. . ", 32 | " .+++&*++=-; .. ", 33 | " .++&.>,')! .&. ", 34 | " .++&. ;~; .&+. ", 35 | " .+++&. .&++. ", 36 | " .++++&.{.&+++. ", 37 | " .+++++]^]++++. ", 38 | " .++++++++++++. ", 39 | " .............. ", 40 | " "}; 41 | -------------------------------------------------------------------------------- /devel-scripts/testClientAuthentication.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -wT 2 | 3 | use SMT::Client; 4 | use Data::Dumper; 5 | use SMT::Utils; 6 | 7 | $dbh = SMT::Utils::db_connect(); 8 | exit 1 unless defined $dbh; 9 | $cro = SMT::Client->new({'dbh' => $dbh}); 10 | 11 | $res = undef; 12 | 13 | #$res = $cro->getClientsInfo({ 14 | # 'GUID' => 'guid15' 15 | # ,'SECRET' => 'secret15' 16 | # }); 17 | $res = $cro->authenticateByIDAndSecret('15', 'secret15'); 18 | print Data::Dumper->Dump([$res],["id15-auth"])."\n"; 19 | 20 | #$res = $cro->getClientsInfo({ 21 | # 'GUID' => 'guid15' 22 | # ,'SECRET' => '' 23 | # }); 24 | $res = $cro->authenticateByIDAndSecret('15', undef); 25 | print Data::Dumper->Dump([$res],["id15-auth-wrong"])."\n"; 26 | 27 | $res = $cro->getClientsInfo({ 28 | 'ID' => '15' 29 | ,'selectAll' => '' 30 | ,'SECRET' => undef 31 | }); 32 | print Data::Dumper->Dump([$res],["id15-auth-all"])."\n"; 33 | -------------------------------------------------------------------------------- /yast/agents/smt_conf.scr: -------------------------------------------------------------------------------- 1 | /** 2 | * File: 3 | * smt_conf.scr 4 | * Summary: 5 | * SCR Agent for reading/writing /etc/smt.conf 6 | * using the ini-agent 7 | * Access: 8 | * read/write 9 | * Authors: 10 | * Lukas Ocilka 11 | * 12 | * Example: 13 | * Read (.smt_conf.value.NU.NUUser) 14 | * ("john_the_fish") 15 | * Write (.smt_conf.value.NU.NUUser, "Howard") 16 | * (true) 17 | * 18 | * $Id: $ 19 | * 20 | * Read/Sets the values defined in /etc/smt.conf. 21 | */ 22 | .smt_conf 23 | 24 | `ag_ini( 25 | `IniAgent( 26 | "/etc/smt.conf", 27 | $[ 28 | "comments": [ "^[ \t]*#.*", "^[ \t]*$" ], 29 | "sections" : [ 30 | $[ 31 | "begin" : [ "^[ \t]*\\[[ \t]*(.*[^ \t])[ \t]*\\][ \t]*", "[%s]" ], 32 | ], 33 | ], 34 | "params" : [ 35 | $[ 36 | "match" : [ "^[ \t]*([^=]*[^ \t=])[ \t]*=[ \t]*(.*[^ \t]|)[ \t]*$", 37 | "%s = %s"], 38 | ], 39 | ], 40 | ] 41 | ) 42 | ) 43 | -------------------------------------------------------------------------------- /tests/testdata/regdatatest/catalogs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9396b5a1b07087f5a78bd8ffdf2aad7fd2815ef2 5 | SLED10-SP1-Updates 6 | SLED10-SP1-Updates for sled-10-i586 7 | sled-10-i586 8 | https://nu.novell.com/ 9 | 10 | https://nu.novell.com/repo/$RCE/SLED10-SP1-Updates/sled-10-i586/ 11 | 12 | nu 13 | 14 | 15 | 7a51c83a1d5d79f9591d931428bb10f6a5c420c5 16 | ATI-Driver-SP1 17 | ATI Driver for SP1 18 | 19 | http://www2.ati.com/ 20 | http://www2.ati.com/suse/sle10sp1/ 21 | zypp 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/integration/smt_server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.suse.com/sles12sp2 2 | 3 | RUN zypper --non-interactive rm container-suseconnect &&\ 4 | zypper --non-interactive ar \ 5 | http://download.suse.de/ibs/SUSE/Products/SLE-SERVER/12-SP2/x86_64/product/ sles12sp2_pool &&\ 6 | zypper --non-interactive ar \ 7 | http://download.suse.de/ibs/SUSE/Updates/SLE-SERVER/12-SP2/x86_64/update sles12sp2_updates &&\ 8 | zypper ar http://download.suse.de/ibs/SUSE/Products/SLE-SDK/12-SP2/x86_64/product sles12sp2_sdk &&\ 9 | zypper ref && zypper --non-interactive install --no-recommend \ 10 | timezone patch mariadb-client libopenssl-devel 11 | 12 | ADD files/smt_current.rpm /root/smt_current.rpm 13 | RUN zypper --non-interactive --no-gpg-checks in --no-recommend /root/smt_current.rpm 14 | 15 | ADD files/run.sh /root/run.sh 16 | ADD files/p1.patch /root/p1.patch 17 | RUN touch /etc/zypp/credentials.d/SCCcredentials 18 | RUN cd / && patch -p0 < /root/p1.patch 19 | 20 | ENTRYPOINT ["/root/run.sh"] 21 | CMD ["/usr/sbin/apache2ctl", "-DFOREGROUND"] 22 | -------------------------------------------------------------------------------- /xml/examples/patch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Specially crafted files could cause a buffer overflow in 4 | htmldoc (CVE-2009-3050). 5 | 6 | 7 | 8 | 9 | https://nu.novell.com/repo/$RCE/SLE11-SMT-Updates/sle-11-i586/rpm/i586/htmldoc-1.8.27-170.4.1.i586.rpm 10 | http://kompost.suse.cz/repo/$RCE/SLE11-SMT-Updates/sle-11-i586/rpm/i586/htmldoc-1.8.27-170.4.1.i586.rpm 11 | 12 | 13 | 14 | 15 | 16 | 17 | Security update for htmldoc 18 | -------------------------------------------------------------------------------- /yast/agents/smt_cron.scr: -------------------------------------------------------------------------------- 1 | /** 2 | * File: 3 | * smt_cron.scr 4 | * Summary: 5 | * SCR Agent for reading/writing /etc/cron.d/novell.com-smt 6 | * using the any-agent 7 | * Access: 8 | * read/write 9 | * Authors: 10 | * Lukas Ocilka 11 | * 12 | * $Id:$ 13 | * 14 | * Read/Sets the values defined in /etc/cron.d/novell.com-smt 15 | * original file /etc/smt.d/novell.com-smt is not used any more 16 | */ 17 | .smt_cron 18 | 19 | `ag_anyagent ( 20 | `Description ( 21 | (`File ("/etc/cron.d/novell.com-smt")), // read this file` 22 | "#\n", // comments 23 | false, // read/write 24 | (`List ( 25 | `Tuple ( 26 | `minute (`String ("^ \t")), 27 | `Whitespace(), 28 | `hour (`String ("^ \t")), 29 | `Whitespace(), 30 | `day_of_month (`String ("^ \t")), 31 | `Whitespace(), 32 | `month (`String ("^ \t")), 33 | `Whitespace(), 34 | `day_of_week (`String ("^ \t")), 35 | `Whitespace(), 36 | `user (`String ("^ \t")), 37 | `Whitespace(), 38 | `command (`String ("^\n")) 39 | ), 40 | "\n" 41 | )) 42 | ) 43 | ) 44 | -------------------------------------------------------------------------------- /add-on/installation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | control-YEP 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | yes 13 | yes 14 | 15 | 16 | continue 17 | installation 18 | 19 | 20 | 21 | suseconfig 22 | 23 | 24 | 25 | smt 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /devel-scripts/relations-test.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | use SMT::Utils; 6 | use Text::ASCIITable; 7 | 8 | 9 | my $dbh = SMT::Utils::db_connect(); 10 | 11 | my $statement = "select p.PRODUCT, p.VERSION, p.REL, p.ARCH, c.NAME, c.TARGET, pc.OPTIONAL, pc.PRODUCTDATAID, pc.CATALOGID from Products p, Catalogs c, ProductCatalogs pc where p.PRODUCTDATAID=pc.PRODUCTDATAID and pc.CATALOGID=c.CATALOGID order by p.PRODUCT, p.VERSION, p.REL, p.ARCH, c.NAME, c.TARGET; "; 12 | 13 | my $res = $dbh->selectall_arrayref($statement, {Slice=>{}}); 14 | 15 | my $t = new Text::ASCIITable; 16 | $t->setCols( "PRODID", "CATALOGID", "PRODUCT", "CATALOG", "OPT" ); 17 | 18 | foreach my $set (@{$res}) 19 | { 20 | $set->{VERSION} = "" if(!defined $set->{VERSION}); 21 | $set->{REL} = "" if(!defined $set->{REL}); 22 | $set->{ARCH}= "" if(!defined $set->{ARCH}); 23 | $set->{TARGET}= "" if(!defined $set->{TARGET}); 24 | $t->addRow( $set->{PRODUCTDATAID}, $set->{CATALOGID}, $set->{PRODUCT}." ".$set->{VERSION}." ".$set->{REL}." ".$set->{ARCH}, $set->{NAME}."/".$set->{TARGET}, $set->{OPTIONAL}); 25 | } 26 | print $t->draw(); 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /add-on/README: -------------------------------------------------------------------------------- 1 | Creating the Add-On Product 2 | --------------------------- 3 | Run `make dist` to create y2update.tgz 4 | 5 | An add-on product contains (also) 6 | * RPMs (in /suse/ directory) 7 | * /y2update.tgz (which contains the inst-sys update) 8 | * installation.xml (that defines the add-on workflow) 9 | * content file describes the product 10 | 11 | Installation - Second Stage 12 | --------------------------- 13 | Add-on must require the 'yep-base' patern that will contain (at least) 14 | yast2-yep RPM package. This pattern/package(s) must be installed before 15 | running the add-on workflow in a second stage. 16 | 17 | Installation - Running System 18 | ----------------------------- 19 | On a running system (/sbin/yast2 add-on), installation workflow will call 20 | sw_single first with pre-selecetd 'yep-base' (required by the product), after 21 | the packages get installed, YEP configuration will be called. 22 | 23 | The other option is to have a y2update.tgz file that would contain the 24 | YaST configurator and a special YaST script that would make sure that 25 | all the needed packages get installed before running the configuration 26 | scripts. 27 | -------------------------------------------------------------------------------- /performance2/launch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | free=$(free | grep ^Mem: | awk '{ print $4; }') 4 | maxclients=$[ $free / 10240 ] 5 | progname=${0##*/} 6 | 7 | if [ -z "$1" -o -z "$2" -o "$1" = "-h" ]; then 8 | echo "usage: $progname [] []" 9 | exit 1 10 | fi 11 | 12 | concurrency=$1 13 | registrations=$2 14 | if [ -z "$4" ]; then 15 | options=$3 16 | guidprefix="a" 17 | else 18 | guidprefix=$3 19 | options=$4 20 | fi 21 | 22 | if [ $maxclients -lt $concurrency ]; then 23 | echo "too much clients requested (max=$maxclients) ... aborting." 24 | exit 1 25 | else 26 | echo "launching $concurrency clients" 27 | fi 28 | 29 | for i in `seq 0 $[ $concurrency - 1 ]` 30 | do 31 | mkdir -p run-$i 32 | pushd run-$i > /dev/null || continue 33 | start=$[ $i * $registrations ] 34 | end=$[ $start + $registrations - 1 ] 35 | ln -sf ../suse_register . 36 | echo "launching ../repeatedStart.pl $start $end $guidprefix $options" 37 | ../repeatedStart.pl $start $end "$guidprefix" "$options" & 38 | popd > /dev/null || continue 39 | done 2>&1 | tee log 40 | -------------------------------------------------------------------------------- /yast/src/clients/smt.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | # File: clients/smt.ycp 4 | # Package: Configuration of smt 5 | # Summary: Main file 6 | # Authors: Lukas Ocilka 7 | # 8 | # $Id: smt.ycp 27914 2006-02-13 14:32:08Z locilka $ 9 | # 10 | # Main file for smt configuration. Uses all other files. 11 | module Yast 12 | class SmtClient < Client 13 | def main 14 | Yast.import "UI" 15 | textdomain "smt" 16 | 17 | Yast.import "CommandLine" 18 | Yast.import "Mode" 19 | Yast.import "GetInstArgs" 20 | 21 | Yast.include self, "smt/wizard.rb" 22 | 23 | if Builtins.size(GetInstArgs.argmap) == 0 && 24 | Ops.greater_than(Builtins.size(WFM.Args), 0) 25 | Mode.SetUI("commandline") 26 | Builtins.y2milestone("Mode CommandLine not supported, exiting...") 27 | # TRANSLATORS: error message - the module does not provide command line interface 28 | CommandLine.Print( 29 | _("There is no user interface available for this module.") 30 | ) 31 | return :auto 32 | end 33 | 34 | Convert.to_symbol(SMTManagementSequence()) 35 | end 36 | end 37 | end 38 | 39 | Yast::SmtClient.new.main 40 | -------------------------------------------------------------------------------- /tests/integration/rspec/spec/smt_client/smt_client_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'zypper repos', :type => :aruba do 4 | before(:each) { run('zypper repos') } 5 | before(:each) { stop_all_commands } 6 | 7 | it "executes without errors" do 8 | expect( last_command_started ).to be_successfully_executed 9 | end 10 | 11 | it "has at least one repo with enabled mirroring" do 12 | smt_repos_counter = 0 13 | last_command_started.stdout.split("\n").each { |line| 14 | smt_repos_counter += 1 if ( line =~ /SMT\-http/ ) 15 | } 16 | 17 | expect( smt_repos_counter ).to be >= 1 18 | end 19 | end 20 | 21 | describe 'SCC credentials file', :type => :aruba do 22 | let(:file) { '/etc/zypp/credentials.d/SCCcredentials' } 23 | 24 | it "exists" do 25 | expect( File.exists?(file) ).to be true 26 | end 27 | 28 | it "is not empty" do 29 | expect(File.size(file)).to be > 0 30 | end 31 | end 32 | 33 | describe 'SMT credentials file', :type => :aruba do 34 | let(:files) { Dir.glob('/etc/zypp/credentials.d/SMT-*') } 35 | 36 | it "exists" do 37 | expect( files.count ).to be 1 38 | end 39 | 40 | it "is not empty" do 41 | expect(File.size(files[0])).to be > 0 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /cron/smt-repeated-register: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # smt-repeated-register 4 | 5 | 6 | PATH="/sbin:/usr/sbin:/usr/bin:/bin" 7 | SMTCMD=/usr/sbin/smt 8 | . /etc/smt.d/smt-cron.conf 9 | 10 | while read line ; do 11 | case "$line" in 12 | \#*|"") continue ;; 13 | esac 14 | eval val=${line#*=} 15 | case "$line" in 16 | PROXY_ENABLED=*) 17 | PROXY_ENABLED="${val}" 18 | ;; 19 | HTTP_PROXY=*) 20 | test -n "$val" || continue 21 | http_proxy="${val}" 22 | export http_proxy 23 | ;; 24 | HTTPS_PROXY=*) 25 | test -n "$val" || continue 26 | https_proxy="${val}" 27 | export https_proxy 28 | ;; 29 | esac 30 | done < /etc/sysconfig/proxy 31 | unset sys line val 32 | 33 | if test "$PROXY_ENABLED" != "yes" ; then 34 | unset http_proxy https_proxy 35 | fi 36 | unset PROXY_ENABLED 37 | 38 | 39 | if [ -x ${SMTCMD}-register ] 40 | then 41 | ${SMTCMD}-register ${REGISTER_PARAMS} 42 | else 43 | echo "WARNING: Could not find the SMT binary ${SMTCMD}-register" 44 | echo " Please make sure SMT is properly installed." 45 | fi 46 | 47 | # in cronjobs always do an exit 0 - even on errors - exit 1 only in case of real panic 48 | exit 0 49 | -------------------------------------------------------------------------------- /tests/integration/README.md: -------------------------------------------------------------------------------- 1 | # Building the RPM package 2 | 3 | 1. Checkout the project from OBS into some directory: 4 | ``` 5 | mkdir -p ~/obs/ 6 | cd ~/obs/ 7 | osc -A https://api.suse.de co Devel:SMT:SLE-12-SMT 8 | ``` 9 | 2. Make the tarball in git working directory by running `make package` 10 | 3. Update the data from OBS by the tarball and metadata from git: 11 | ``` 12 | cp package/* ~/obs/Devel:SMT:SLE-12-SMT/smt 13 | ``` 14 | 4. Build the RPM package by running `osc build` in the OBS working directory. 15 | 16 | # Testing the RPM package 17 | 18 | 1. The docker image expects the RPM package to be present in the following 19 | location: 20 | ``` 21 | smt_server/files/smt_current.rpm 22 | ``` 23 | 2. Build docker images with `docker-compose build` 24 | 3. Run the containers with `docker-compose up` 25 | 4. After the containers finish loading, find out the name of the container 26 | by running `docker-exec ps` 27 | 5. To run SMT server tests in the `smt_server` container run: 28 | ``` 29 | docker-compose exec smt_server bash 30 | cd /rspec 31 | bundle 32 | rspec spec/smt_server 33 | ``` 34 | 6. To run SMT client tests in the `smt_client` container run: 35 | ``` 36 | docker-compose exec smt_client bash 37 | cd /rspec 38 | bundle 39 | rspec spec/smt_client 40 | ``` 41 | -------------------------------------------------------------------------------- /doc/SMT-Database-Upgrade.txt: -------------------------------------------------------------------------------- 1 | 2 | First database version is 0.02 3 | Current database version is 0.03 4 | 5 | Current schema version is defined in SMT.pm 6 | 7 | Read 8 | http://search.cpan.org/~crakrjack/DBIx-Migration-Directories-0.05/lib/DBIx/Migration/Directories.pod#DIRECTORY_LAYOUT 9 | for informations about the structure in db/schemas/ and how to use it. 10 | 11 | 12 | Short introduction for a new schema version 13 | 14 | as example we use old schema 0.03 and new schema 0.04 15 | $driver is mysql or _common if the statements are compatible or not. 16 | 17 | - add a directoy db/schemas/$driver/0.04 18 | - put all scripts needed to do an initial setup of this version into 19 | this directory. The name defined the execution order. 20 | Tip: use names like this: 21 | 22 | 100_create_new_table.sql 23 | 110_insert_data.sql 24 | 25 | - for migration create a directory - 26 | 27 | 0.03-0.04 for upgrade and put scripts into this directory 28 | to upgrade from version 0.03 to 0.04 29 | (e.g. alter table statements, etc.) 30 | 31 | 0.04-0.03 for downgrade 32 | 33 | See 34 | http://search.cpan.org/~crakrjack/DBIx-Migration-Directories-0.05/lib/DBIx/Migration/Directories.pod#___top 35 | for more info about the layout after they get installed 36 | -------------------------------------------------------------------------------- /www/perl-lib/SMT/Client/exampleVerify.pm: -------------------------------------------------------------------------------- 1 | package SMT::Client::exampleVerify; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Apache2::RequestRec (); 7 | use Apache2::RequestIO (); 8 | 9 | sub verifyGuest { 10 | 11 | my $self = shift; 12 | my $r = shift; 13 | my $regroot = shift; 14 | # Insert code to connect to cloud framework and verify the guest 15 | # return 1 for successful verification, undef for verification failure 16 | # $r -> the request, i.e an Apache request object 17 | # http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html 18 | # $regroot -> HASHREF containing information sent by the client. 19 | return 1; 20 | } 21 | 22 | sub verifySCCGuest { 23 | 24 | my $self = shift; 25 | my $r = shift; 26 | my $clntData = shift; 27 | my $result = shift; 28 | # Insert code to connect to cloud framework and verify the guest 29 | # return the result HASHREF for successful verification, undef for 30 | # verification failure 31 | # $r -> the request, i.e an Apache request object 32 | # http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html 33 | # $clntData -> data received from the client 34 | # $result -> HASHREF of results of various previous operations 35 | return $result; 36 | } 37 | 38 | 1; 39 | -------------------------------------------------------------------------------- /tests/integration/smt_server/files/p1.patch: -------------------------------------------------------------------------------- 1 | diff -Naur usr/lib/perl5/vendor_perl/5.18.2/SMT/SCCSync.pm /usr/lib/perl5/vendor_perl/5.18.2/SMT/SCCSync.pm 2 | --- usr/lib/perl5/vendor_perl/5.18.2/SMT/SCCSync.pm 2016-09-22 12:47:34.000000000 +0000 3 | +++ /usr/lib/perl5/vendor_perl/5.18.2/SMT/SCCSync.pm 2016-10-18 15:11:31.851162560 +0000 4 | @@ -143,7 +143,7 @@ 5 | else 6 | { 7 | $self->{USERAGENT} = SMT::Utils::createUserAgent(log => $self->{LOG}, vblevel => $self->{VBLEVEL}); 8 | - $self->{USERAGENT}->protocols_allowed( [ 'https'] ); 9 | + $self->{USERAGENT}->protocols_allowed( [ 'https', 'http' ] ); 10 | } 11 | 12 | my ($ruri, $user, $pass) = SMT::Utils::getLocalRegInfos(); 13 | diff -Naur usr/lib/perl5/vendor_perl/5.18.2/SMT/Utils.pm /usr/lib/perl5/vendor_perl/5.18.2/SMT/Utils.pm 14 | --- usr/lib/perl5/vendor_perl/5.18.2/SMT/Utils.pm 2016-09-22 12:47:34.000000000 +0000 15 | +++ /usr/lib/perl5/vendor_perl/5.18.2/SMT/Utils.pm 2016-10-18 15:11:31.851162560 +0000 16 | @@ -398,7 +398,7 @@ 17 | } 18 | 19 | $uri = $cfg->val('NU', 'NURegUrl'); 20 | - if(!defined $uri || $uri !~ /^https/) 21 | + if(!defined $uri || $uri !~ /^http/) 22 | { 23 | open(FH, "< /etc/suseRegister.conf") or die sprintf(__("Cannot open /etc/suseRegister.conf: %s"), $!); 24 | while() 25 | -------------------------------------------------------------------------------- /tests/testdata/regdatatest/registrations.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | ab6205f37503eed745 5 | 6 | 1badbeef4abadb01 7 | 8 | FULL 9 | ACTIVE 10 | 1202149301 11 | 1202149302 12 | 60 13 | ADDON 14 | 15 | 16 | 17 | e164badbeef4abadb01 18 | 19 | FULL 20 | ACTIVE 21 | 1202149301 22 | 1202149302 23 | 60 24 | ADDON 25 | 26 | 27 | 28 | adbeef4abadb013564 29 | 30 | FULL 31 | ACTIVE 32 | 1202149301 33 | 1202149302 34 | 60 35 | ADDON 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /doc/Use-smt-User-for-commands.txt: -------------------------------------------------------------------------------- 1 | Proposal: 2 | 3 | How to use a special user (e.g. smt) to execute the commands, 4 | instead of "root". 5 | 6 | * create a system user "smt" in RPM pre section and give him 7 | permissions to read/write directories and files where neccesary. 8 | 9 | * this user get the home /var/lib/empty and as bash /bin/false. 10 | 11 | * customer still login as root to call the smt commands. 12 | 13 | * the smt commands switch to the smt user, if the calling uid is 0 (root) 14 | In case a normal user is calling the smt commands, no switch happens. 15 | 16 | * we should provide a script which is doing all the chown/chmod things for 17 | customers who want to use there special user for alling smt commands. 18 | (e.g. there user is in global ldap directory to prevent switching uidnumbers, 19 | when mirroring to a NFS mounted directory) 20 | 21 | 22 | =============================================================================== 23 | 24 | Files and Directories which need different owners: 25 | 26 | * 0644 smt,www /var/log/smt 27 | * 0644 smt,www /var/run/smt 28 | * 0600 smt,root /etc/zypp/credentials.d/NCCcredentials 29 | * what about /root/.curlrc ? Because of the proxy user password? 30 | * smt.conf [LOCAL] MirrorTo: 0644 smt,root (recursive) 31 | (or better group www? If we download a new file it is created with 32 | group www) 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /cron/smt-gen-report: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # 4 | # smt-gen-report 5 | # This script generate a new report for the SMT service. 6 | # It syncs subscriptions and registrations from NCC to the local SMT 7 | # generate a report and send it via email 8 | 9 | PATH="/sbin:/usr/sbin:/usr/bin:/bin" 10 | SMTCMD=/usr/sbin/smt 11 | . /etc/smt.d/smt-cron.conf 12 | 13 | while read line ; do 14 | case "$line" in 15 | \#*|"") continue ;; 16 | esac 17 | eval val=${line#*=} 18 | case "$line" in 19 | PROXY_ENABLED=*) 20 | PROXY_ENABLED="${val}" 21 | ;; 22 | HTTP_PROXY=*) 23 | test -n "$val" || continue 24 | http_proxy="${val}" 25 | export http_proxy 26 | ;; 27 | HTTPS_PROXY=*) 28 | test -n "$val" || continue 29 | https_proxy="${val}" 30 | export https_proxy 31 | ;; 32 | esac 33 | done < /etc/sysconfig/proxy 34 | unset sys line val 35 | 36 | if test "$PROXY_ENABLED" != "yes" ; then 37 | unset http_proxy https_proxy 38 | fi 39 | unset PROXY_ENABLED 40 | 41 | 42 | if [ -x ${SMTCMD}-report ] 43 | then 44 | ${SMTCMD}-report ${REPORT_PARAMS} 45 | else 46 | echo "WARNING: Could not find the SMT binary ${SMTCMD}-report" 47 | echo " Please make sure SMT is properly installed." 48 | fi 49 | 50 | # in cronjobs always do an exit 0 - even on errors - exit 1 only in case of real panic 51 | exit 0 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /yast/src/clients/smt-server.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | # File: clients/smt.ycp 4 | # Package: Configuration of smt 5 | # Summary: Main file 6 | # Authors: Lukas Ocilka 7 | # 8 | # $Id: smt.ycp 27914 2006-02-13 14:32:08Z locilka $ 9 | # 10 | # Main file for smt configuration. Uses all other files. 11 | module Yast 12 | class SmtServerClient < Client 13 | def main 14 | Yast.import "UI" 15 | textdomain "smt" 16 | 17 | Yast.import "CommandLine" 18 | Yast.import "Mode" 19 | Yast.import "GetInstArgs" 20 | 21 | Yast.include self, "smt/wizard.rb" 22 | 23 | if Builtins.size(GetInstArgs.argmap) == 0 && 24 | Ops.greater_than(Builtins.size(WFM.Args), 0) 25 | Mode.SetUI("commandline") 26 | Builtins.y2milestone("Mode CommandLine not supported, exiting...") 27 | # TRANSLATORS: error message - the module does not provide command line interface 28 | CommandLine.Print( 29 | _("There is no user interface available for this module.") 30 | ) 31 | return :auto 32 | end 33 | 34 | # Registering new agents installed during the current 35 | # y2base run, bnc #384994 36 | if Mode.installation 37 | Builtins.y2milestone("Registering new SCR Agents") 38 | SCR.RegisterNewAgents 39 | end 40 | 41 | Convert.to_symbol(SMTSequence()) 42 | end 43 | end 44 | end 45 | 46 | Yast::SmtServerClient.new.main 47 | -------------------------------------------------------------------------------- /tests/integration/smt_server/files/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SMT_CONFIG=/etc/smt.conf 4 | 5 | while ! exec 6<>/dev/tcp/db/3306; do 6 | echo "$(date) - still trying to connect to MySQL at db linked container" 7 | sleep 1 8 | done 9 | 10 | sed -i "s|^NURegUrl=.*$|NURegUrl=${SCC_REGSERVER_URL}|" $SMT_CONFIG 11 | sed -i "s/^NUUser=.*$/NUUser=${SCC_USERNAME}/" $SMT_CONFIG 12 | sed -i "s/^NUPass=.*$/NUPass=${SCC_PASSWORD}/" $SMT_CONFIG 13 | grep -q ApiType=SCC $SMT_CONFIG || sed -i "/NUPass=${SCC_PASSWORD}/a ApiType=SCC" $SMT_CONFIG 14 | sed -i "s/^config=dbi.*$/config=dbi:mysql:database=smt;host=db/" $SMT_CONFIG 15 | sed -i "s/^user=.*$/user=${SMT_DB_USER}/" $SMT_CONFIG 16 | sed -i "s/^pass=.*$/pass=${SMT_DB_PASSWORD}/" $SMT_CONFIG 17 | sed -i "s/^url=.*$/url=http:\/\/${HOSTNAME}/" $SMT_CONFIG 18 | 19 | mysql -h db -u root -p${MYSQL_ROOT_PASSWORD} -e "DROP DATABASE IF EXISTS smt; CREATE DATABASE smt;" 20 | mysql -h db -u root -p${MYSQL_ROOT_PASSWORD} -e "DROP USER $SMT_DB_USER;" 21 | mysql -h db -u root -p${MYSQL_ROOT_PASSWORD} -e "CREATE USER '$SMT_DB_USER'@'%' identified by '$SMT_DB_PASSWORD';" 22 | mysql -h db -u root -p${MYSQL_ROOT_PASSWORD} -e "GRANT ALL ON *.* TO '$SMT_DB_USER'@'%';" 23 | 24 | # Preload SMT Schema 25 | mysql -h db -u${SMT_DB_USER} -p${SMT_DB_PASSWORD} -D smt < /usr/share/schemas/smt/mysql/latest/100-smt-tables.sql 26 | 27 | smt-sync 28 | smt-repos --enable-by-prod SLES,12.2,x86_64 29 | 30 | echo "OK" > /srv/www/htdocs/status 31 | 32 | exec "$@" 33 | -------------------------------------------------------------------------------- /tests/SMT/Mirror/RpmMd.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use File::Temp; 3 | 4 | BEGIN { 5 | push @INC, "../www/perl-lib"; 6 | } 7 | 8 | use SMT::Mirror::RpmMd; 9 | use IO::Zlib; 10 | use Test::Simple tests => 6; 11 | 12 | # FIXME need some solid URI, ideally an ad hoc local http server 13 | my $url = 'http://download.opensuse.org/repositories/home:/jkupec/openSUSE_11.1/'; 14 | my $tempdir = File::Temp::tempdir(CLEANUP => 1); 15 | print STDERR "Saving $url to $tempdir\n"; 16 | 17 | $mirror = SMT::Mirror::RpmMd->new(); 18 | $mirror->uri( $url ); 19 | $mirror->localBasePath("$tempdir"); 20 | $mirror->localRepoPath(''); 21 | $mirror->vblevel(0xffff); 22 | 23 | ok($mirror->mirror() == 0, "should mirror ok"); 24 | ok($mirror->statistic()->{TOTALFILES} != $mirror->statistic()->{UPTODATE}, "first mirror() should download all the files"); 25 | ok($mirror->verify(), "mirrored data should pass checksum verifications"); 26 | ok($mirror->mirror() == 0, "second mirror should work"); 27 | ok($mirror->statistic()->{TOTALFILES} == $mirror->statistic()->{UPTODATE}, "second mirror() should not download anything"); 28 | 29 | # now lets corrupt the directory 30 | $fh = new IO::Zlib("$tempdir/repodata/other.xml.gz", "ab9"); 31 | if(defined $fh) 32 | { 33 | print $fh " "; 34 | $fh->close(); 35 | } 36 | else 37 | { 38 | die "Cannot open file $tempdir/repodata/other.xml.gz: $!"; 39 | } 40 | # now it should not verify 41 | ok( $mirror->verify() == 0, "should not verify after a file has been corrupted"); 42 | -------------------------------------------------------------------------------- /tests/SMT/Parser/FilteredRepoChecker.pl: -------------------------------------------------------------------------------- 1 | #! /usr/bin/perl -w 2 | 3 | BEGIN { 4 | push @INC, "../www/perl-lib"; 5 | } 6 | 7 | use strict; 8 | use Test::Simple tests => 6; 9 | use Cwd; 10 | 11 | #use SMT::Utils; 12 | #use Data::Dumper; 13 | 14 | use SMT::Parser::FilteredRepoChecker; 15 | 16 | 17 | my $wd = Cwd::cwd(); # current working dir 18 | 19 | #my $log = SMT::Utils::openLog('/local/jkupec/tmp/smt.log'); 20 | #my $vblevel = LOG_DEBUG|LOG_DEBUG2|LOG_WARN|LOG_ERROR|LOG_INFO1|LOG_INFO2; 21 | 22 | my $checker = SMT::Parser::FilteredRepoChecker->new(); #log => $log, vblevel => $vblevel); 23 | $checker->repoPath($wd . '/testdata/rpmmdtest/sharedpkgs'); # FIXME this should use the testdir 24 | 25 | my $filter = SMT::Filter->new(); 26 | $filter->add(SMT::Filter->TYPE_NAME_VERSION, 'imap-368'); 27 | $checker->filter($filter); 28 | 29 | my ($result, $problems, $causes) = $checker->check(); 30 | 31 | #print Dumper($result, $problems, $causes); 32 | 33 | ok (!$result); 34 | 35 | ok (exists $problems->{'imap-lib-2006c1_suse-127.1'} && 36 | $problems->{'imap-lib-2006c1_suse-127.1'} eq 'testsharedpkg-999'); 37 | 38 | ok (exists $causes->{'imap-lib-2006c1_suse-127.1'} && 39 | $causes->{'imap-lib-2006c1_suse-127.1'} eq 'imap-368'); 40 | 41 | $filter->remove(SMT::Filter->TYPE_NAME_VERSION, 'imap-368'); 42 | $filter->add(SMT::Filter->TYPE_NAME_VERSION, 'logwatch-658'); 43 | ($result, $problems, $causes) = $checker->check(); 44 | 45 | ok ($result); 46 | ok (!%$problems); 47 | ok (!%$causes); -------------------------------------------------------------------------------- /script/reschedule-sync.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # find out if a reschedule is needed 4 | # cron job hour is 0 or 1: than it is needed 5 | 6 | JOBNAME="smt-daily" 7 | REPORT="smt-gen-report" 8 | CRON_SRC_PATH="/etc/cron.d/novell.com-smt" 9 | CRON_DST_PATH="/etc/cron.d/novell.com-smt-randomized" 10 | CRON_RPMSAVE_PATH="/etc/cron.d/novell.com-smt.rpmsave" # needs to be cleaned up if exists from older versions 11 | 12 | if [ -e "$CRON_RPMSAVE_PATH" ]; then 13 | rm $CRON_RPMSAVE_PATH 14 | fi 15 | 16 | if [ ! -r "$CRON_SRC_PATH" ]; then 17 | exit 1 18 | fi 19 | 20 | if [ -e "$CRON_DST_PATH" ]; then 21 | # no need to reschedule 22 | echo "no reschedule needed" 23 | exit 0 24 | fi 25 | 26 | TMP_FILE=`mktemp "${CRON_DST_PATH}.XXXXXX" 2>/dev/null` 27 | if [ ! -e $TMP_FILE ]; then 28 | echo "unable to create tmp file" >&2 29 | exit 1 30 | fi 31 | 32 | # reschedule - calc new time 33 | 34 | # HOUR between 20 - 2 (59) 35 | DAILY_HOUR=`echo "($RANDOM % 7 + 20) % 24" | bc` 36 | DAILY_MINUTE=`echo "$RANDOM % 60" | bc` 37 | 38 | # Report between 4 - 7 am 39 | REPORT_HOUR=`echo "$RANDOM % 3 + 4" | bc` 40 | REPORT_MINUTE=`echo "$RANDOM % 60" | bc` 41 | 42 | grep -v -E "$JOBNAME|$REPORT" $CRON_SRC_PATH | sed s/^###\\s*// > $TMP_FILE 43 | echo "$DAILY_MINUTE $DAILY_HOUR * * * root /usr/lib/SMT/bin/smt-daily" >> $TMP_FILE 44 | echo "$REPORT_MINUTE $REPORT_HOUR * * 1 root /usr/lib/SMT/bin/smt-gen-report" >> $TMP_FILE 45 | 46 | STAMP=`date +%Y%m%d%H%M%S` 47 | mv "$TMP_FILE" "$CRON_DST_PATH" 48 | 49 | rccron reload 50 | -------------------------------------------------------------------------------- /tests/integration/Jenkinsfile: -------------------------------------------------------------------------------- 1 | node('scc-smt-integration') { 2 | stage('checkout') { 3 | git url: 'https://github.com/SUSE/smt/', branch: 'SMT12' 4 | } 5 | 6 | stage('build rpm') { 7 | sh 'make package' 8 | dir('obs') { 9 | deleteDir() 10 | } 11 | dir('obs') { 12 | sh 'osc -A https://api.suse.de co Devel:SMT:SLE-12-SMT smt' 13 | dir('Devel:SMT:SLE-12-SMT/') { 14 | sh 'bash -c "cp ../../package/* smt/"' 15 | dir('smt') { 16 | sh 'osc -A https://api.suse.de build --trust-all-projects --no-verify --clean SLE_12 x86_64' 17 | } 18 | } 19 | } 20 | } 21 | 22 | stage('docker-compose build') { 23 | dir('tests/integration'){ 24 | sh 'cp ~/smt.env .env' 25 | sh 'bash -c "cp /var/tmp/build-root/SLE_12-x86_64/home/abuild/rpmbuild/RPMS/x86_64/smt-[0-9]*.x86_64.rpm smt_server/files/smt_current.rpm"' 26 | sh 'docker-compose build' 27 | } 28 | } 29 | 30 | stage('smt server tests') { 31 | dir('tests/integration'){ 32 | sh 'docker-compose run --rm smt_server bash -c "cd /rspec && bundle && rspec spec/smt_server/"' 33 | } 34 | } 35 | 36 | stage('smt client tests') { 37 | dir('tests/integration'){ 38 | sh 'cp ~/smt.env .env' 39 | sh 'docker-compose run --rm smt_client bash -c "cd /rspec && bundle && rspec spec/smt_client/"' 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /www/perl-lib/SMT/RESTInfo.pm: -------------------------------------------------------------------------------- 1 | package SMT::RESTInfo; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Apache2::RequestRec (); 7 | use Apache2::RequestIO (); 8 | 9 | use Apache2::Const -compile => qw(OK SERVER_ERROR :log); 10 | use Apache2::RequestUtil; 11 | 12 | use XML::Writer; 13 | 14 | 15 | sub handler { 16 | my $r = shift; 17 | $r->log->info("RESTInfo request"); 18 | 19 | $r->content_type('text/html'); 20 | $r->err_headers_out->add('Cache-Control' => "no-cache, public, must-revalidate"); 21 | $r->err_headers_out->add('Pragma' => "no-cache"); 22 | 23 | my $writer = new XML::Writer(NEWLINES => 0); 24 | $writer->xmlDecl("UTF-8"); 25 | 26 | $writer->startTag('html'); 27 | $writer->startTag('head'); 28 | $writer->startTag('title'); 29 | $writer->characters('SMT REST Service'); 30 | $writer->endTag('title'); 31 | $writer->endTag('head'); 32 | 33 | $writer->startTag('body'); 34 | $writer->startTag('h2'); 35 | $writer->characters('SMT REST Service'); 36 | $writer->endTag('h2'); 37 | $writer->startTag('p'); 38 | $writer->characters('This is the REST service of SMT. It provides access to the SMT JobQueue for registered client machines.'); 39 | $writer->endTag('p'); 40 | $writer->startTag('p'); 41 | $writer->characters('To enable administrative access to the JobQueue and SMT Client information please enable it on the SMT server.'); 42 | $writer->endTag('p'); 43 | $writer->endTag('body'); 44 | $writer->endTag('html'); 45 | $writer->end(); 46 | 47 | return Apache2::Const::OK; 48 | } 49 | 1; 50 | -------------------------------------------------------------------------------- /swig/Makefile: -------------------------------------------------------------------------------- 1 | PERL ?= perl 2 | PERL_CC = $(shell $(PERL) -MExtUtils::Embed -e ccopts) 3 | PERL_LD = $(shell $(PERL) -MExtUtils::Embed -e ldopts) 4 | VENDOR_ARCH = $(shell $(PERL) -MConfig -e 'print $$Config{installvendorarch};') 5 | 6 | INCLUDES = $(PERL_CC) 7 | 8 | LIBS = $(PERL_LD) 9 | 10 | CXXFLAGS += -Wno-unused -fPIC -DPIC $(RPM_OPT_FLAGS) 11 | GCC = gcc 12 | 13 | MNAME = GRP 14 | 15 | all: $(MNAME).so 16 | 17 | clean: 18 | rm -f *.o 19 | rm -f $(MNAME).so 20 | rm -f *.c 21 | rm -f $(MNAME).pm 22 | rm -fr auto Sys 23 | 24 | $(MNAME).so: $(MNAME)_wrap.o 25 | $(GCC) -shared -o $(MNAME).so $< $(LDFLAGS) $(LIBS) 26 | @if test ! -d Sys; then mkdir -p Sys ; fi 27 | @if test ! -L Sys/$(MNAME).pm ; then \ 28 | ln -s ../$(MNAME).pm Sys/$(MNAME).pm ; \ 29 | fi 30 | @if test ! -d auto/Sys/$(MNAME) ; then \ 31 | mkdir -p auto/Sys/$(MNAME) ; \ 32 | fi 33 | @if test ! -L auto/Sys/$(MNAME)/$(MNAME).so ; then \ 34 | ln -s ../../../$(MNAME).so auto/Sys/$(MNAME)/$(MNAME).so ; \ 35 | fi 36 | 37 | $(MNAME)_wrap.o: $(MNAME)_wrap.c 38 | $(GCC) $(CXXFLAGS) $(INCLUDES) -c $< 39 | 40 | $(MNAME)_wrap.c: $(MNAME).i 41 | swig -perl5 -o $(MNAME)_wrap.c $< 42 | 43 | install: $(MNAME).so 44 | mkdir -p $(DESTDIR)/$(VENDOR_ARCH)/auto/Sys/$(MNAME) 45 | mkdir -p $(DESTDIR)/$(VENDOR_ARCH)/Sys/ 46 | install -m 644 $(MNAME).pm $(DESTDIR)/$(VENDOR_ARCH)/Sys/ 47 | install -m 755 $(MNAME).so $(DESTDIR)/$(VENDOR_ARCH)/auto/Sys/$(MNAME) 48 | 49 | dist: 50 | @mkdir -p ../$(NAME)-$(VERSION)/swig 51 | @cp Makefile ../$(NAME)-$(VERSION)/swig 52 | @cp $(MNAME).i ../$(NAME)-$(VERSION)/swig 53 | -------------------------------------------------------------------------------- /yast/icons/client_status/client-critical.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * warning_sign_xpm[] = { 3 | "16 16 58 1", 4 | " c None", 5 | ". c #760000", 6 | "+ c #770000", 7 | "@ c #9E0000", 8 | "# c #8B0000", 9 | "$ c #D72929", 10 | "% c #BB1414", 11 | "& c #AF0000", 12 | "* c #E1AEAE", 13 | "= c #8C0000", 14 | "- c #D94141", 15 | "; c #E5E5E5", 16 | "> c #B40000", 17 | ", c #E2ABAB", 18 | "' c #313131", 19 | ") c #8E0000", 20 | "! c #DA3C3C", 21 | "~ c #E8E7E7", 22 | "{ c #404040", 23 | "] c #B80000", 24 | "^ c #E4AAAA", 25 | "/ c #E9E9E9", 26 | "( c #4D4D4D", 27 | "_ c #900000", 28 | ": c #DB3939", 29 | "< c #EAE8E8", 30 | "[ c #EAEAEA", 31 | "} c #5B5B5B", 32 | "| c #BC0000", 33 | "1 c #E5A7A7", 34 | "2 c #ECECEC", 35 | "3 c #EBEBEB", 36 | "4 c #686868", 37 | "5 c #920000", 38 | "6 c #DC3333", 39 | "7 c #EDEAEA", 40 | "8 c #EDEDED", 41 | "9 c #E1E1E1", 42 | "0 c #C00000", 43 | "a c #E7A4A4", 44 | "b c #EFEFEF", 45 | "c c #EEEEEE", 46 | "d c #434343", 47 | "e c #940000", 48 | "f c #DC2F2F", 49 | "g c #F0ECEC", 50 | "h c #F0F0F0", 51 | "i c #5A5A5A", 52 | "j c #750000", 53 | "k c #C40000", 54 | "l c #E69393", 55 | "m c #F2F2F2", 56 | "n c #F1F1F1", 57 | "o c #990000", 58 | "p c #D10000", 59 | "q c #D60000", 60 | "r c #930000", 61 | "s c #9F0000", 62 | " .. ", 63 | " +@@+ ", 64 | " #$%# ", 65 | " +&**&+ ", 66 | " =-;;-= ", 67 | " +>,'',>+ ", 68 | " )!~{{~!) ", 69 | " +]^/((/^]+ ", 70 | " _:<[}}[<:_ ", 71 | " .|12344321|. ", 72 | " 567829928765 ", 73 | " #0abc8dd8cba0# ", 74 | " efghbciicbhgfe ", 75 | "jklmnhbccbhnmlkj", 76 | "opqqqqqqqqqqqqpo", 77 | "jrssssssssssssrj"}; 78 | -------------------------------------------------------------------------------- /tests/SMT/Parser/RpmMdPrimaryFilter.pl: -------------------------------------------------------------------------------- 1 | #! /usr/bin/perl -w 2 | 3 | BEGIN { 4 | push @INC, "../www/perl-lib"; 5 | } 6 | 7 | use strict; 8 | use Cwd; 9 | #use File::Temp; 10 | 11 | use SMT::Parser::RpmMdPrimaryFilter; 12 | use Test::Simple tests => 3; 13 | use Data::Dumper; 14 | 15 | #my $fh = new File::Temp(); # file to write the new metadata 16 | my $wd = Cwd::cwd(); # current working dir 17 | 18 | # packages to remove 19 | my @remove = ( 20 | {name => 'logwatch', epo => undef, ver => '7.3.6', rel => '60.6.1', arch => 'noarch'}, 21 | {name => 'audacity', epo => 0, ver => '1.3.5', rel => '49.12.1', arch => 'i586'} 22 | ); 23 | 24 | my $parser = SMT::Parser::RpmMdPrimaryFilter->new(); #out => $fh); use $fh if test of the written file is needed 25 | $parser->resource($wd . '/testdata/rpmmdtest/code11repo'); # FIXME this should use the testdir 26 | $parser->parse(\@remove); 27 | 28 | #$fh->flush; 29 | 30 | my $parsed = $parser->found(); 31 | 32 | ok ((keys %$parsed) == 2); 33 | my $pkgid = 'f7cb8f0f00d3434f723e4681b5cc6c5bef937463'; 34 | ok(exists $parsed->{$pkgid} && 35 | $parsed->{$pkgid}->{name} eq 'logwatch' && 36 | $parsed->{$pkgid}->{epo} eq '0' && 37 | $parsed->{$pkgid}->{ver} eq '7.3.6' && 38 | $parsed->{$pkgid}->{rel} eq '60.6.1' && 39 | $parsed->{$pkgid}->{arch} eq 'noarch'); 40 | $pkgid = '1e6928c73b0409064f05f5af87af2a79b4f64dc9'; 41 | ok(exists $parsed->{$pkgid} && 42 | $parsed->{$pkgid}->{name} eq 'audacity' && 43 | $parsed->{$pkgid}->{epo} eq '0' && 44 | $parsed->{$pkgid}->{ver} eq '1.3.5' && 45 | $parsed->{$pkgid}->{rel} eq '49.12.1' && 46 | $parsed->{$pkgid}->{arch} eq 'i586'); 47 | -------------------------------------------------------------------------------- /yast/icons/client_status/repo-not-up-to-date.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * warning_sign_xpm[] = { 3 | "16 16 58 1", 4 | " c None", 5 | ". c #760000", 6 | "+ c #770000", 7 | "@ c #9E0000", 8 | "# c #8B0000", 9 | "$ c #D72929", 10 | "% c #BB1414", 11 | "& c #AF0000", 12 | "* c #E1AEAE", 13 | "= c #8C0000", 14 | "- c #D94141", 15 | "; c #E5E5E5", 16 | "> c #B40000", 17 | ", c #E2ABAB", 18 | "' c #313131", 19 | ") c #8E0000", 20 | "! c #DA3C3C", 21 | "~ c #E8E7E7", 22 | "{ c #404040", 23 | "] c #B80000", 24 | "^ c #E4AAAA", 25 | "/ c #E9E9E9", 26 | "( c #4D4D4D", 27 | "_ c #900000", 28 | ": c #DB3939", 29 | "< c #EAE8E8", 30 | "[ c #EAEAEA", 31 | "} c #5B5B5B", 32 | "| c #BC0000", 33 | "1 c #E5A7A7", 34 | "2 c #ECECEC", 35 | "3 c #EBEBEB", 36 | "4 c #686868", 37 | "5 c #920000", 38 | "6 c #DC3333", 39 | "7 c #EDEAEA", 40 | "8 c #EDEDED", 41 | "9 c #E1E1E1", 42 | "0 c #C00000", 43 | "a c #E7A4A4", 44 | "b c #EFEFEF", 45 | "c c #EEEEEE", 46 | "d c #434343", 47 | "e c #940000", 48 | "f c #DC2F2F", 49 | "g c #F0ECEC", 50 | "h c #F0F0F0", 51 | "i c #5A5A5A", 52 | "j c #750000", 53 | "k c #C40000", 54 | "l c #E69393", 55 | "m c #F2F2F2", 56 | "n c #F1F1F1", 57 | "o c #990000", 58 | "p c #D10000", 59 | "q c #D60000", 60 | "r c #930000", 61 | "s c #9F0000", 62 | " .. ", 63 | " +@@+ ", 64 | " #$%# ", 65 | " +&**&+ ", 66 | " =-;;-= ", 67 | " +>,'',>+ ", 68 | " )!~{{~!) ", 69 | " +]^/((/^]+ ", 70 | " _:<[}}[<:_ ", 71 | " .|12344321|. ", 72 | " 567829928765 ", 73 | " #0abc8dd8cba0# ", 74 | " efghbciicbhgfe ", 75 | "jklmnhbccbhnmlkj", 76 | "opqqqqqqqqqqqqpo", 77 | "jrssssssssssssrj"}; 78 | -------------------------------------------------------------------------------- /devel-scripts/testClientQueries.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -wT 2 | 3 | use SMT::Client; 4 | use Data::Dumper; 5 | use SMT::Utils; 6 | 7 | $dbh = SMT::Utils::db_connect(); 8 | exit 1 unless defined $dbh; 9 | $cro = SMT::Client->new({'dbh' => $dbh}); 10 | 11 | $res = undef; 12 | 13 | $res = $cro->getClientsInfo({ 14 | 'ID' => '16' 15 | ,'selectAll' => '' 16 | }); 17 | print Data::Dumper->Dump([$res],["id16-selAll"])."\n"; 18 | 19 | $res = $cro->getClientsInfo({ 20 | 'PATCHSTATUS' => ':5::' 21 | ,'selectAll' => '' 22 | }); 23 | print Data::Dumper->Dump([$res],["patchstatus"])."\n"; 24 | 25 | $res = $cro->getClientInfoByGUID('guid16'); 26 | print Data::Dumper->Dump([$res],["guid16-infoByGUID"])."\n"; 27 | 28 | $res = $cro->getClientInfoByID(17); 29 | print Data::Dumper->Dump([$res],["id17-infoByIDselAll"])."\n"; 30 | 31 | $res = $cro->getAllClientsInfo(); 32 | print Data::Dumper->Dump([$res],["all"])."\n"; 33 | 34 | $res = $cro->getClientIDByGUID("guid11"); 35 | print Data::Dumper->Dump([$res],["id18-idByGUID"])."\n"; 36 | 37 | $res = $cro->getClientGUIDByID(18); 38 | print Data::Dumper->Dump([$res],["guid18-guidByID"])."\n"; 39 | 40 | $res = $cro->getClientPatchstatusByID(19); 41 | print Data::Dumper->Dump([$res],["id19-patchstatusByID"])."\n"; 42 | 43 | $res = $cro->getClientPatchstatusByGUID("guid14"); 44 | print Data::Dumper->Dump([$res],["guid20-patchstatusByGUID"])."\n"; 45 | 46 | 47 | 48 | 49 | 50 | =pod 51 | getClientsInfo($) 52 | getClientInfoByGUID($) 53 | getClientInfoByID($) 54 | getAllClientsInfo() 55 | getClientGUIDByID($) 56 | getClientIDByGUID($) 57 | getClientPatchstatusByID($) 58 | getClientPatchstatusByGUID($) 59 | =cut 60 | 61 | -------------------------------------------------------------------------------- /doc/Server-Tuning.txt: -------------------------------------------------------------------------------- 1 | 2 | Server Tuning 3 | ============= 4 | 5 | mysqld: 6 | ------- 7 | 8 | mysqld has a max_connections limit of 100 by default. To change this, simply 9 | change /etc/my.cnf and set: 10 | 11 | ----------------------------------------- 12 | [mysqld] 13 | ... 14 | max_connections = 15 | 16 | ----------------------------------------- 17 | 18 | Restart mysql after changing this parameter. 19 | 20 | apache2: 21 | -------- 22 | 23 | apache2 has max clients limit of 150 by default. To change this, simply change 24 | /etc/apache2/server-tuning.conf and set: 25 | 26 | ----------------------------------------- 27 | 28 | # prefork MPM if you use the prefork module 29 | 30 | ... 31 | 32 | MaxClients 33 | 34 | ----------------------------------------- 35 | 36 | MaxClients must be lower then the value of "ServerLimit". 37 | Restart apache2 after changing this parameter. 38 | 39 | 40 | For SMT it is usefull to set the mysqld max_connections limit a little bit 41 | higher then then the apache2 MaxClients limit. 42 | 43 | 44 | Speedup database connection: 45 | ---------------------------- 46 | 47 | If the database connect() takes a long time it might be usefull to switch to 48 | persistent database connections. This can be easily done by installing 49 | perl-Apache-DBI module (SDK) and put "use Apache::DBI;" into 50 | /etc/apache2/smt-mod_perl-startup.pl . Example: 51 | 52 | ----------------------------------------- 53 | ... 54 | # ModPerl::MethodLookup::preload_all_modules(); 55 | use ModPerl::Util (); #for CORE::GLOBAL::exit 56 | use Apache::DBI; 57 | use Apache2::RequestRec (); 58 | ... 59 | ----------------------------------------- 60 | 61 | Restart apache2 after adding this parameter. 62 | 63 | 64 | -------------------------------------------------------------------------------- /devel-scripts/relations-compare.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | use SMT::Utils; 6 | use Text::ASCIITable; 7 | use SMT; 8 | 9 | my $dbh = SMT::Utils::db_connect(); 10 | 11 | my $statement = ""; 12 | 13 | if ( $SMT::SCHEMA_VERSION == 1.00 ) 14 | { 15 | $statement = "select p.PRODUCT, p.VERSION, p.REL, p.ARCH, c.NAME, c.TARGET, c.LOCALPATH, c.CATALOGTYPE, pc.OPTIONAL from Products p, Catalogs c, ProductCatalogs pc where p.PRODUCTDATAID=pc.PRODUCTDATAID and pc.CATALOGID=c.CATALOGID order by p.PRODUCT, p.VERSION, p.REL, p.ARCH, c.NAME, c.TARGET; "; 16 | } 17 | else 18 | { 19 | $statement = "select p.PRODUCT, p.VERSION, p.REL, p.ARCH, c.NAME, c.TARGET, c.LOCALPATH, c.CATALOGTYPE, pc.OPTIONAL from Products p, Catalogs c, ProductCatalogs pc where p.ID=pc.PRODUCTID and pc.CATALOGID=c.ID order by p.PRODUCT, p.VERSION, p.REL, p.ARCH, c.NAME, c.TARGET; "; 20 | } 21 | 22 | my $res = $dbh->selectall_arrayref($statement, {Slice=>{}}); 23 | 24 | my $t = new Text::ASCIITable; 25 | $t->setCols( "PRODUCT", "CATALOG", "LOCALPATH", "OPT", "CT" ); 26 | $t->addRow( '-----------------------------------------------------------------------------------------', 27 | '---------------------------------------------------------', 28 | '--------------------------------------------------------------', '-' ); 29 | 30 | foreach my $set (@{$res}) 31 | { 32 | $set->{VERSION} = "" if(!defined $set->{VERSION}); 33 | $set->{REL} = "" if(!defined $set->{REL}); 34 | $set->{ARCH}= "" if(!defined $set->{ARCH}); 35 | $set->{TARGET}= "" if(!defined $set->{TARGET}); 36 | $t->addRow( $set->{PRODUCT}." ".$set->{VERSION}." ".$set->{REL}." ".$set->{ARCH}, $set->{NAME}." ".$set->{TARGET}, $set->{LOCALPATH}, $set->{OPTIONAL}, $set->{CATALOGTYPE}); 37 | } 38 | print $t->draw(); 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /tests/SMT/Filter.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | BEGIN { 4 | push @INC, "../www/perl-lib"; 5 | } 6 | 7 | use Test::Simple tests => 7; 8 | 9 | use SMT::Filter; 10 | use Data::Dumper; 11 | 12 | my $filter = SMT::Filter->new(); 13 | 14 | ok ($filter->dirty(), 'filter should be dirty right after creation'); 15 | 16 | $filter->add(SMT::Filter->TYPE_NAME_VERSION, 'ha-20'); 17 | $filter->add(SMT::Filter->TYPE_NAME_VERSION, 'fa-12'); 18 | $filter->add(SMT::Filter->TYPE_NAME_VERSION, 'fa-12'); 19 | $filter->add(SMT::Filter->TYPE_NAME_REGEX, '^f'); 20 | $filter->add(SMT::Filter->TYPE_NAME_REGEX, 'masa.crex'); 21 | 22 | $patch = { 23 | name => 'fa', 24 | version => '12', 25 | category => 'recommended', 26 | title => 'patch for fa' 27 | }; 28 | 29 | $patch2 = { 30 | name => 'faraway', 31 | version => '99', 32 | category => 'optional', 33 | title => 'patch for faraway' 34 | }; 35 | 36 | ok ($filter->matches($patch), "patch fa-12 should match the filter"); 37 | ok ($filter->matches($patch2), "patch faraway-99 should not match the filter"); 38 | 39 | my $wm = $filter->whatMatches($patch); 40 | ok (@$wm == 2, '2 subfilters match patch fa-12'); 41 | 42 | my $found = 0; 43 | for (@$wm) 44 | { 45 | if ($_->[0] == SMT::Filter->TYPE_NAME_REGEX && 46 | $_->[1] eq '^f') 47 | { 48 | $found = 1; 49 | last; 50 | } 51 | } 52 | ok ($found, 'regex filter \'^f\' should match patch fa-12' ); 53 | 54 | $found = 0; 55 | for (@$wm) 56 | { 57 | if ($_->[0] == SMT::Filter->TYPE_NAME_VERSION && 58 | $_->[1] eq 'fa-12') 59 | { 60 | $found = 1; 61 | last; 62 | } 63 | } 64 | ok ($found, 'patch id filter \'fa-12\' should match patch fa-12'); 65 | 66 | $filter->clean(); 67 | ok ($filter->empty(), "should be empty after clean()"); 68 | 69 | #$filter->save($dbh, $cid); 70 | #$f2->load($dbh, $cid); -------------------------------------------------------------------------------- /tests/SMT/Mirror/RpmMdWithFilter.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | BEGIN { 4 | push @INC, "../www/perl-lib"; 5 | } 6 | 7 | use Test::Simple tests => 3; 8 | use Cwd; 9 | use File::Temp; 10 | 11 | use SMT::Mirror::RpmMd; 12 | use SMT::Filter; 13 | use SMT::Parser::RpmMdPatches; 14 | use SMT::Utils; 15 | 16 | my $wd = Cwd::cwd(); # current working dir 17 | 18 | #my $log = SMT::Utils::openLog('smt.log'); 19 | my $vblevel = LOG_DEBUG|LOG_DEBUG2|LOG_WARN|LOG_ERROR|LOG_INFO1|LOG_INFO2; 20 | 21 | my $filter = SMT::Filter->new(); 22 | $filter->add(SMT::Filter->TYPE_NAME_VERSION, 'imap-368'); 23 | $filter->add(SMT::Filter->TYPE_NAME_VERSION, 'perl-DBD-mysql-543'); 24 | 25 | my $url = 'file://' . $wd . '/testdata/rpmmdtest/code11repo'; # FIXME this should use the testdir 26 | my $tempdir = File::Temp::tempdir(CLEANUP => 1); 27 | print STDERR "Mirroring $url to $tempdir\n"; 28 | 29 | $mirror = SMT::Mirror::RpmMd->new(filter => $filter, vblevel => $vblevel); 30 | $mirror->uri($url); 31 | $mirror->localBasePath("$tempdir"); 32 | $mirror->localRepoPath(''); 33 | 34 | ok($mirror->mirror() == 0, "should mirror ok"); 35 | 36 | my $newpatches = $mirror->newpatches(); 37 | ok((keys %$newpatches) == 3, "should yield 3 new patches"); 38 | 39 | # should update updateinfo.xml.gz 40 | my $parser = SMT::Parser::RpmMdPatches->new(); 41 | $parser->resource("$tempdir"); 42 | my $patches = $parser->parse('repodata/updateinfo.xml.gz'); 43 | ok((keys %$newpatches) == 3, "updateinfo.xml.gz should now contain 3 patches"); 44 | 45 | #ok($mirror->statistic()->{TOTALFILES} != $mirror->statistic()->{UPTODATE}, "first mirror() should download all the files"); 46 | #ok($mirror->verify(), "mirrored data should pass checksum verifications"); 47 | #ok($mirror->mirror() == 0, "second mirror should work"); 48 | #ok($mirror->statistic()->{TOTALFILES} == $mirror->statistic()->{UPTODATE}, "second mirror() should not download anything"); 49 | -------------------------------------------------------------------------------- /www/perl-lib/SMT/ConnectAPI.pm: -------------------------------------------------------------------------------- 1 | package SMT::ConnectAPI; 2 | 3 | use SMT::Rest::SCCAPIv1; 4 | use SMT::Rest::SCCAPIv2; 5 | use SMT::Rest::SCCAPIv3; 6 | use SMT::Rest::SCCAPIv4; 7 | use SMT::Utils; 8 | use Apache2::Const -compile => qw(HTTP_NOT_ACCEPTABLE :log); 9 | use JSON; 10 | 11 | # 12 | # Apache Handler 13 | # this is the main function of this request handler 14 | # 15 | sub handler { 16 | my $r = shift; 17 | my $api = undef; 18 | 19 | my $apiVersion = SMT::Utils::requestedAPIVersion($r); 20 | if (not $apiVersion) 21 | { 22 | $r->status(Apache2::Const::HTTP_NOT_ACCEPTABLE); 23 | $r->content_type('application/json'); 24 | $r->custom_response(Apache2::Const::HTTP_NOT_ACCEPTABLE, ""); 25 | print encode_json({ 'error' => "API version not supported", 26 | 'localized_error' => "API version not supported", 27 | 'status' => Apache2::Const::HTTP_NOT_ACCEPTABLE }); 28 | return Apache2::Const::HTTP_NOT_ACCEPTABLE; 29 | } 30 | $r->err_headers_out->add('scc-api-version' => "v$apiVersion"); 31 | 32 | if ( $apiVersion == 1 ) 33 | { 34 | $api = SMT::Rest::SCCAPIv1->new($r); 35 | return $api->handler(); 36 | } 37 | elsif ( $apiVersion == 2 ) 38 | { 39 | $api = SMT::Rest::SCCAPIv2->new($r); 40 | return $api->handler(); 41 | } 42 | elsif ( $apiVersion == 3 ) 43 | { 44 | $api = SMT::Rest::SCCAPIv3->new($r); 45 | return $api->handler(); 46 | } 47 | elsif ( $apiVersion == 4 ) 48 | { 49 | # there is currently no difference between v3 and v4 50 | # in the parts we provide. So also use v3 here. 51 | $api = SMT::Rest::SCCAPIv4->new($r); 52 | return $api->handler(); 53 | } 54 | else 55 | { 56 | return Apache2::Const::HTTP_NOT_ACCEPTABLE; 57 | } 58 | } 59 | 60 | 1; 61 | -------------------------------------------------------------------------------- /www/repo/res-signingkeys.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: GnuPG v1.4.6 (GNU/Linux) 3 | 4 | mQGiBEkRpYQRBAD3RjSa2/HXlTsLi/VLbbKeBTq50O5zHwOj9/wdzEPNgHZMtUYK 5 | L5cIUGUYuKrtfBPaOSWo1OzfPPdHuC5SMCtnX+R85PyQC1aoTvwRU82oi8K2BQaB 6 | ayGy2NibXEWkalhfGRub4ICLqSA3VIYnuSKt6LT62Hksv1VzLHYgZP4a0wCg090E 7 | cvGyVp1N4byS43VObjAOoEUEAJjgF+kpbJf/nlS/BxF30YY77URq4Myop0S6zRE4 8 | //WfbFTV+qikHlF/HUAzc3JgjBnTF0XLp/YnyEChnah3I5PiqPoAUnJGNWV1R/au 9 | HCcLjd/ML+l5OIGun21Sw5ApDTtKMAQXuR/L5mFxXxMzqE5BuvJZjNvSWab7I3Tq 10 | 88T/BADQAu5hlFvNR6GJN4m+cLCjIsvS7rkMN1G0YxZutmm1BWrrnO+MPbwI+thr 11 | 33WqlEaUWbA5ALtKQun+gMuSzLsB2JJNMW6zCNr7rDlRk8jTYxZk4uStQyHn7iFQ 12 | rqM+YZYHMI9Q5c0SZwagc8JmztbcZEP2hJiIUJuqZPW8i+lw/bRnRXh0ZW5kZWQg 13 | U3VwcG9ydCBQYWNrYWdlIFNpZ25pbmcgS2V5IChFeHRlbmRlZCBTdXBwb3J0IFBh 14 | Y2thZ2UgU2lnbmluZyBLZXkpIDxleHRlbmRlZC1idWlsZEBub3ZlbGwuY29tPohg 15 | BBMRAgAgBQJJEaWEAhsjBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQgFXwQAGC 16 | uWT2VACfRYAUuhvhi7/GuHUfdnSRsSGFCpMAoNEYSGtmOxWzzhdIsMil7qv9NOdw 17 | uQINBEkRpYkQCACtV9JUoTfSZzUB5PULXjOuvBjuuvguwPorkfFNQ6bgt/Ih3q7n 18 | pHCPBM+UmutU0VaAwvHGiYaAZUi15jvhfoc9IGYomtqc07b+dlSdoP1G/HctBl8y 19 | dkSdthZ7xbCIQYVwO4UxqmclmuGb/22KBj6E+kfHOsDknjVCdevUx2uOfP83j59p 20 | 5TJh1HaHS2oCNS36vl+EmFupR/c39gcs7lFXYBmU8o6BHbByrL2TvYr5ZVyNjK0O 21 | tsFfOx59f8v/LwNf6ZgNiTEyz0IrKdlReUDy4437DOCmxT2mKK634MtBz/eORSak 22 | wkj5dQ6Y0cp7OplNLHkStza7/ZWjtviuFjzjAAMFCACq+6wxTcly1pepBUih/gIp 23 | xKEIQDvYDys9zNAmAfjxlM7DvDoDsH9WnxjtbQysybdlFb0wD3z9bw4BwXmm2EpC 24 | BByoO5IaTBzjEbBBWYWGGrsK7VA2FYZBy5177ZX4LbhfFJNsdkPxGvyjKN3wTPaY 25 | +Q5HcxFHW6/QVHCAxEQnmKeNTQwQ3Zog/LbfPo4hvNWY0dNS20fQDWH7Asfuw46z 26 | MQGJvSKb3I31oYQ6gvO3VwhTCZ+FtWfMhizuNwt6vv33115y62REjWCMtwMb85wk 27 | bwwSziYZJFjVKBa0wJdhPTq75Ykv4SgdZl1p73XBYboSKzQ4BRePgaisLDCUQUQ7 28 | iEkEGBECAAkFAkkRpYkCGwwACgkQgFXwQAGCuWRf9QCeM2AM4oSYwcxQ4mvP1vml 29 | 5OVWHMUAn3WGfxAxzMRMjDhJ66E2Q6mQstsU 30 | =3nt6 31 | -----END PGP PUBLIC KEY BLOCK----- 32 | -------------------------------------------------------------------------------- /xml/patch.rnc: -------------------------------------------------------------------------------- 1 | start = element patch { 2 | attribute id {xsd:integer}, # SMT ID of the patch 3 | attribute name {xsd:string}, # patch's Unix name 4 | attribute version {xsd:integer|""}, # patch's version number 5 | attribute category { # patch importance category 6 | "security" | 7 | "recommended" | 8 | "optional" | 9 | "mandatory" | 10 | "feature"}, 11 | element description {text}, # description of issues fixed by the patch 12 | element issued { 13 | attribute date {xsd:integer} # patch release time stamp 14 | }, 15 | element packages { # packages which need update as part of this patch 16 | element package { # individual RPM package data 17 | attribute name {xsd:string}, # package name 18 | attribute epoch {xsd:integer|""}, # epoch number 19 | attribute version {xsd:string}, # version string 20 | attribute release {xsd:string}, # release string 21 | attribute arch {xsd:string}, # architecture string 22 | element origlocation {xsd:anyURI}, # URL of the RPM package in the original repository 23 | element smtlocation {xsd:anyURI} # URL of the RPM package at the SMT server 24 | }* 25 | }, 26 | element references { # references to issues fixed by this patch 27 | element reference { # individual reference details 28 | attribute id {xsd:string}, # ID number of the issue (bugzilla or CVE number) 29 | attribute title {xsd:string}, # issue title 30 | attribute type {"bugzilla"|"cve"}, # type of the issue 31 | attribute href {xsd:anyURI} # URL of the issue in its issue tracking system 32 | }* 33 | }, 34 | element title {xsd:string} # title of the patch 35 | } 36 | 37 | -------------------------------------------------------------------------------- /doc/mail-Questions-about-the-Breakout-API.txt: -------------------------------------------------------------------------------- 1 | From: Michael Calmer 2 | To: Eric Layton 3 | Subject: Questions about the Breakout API 4 | Date: Tue, 18 Dec 2007 15:12:48 +0100 5 | Cc: Stanislav Visnovsky , 6 | "Duncan Mac-Vicar Prett" 7 | 8 | Hi Eric, 9 | 10 | some Questions about the Breakout API: 11 | 12 | > Managed devices will not be handled within NCC the same way that regular 13 | > systems. Instead, they will show up as managed devices under the 14 | > ZLM satellite (which is a regular system in NCC). 15 | > Managed devices will not be tied to a subscription, nor will they have an 16 | > install user. Their update level will most likely read "locally managed." 17 | 18 | Q 1: Is a customer able to put entitlements to managed devices? 19 | We need a way that a customer can easily get an overview of 20 | his systems, his entitlements and if he has enough entitlements 21 | for his systems. 22 | 23 | E.g. Customer has 10 SLES and 50 SLED systems but only 9 SLES 24 | and 35 SLED entitlements. Is the customer able to see that he 25 | has to buy some additional licenses? 26 | =20 27 | Will NCC inform the customer that he has to buy additional entitlement= 28 | s? 29 | E.g. via email. 30 | 31 | Q 2: Is it possible to see/show the installed products on the managed 32 | devices? 33 | The "info" structure does not look like that it is able to carry 34 | different products. 35 | 36 | 37 | 38 | =2D-=20 39 | MFG 40 | 41 | Michael Calmer 42 | 43 | =2D------------------------------------------------------------------------- 44 | Michael Calmer 45 | SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg 46 | T: +49 (0) 911 74053 0 47 | =46: +49 (0) 911 74053575 - e-mail: Michael.Calmer@suse.com 48 | =2D------------------------------------------------------------------------- 49 | SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N=C3=BCrnberg) 50 | 51 | -------------------------------------------------------------------------------- /tests/testdata/rpmmdtest/code11repo/repodata/repomd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1469bcca4c32be39cf470816f3d7180ffa07f2f9 6 | 1243611201 7 | f82ca748099f238f7fb3a01a18bfc8c88f95ec6f 8 | 9 | 10 | 11 | 600461111f23f300538878868c337d4568e7a0ca 12 | 1243611201 13 | a8ef14eb97df2e2814c5d470e7b418a5daf051af 14 | 15 | 16 | 17 | e66319eaf87b1384e4582ed1e3ecc7202f108b8a 18 | 1243611201 19 | 4d0580d9529364f64d1098a50966ab7075652a9a 20 | 21 | 22 | 23 | 117db80c2ff8a5f08b1a694b77eaec5a254eac36 24 | 1243611328.0 25 | e247e193401e87789be045e338bc638a1d5d3551 26 | 27 | 28 | 29 | 76e149feba68f6d05978e4471847bfd5ad639a97 30 | 1243611335.0 31 | 204a2d6be49ce742871a77a0dcd1bdfb2d1119d8 32 | 33 | 34 | 35 | 0a32df59afdac2312bcf8e1eeb6c0e2b285f15c2 36 | 1243615211.0 37 | a509c19676cce01ce1f4cc0474d45c7349d0cf24 38 | 39 | 40 | -------------------------------------------------------------------------------- /config/installation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | control-SMT 5 | 6 | 7 | 8 | 9 | normal 10 | installation,normal 11 | 12 | 13 | no 14 | no 15 | 16 | 17 | 18 | 19 | 20 | sw_single 21 | yes 22 | yes 23 | 24 | 25 | patternSelector 26 | false 27 | 28 | 29 | 30 | 31 | inst_smt 32 | yes 33 | yes 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | yes 44 | yes 45 | 46 | 47 | 48 | continue 49 | installation 50 | 51 | 52 | 53 | 54 | suseconfig 55 | 56 | 57 | 58 | smt 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /tests/SMT/Mirror/update-regdata.pl: -------------------------------------------------------------------------------- 1 | #! /usr/bin/perl -w 2 | 3 | use strict; 4 | use SMT::Mirror::RegData; 5 | use Test::Simple tests => 4; 6 | 7 | sub testsync 8 | { 9 | my $self = shift; 10 | my $xmlfile = shift; 11 | 12 | #my $xmlfile = $self->_requestData(); 13 | if(!$xmlfile) 14 | { 15 | return 1; 16 | } 17 | 18 | $self->_parseXML($xmlfile); 19 | return $self->_updateDB(); 20 | } 21 | 22 | 23 | my $rd = SMT::Mirror::RegData->new(debug => 1, 24 | element => "productdata", 25 | table => "Products", 26 | key => "PRODUCTDATAID"); 27 | my $res = testsync($rd, "./testdata/regdatatest/productdata.xml"); 28 | if($res) 29 | { 30 | print STDERR "Error while fetching Products data.\n"; 31 | } 32 | ok($res == 0); 33 | 34 | # this table is dropped 35 | # 36 | #$rd->element("productdep"); 37 | #$rd->table("ProductDependencies"); 38 | #$rd->key([ 'PARENT_PRODUCT_ID', 'CHILD_PRODUCT_ID']); 39 | 40 | #$res = testsync($rd, "./testdata/regdatatest/productdep.xml"); 41 | #if($res) 42 | #{ 43 | # print STDERR "Error while fetching ProductDependencies data.\n"; 44 | #} 45 | #ok($res == 0); 46 | 47 | $rd->element("targets"); 48 | $rd->table("Targets"); 49 | $rd->key("OS"); 50 | 51 | $res = testsync($rd, "./testdata/regdatatest/targets.xml"); 52 | if($res) 53 | { 54 | print STDERR "Error while fetching Targets data.\n"; 55 | } 56 | ok($res == 0); 57 | 58 | $rd->element("catalogs"); 59 | $rd->table("Catalogs"); 60 | $rd->key("CATALOGID"); 61 | 62 | $res = testsync($rd, "./testdata/regdatatest/catalogs.xml"); 63 | if($res) 64 | { 65 | print STDERR "Error while fetching Catalogs data.\n"; 66 | } 67 | ok($res == 0); 68 | 69 | $rd->element("productcatalogs"); 70 | $rd->table("ProductCatalogs"); 71 | $rd->key(['PRODUCTDATAID', 'CATALOGID']); 72 | 73 | $res = testsync($rd, "./testdata/regdatatest/productcatalogs.xml"); 74 | if($res) 75 | { 76 | print STDERR "Error while fetching ProductCatalogs data.\n"; 77 | } 78 | ok($res == 0); 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /client/perl-lib/SMT/Agent/Constants.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | package SMT::Agent::Constants; 4 | 5 | use strict; 6 | use warnings; 7 | 8 | 9 | # script that processes jobs 10 | use constant PROCESSJOB => '/usr/lib/SMT/bin/processjob'; 11 | 12 | # config file for smt server url 13 | use constant SUSEREGISTER_CONF => '/etc/SUSEConnect'; 14 | 15 | # path for job handlers (like softwarepush) 16 | use constant JOB_HANDLER_PATH => '/usr/lib/SMT/bin/job'; 17 | 18 | # rest path start sequence and rest version 19 | use constant REST_START_SEQ => '/=/'; 20 | use constant REST_VERSION => '1'; 21 | 22 | # rest path for retriving next job id 23 | use constant REST_NEXT_JOB => REST_START_SEQ.REST_VERSION.'/jobs/@next'; 24 | 25 | # rest path for job update (trailing slash is important) 26 | use constant REST_UPDATE_JOB => REST_START_SEQ.REST_VERSION.'/jobs/'; 27 | 28 | # rest path for job pickup (trailing slash is important) 29 | use constant REST_GET_JOB => REST_START_SEQ.REST_VERSION.'/jobs/'; 30 | 31 | # log file 32 | use constant LOG_FILE => '/var/log/smtclient.log'; 33 | 34 | # client config file 35 | use constant CLIENT_CONFIG_FILE => '/etc/sysconfig/smt-client'; 36 | 37 | # smt client credenitials file containing guid 38 | # SLE11 => /etc/zypp/credentials.d/SCCcredentials 39 | # SLE12 => /etc/zypp/credentials.d/SCCcredentials 40 | # SLE12 file may be missing due to update or missing SUSEConnect package 41 | # in that case fallback to SLE11 file only if SLE11 file is present: 42 | sub CREDENTIALS_FILE() { 43 | my $cred_path = '/etc/zypp/credentials.d'; 44 | my $cred_file_sle11 = 'NCCcredentials'; 45 | my $cred_file_sle12 = 'SCCcredentials'; 46 | my $cred_file = $cred_file_sle12; 47 | if ( ! -e "$cred_path/$cred_file_sle12" && -e "$cred_path/$cred_file_sle11" ) { 48 | $cred_file = $cred_file_sle11; 49 | } 50 | return "$cred_path/$cred_file"; 51 | } 52 | 53 | # smt client credentials files (SLE10) 54 | use constant DEVICEID_FILE => '/etc/zmd/deviceid'; 55 | use constant SECRET_FILE => '/etc/zmd/secret'; 56 | 57 | # network location and realm used for authentication 58 | use constant AUTH_NETLOC => 'netloc'; 59 | use constant AUTH_REALM => 'realm'; 60 | 61 | 62 | 1; 63 | -------------------------------------------------------------------------------- /devel-scripts/jobapitest.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | 4 | use strict; 5 | use warnings; 6 | use SMT::Utils; 7 | use SMT::JobQueue; 8 | use SMT::Job; 9 | use Data::Dumper; 10 | 11 | 12 | my $dbh = SMT::Utils::db_connect(); 13 | exit 1 unless defined $dbh; 14 | my $c = SMT::JobQueue->new({'dbh' => $dbh}); 15 | 16 | 17 | 18 | #print $c->finishJob("guid10", 42,1); 19 | #my ($id, $cookie) = $c->getNextAvailableJobID(); 20 | #print "$id - $cookie"; 21 | # 22 | #print $c->getNextAvailableJobID(); 23 | 24 | 25 | #if ( $c->deleteJobIDCookie($id, $cookie) ) 26 | #{ 27 | # print "success"; 28 | #} 29 | #else 30 | #{ 31 | # print "fail"; 32 | #} 33 | 34 | 35 | my $job = SMT::Job->new({ 'dbh' => $dbh }); 36 | $job->newJob(); 37 | $job->type("softwarepush"); 38 | $job->guid("guid11"); 39 | $job->description("thomastest"); 40 | $job->arguments("true"); 41 | $job->expires("2009-08-02 20:07:20"); 42 | $job->targeted("2009-06-02 22:07:20"); 43 | $job->persistent(1); 44 | $job->timelag("14:00:00"); 45 | $job->id(44); 46 | 47 | $job->readJobFromHash({'id'=>'11', 'guid'=>'Thomas'} ); 48 | 49 | 50 | 51 | #if ( $c->addJob($job) ) 52 | #{ 53 | # print "successfully added\n\n"; 54 | #} 55 | 56 | #print "Next id: ". $c->getNextJobID()."\n"; 57 | # 58 | #print $c->getJob("guid11",$c->getNextJobID("guid11", 0),1); 59 | 60 | 61 | #if ( $c->finishJob("guid11", "true")) 62 | #{ 63 | # print "successfully finished\n\n"; 64 | #} 65 | 66 | #print "pers: ".$c->isPersistent("guid11","44"); 67 | 68 | 69 | 70 | 71 | print $job->asXML(); 72 | #print Dumper($job); 73 | 74 | 75 | #if ( $c->addJobForMultipleGUIDs($job, ("guid10", "guid12", "guid11")) ) 76 | #{ 77 | # print "success"; 78 | #} 79 | #else 80 | #{ 81 | # print "err"; 82 | #} 83 | 84 | 85 | #print $c->retrieveJob("guid11", 44,1); 86 | 87 | #print SMT::JobQueue->updateJob("guid10", '' ); 88 | -------------------------------------------------------------------------------- /doc/Testplan-SLE11-SP3-SCC.txt: -------------------------------------------------------------------------------- 1 | Prepare test: 2 | 3 | - install SMT (smt-1.2*.rpm) 4 | - sync with NCC 5 | - register clients (only SUSE Products) 6 | 7 | 8 | 1) After: Prepare test 9 | - dump product <=> catalog relations 10 | https://raw.github.com/SUSE/smt/master/devel-scripts/relations-compare.pl 11 | - install update to new version (smt-2.0*.rpm) 12 | 13 | Expected Result: 14 | * DB schema migration is running and update the schema successfully 15 | 16 | - dump product <=> catalog relations 17 | https://raw.github.com/SUSE/smt/master/devel-scripts/relations-compare.pl 18 | - compare relation dumps 19 | 20 | Expected Result: 21 | * no differences 22 | 23 | 2) After "1" 24 | - run smt-ncc-syn 25 | 26 | Expected Result: 27 | * run successfull 28 | 29 | - dump product <=> catalog relations 30 | https://raw.github.com/SUSE/smt/master/devel-scripts/relations-compare.pl 31 | - compare relation dumps 32 | 33 | Expected Result: 34 | * no differences 35 | 36 | - run smt-scc-sync 37 | 38 | Expected Result: 39 | Exit with error message "Not connected to SCC" 40 | 41 | 42 | 3) After "1" 43 | - migrate to SCC using "smt-ncc-scc-migration" script 44 | 45 | Expected Result: 46 | * no errors 47 | 48 | - dump product <=> catalog relations 49 | https://raw.github.com/SUSE/smt/master/devel-scripts/relations-compare.pl 50 | - compare relation dumps 51 | 52 | Expected Result: 53 | * no differences 54 | 55 | 4) After "3" 56 | - run smt-ncc-sync 57 | 58 | Expected Result: 59 | * exit with error message "Not connected to NCC" 60 | 61 | 5) After "3" 62 | - run "smt-ncc-scc-migration" 63 | 64 | Expected Result: 65 | * exit with error message "Not connected to NCC" 66 | 67 | 6) After: Prepare Test 68 | - register clients (at least one Novell/NetIQ Product like OES) 69 | - install update to new version (smt-2.0*.rpm) 70 | Expected Result: 71 | * DB schema migration is running and update the schema successfully 72 | 73 | - migrate to SCC using "smt-ncc-scc-migration" script 74 | 75 | Expected Result: 76 | * The script exit with a message that you cannot migrate to SCC, because 77 | you have clients registered using products which are not supported by SCC. 78 | 79 | 80 | -------------------------------------------------------------------------------- /doc/obs-maintenance-request.md: -------------------------------------------------------------------------------- 1 | # Commiting the changes to OBS 2 | 3 | 1. Update the version in the `Makefile` and `package/smt.spec` as necessary 4 | 2. Update the changelog in `package/smt.changes` file 5 | 3. Run `make package` 6 | 4. Checkout the devel project from OBS 7 | 5. Copy everything from `package` directory into `smt` subdirectory in the 8 | OBS project working copy 9 | 6. Remove the tarball with the previous version, example `iosc status` output: 10 | 11 | Note: `iosc` is an alias for `osc -A https://api.suse.de` 12 | ``` 13 | # ~/obs/Devel:SMT:SLE-12-SMT/smt> iosc status 14 | ! smt-3.0.24.tar.bz2 15 | ? smt-3.0.25.tar.bz2 16 | M smt.changes 17 | M smt.spec 18 | ``` 19 | 7. Run `iosc addremove`: 20 | ``` 21 | # ~/obs/Devel:SMT:SLE-12-SMT/smt> iosc addremove 22 | A smt-3.0.25.tar.bz2 23 | D smt-3.0.24.tar.bz2 24 | ``` 25 | 8. After this the changes should be properly tracked: 26 | ``` 27 | # ~/obs/Devel:SMT:SLE-12-SMT/smt> iosc status 28 | D smt-3.0.24.tar.bz2 29 | A smt-3.0.25.tar.bz2 30 | M smt.changes 31 | M smt.spec 32 | ``` 33 | 9. Commit the changes: 34 | ``` 35 | # ~/obs/Devel:SMT:SLE-12-SMT/smt> iosc ci 36 | Deleting smt-3.0.24.tar.bz2 37 | Sending smt.changes 38 | Sending smt.spec 39 | Sending smt-3.0.25.tar.bz2 40 | Transmitting file data ... 41 | Committed revision 42. 42 | ``` 43 | 44 | ### Listing maintained package branches 45 | 46 | To get the list of all maintained smt branches run `iosc maintained smt`: 47 | ``` 48 | # ~/obs/Devel:SMT:SLE-12-SMT/smt> iosc maintained smt 49 | SUSE:SLE-10-SP3:Update:Test/smt 50 | SUSE:SLE-11-SP2:Update/smt 51 | SUSE:SLE-11-SP3:Update/smt 52 | SUSE:SLE-11:Update/smt 53 | SUSE:SLE-12-SP1:Update/smt using sources from SUSE:Maintenance:4270/smt.SUSE_SLE-12-SP1_Update 54 | ``` 55 | 56 | ### Issuing a maintenance request 57 | 58 | Issuing an MR for SLE-11-SP3 in this example: 59 | 60 | ``` 61 | # ~/obs/Devel:SMT:SLE-11-SMT-SP3/smt> iosc mr Devel:SMT:SLE-11-SMT-SP3 smt SUSE:SLE-11-SP3:Update 62 | Using target project 'SUSE:Maintenance' 63 | 132177 64 | ``` 65 | 66 | After an MR is issued it should show up in the output of 67 | `iosc request list` command and also in the "Outgoing requests tab" 68 | in OBS web-interface. 69 | -------------------------------------------------------------------------------- /tests/SMT/Parser/RpmMdOtherFilter.pl: -------------------------------------------------------------------------------- 1 | #! /usr/bin/perl -w 2 | 3 | BEGIN { 4 | push @INC, "../www/perl-lib"; 5 | } 6 | 7 | use strict; 8 | use Test::Simple tests => 3; 9 | use Cwd; 10 | #use File::Temp; 11 | 12 | #use File::Copy; 13 | #use SMT::Utils; 14 | #use Data::Dumper; 15 | 16 | use SMT::Parser::RpmMdOtherFilter; 17 | 18 | 19 | #my $fh = new File::Temp(); # file to write the new metadata 20 | my $wd = Cwd::cwd(); # current working dir 21 | 22 | # packages to remove 23 | my $toremove = 24 | { 25 | 'f7cb8f0f00d3434f723e4681b5cc6c5bef937463' => { 26 | 'rel' => '60.6.1', 27 | 'epo' => '0', 28 | 'arch' => 'noarch', 29 | 'ver' => '7.3.6', 30 | 'name' => 'logwatch' 31 | }, 32 | '1e6928c73b0409064f05f5af87af2a79b4f64dc9' => { 33 | 'rel' => '49.12.1', 34 | 'epo' => '0', 35 | 'arch' => 'i586', 36 | 'ver' => '1.3.5', 37 | 'name' => 'audacity' 38 | } 39 | }; 40 | 41 | #my $log = SMT::Utils::openLog('/local/jkupec/tmp/smt.log'); 42 | #my $vblevel = LOG_DEBUG|LOG_DEBUG2|LOG_WARN|LOG_ERROR|LOG_INFO1|LOG_INFO2; 43 | 44 | my $parser = SMT::Parser::RpmMdOtherFilter->new(); # log => $log, vblevel => $vblevel); 45 | $parser->resource($wd . '/testdata/rpmmdtest/code11repo'); # FIXME this should use the testdir 46 | 47 | $parser->parse('repodata/filelists.xml.gz', $toremove); #); use $fh if test of the written file is needed 48 | my $parsed = $parser->removed(); 49 | ok ((keys %$parsed) == 2); 50 | 51 | $parser->parse('repodata/other.xml.gz', $toremove); 52 | $parsed = $parser->removed(); 53 | ok ((keys %$parsed) == 2); 54 | 55 | $parser->parse('repodata/susedata.xml.gz', $toremove); 56 | $parsed = $parser->removed(); 57 | ok ((keys %$parsed) == 2); 58 | 59 | #$fh->flush; 60 | #copy("$fh", $wd.'/outfile.xml'); 61 | -------------------------------------------------------------------------------- /cron/smt-daily: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # 4 | # smt-daily 5 | # This script runs organizational commands for the SMT service. 6 | # It syncs the local SMT with the Novell NCC, creates a daily report 7 | # and updates the mirrored installation and update sources. 8 | 9 | PATH="/sbin:/usr/sbin:/usr/bin:/bin" 10 | 11 | SMTCMD=/usr/sbin/smt 12 | . /etc/smt.d/smt-cron.conf 13 | 14 | while read line ; do 15 | case "$line" in 16 | \#*|"") continue ;; 17 | esac 18 | eval val=${line#*=} 19 | case "$line" in 20 | PROXY_ENABLED=*) 21 | PROXY_ENABLED="${val}" 22 | ;; 23 | HTTP_PROXY=*) 24 | test -n "$val" || continue 25 | http_proxy="${val}" 26 | export http_proxy 27 | ;; 28 | HTTPS_PROXY=*) 29 | test -n "$val" || continue 30 | https_proxy="${val}" 31 | export https_proxy 32 | ;; 33 | NO_PROXY=*) 34 | test -n "$val" || continue 35 | no_proxy="${val}" 36 | export no_proxy 37 | ;; 38 | esac 39 | done < /etc/sysconfig/proxy 40 | unset sys line val 41 | 42 | if test "$PROXY_ENABLED" != "yes" ; then 43 | unset http_proxy https_proxy no_proxy 44 | fi 45 | unset PROXY_ENABLED 46 | 47 | SCC_SYNC_RC=0 48 | if [ -x ${SMTCMD}-sync ] 49 | then 50 | ${SMTCMD}-sync ${SCC_SYNC_PARAMS} 51 | SCC_SYNC_RC=$? 52 | else 53 | echo "WARNING: Could not find the SMT binary ${SMTCMD}-sync" 54 | echo " Please make sure SMT is properly installed." 55 | fi 56 | 57 | if [ $SCC_SYNC_RC -ne 0 ] 58 | then 59 | echo "WARNING: smt-sync exited with error." 60 | fi 61 | 62 | if [ -x ${SMTCMD}-report ] 63 | then 64 | ${SMTCMD}-report --dailycheck ${REPORT_PARAMS} 65 | else 66 | echo "WARNING: Could not find the SMT binary ${SMTCMD}-report" 67 | echo " Please make sure SMT is properly installed." 68 | fi 69 | 70 | if [ -x ${SMTCMD}-mirror ] 71 | then 72 | if [ $SCC_SYNC_RC -eq 0 ] 73 | then 74 | ${SMTCMD}-mirror ${MIRROR_PARAMS} 75 | else 76 | echo "Skipping smt-mirror because previous run of smt-sync failed." 77 | fi 78 | else 79 | echo "WARNING: Could not find the SMT binary ${SMTCMD}-mirror" 80 | echo " Please make sure SMT is properly installed." 81 | fi 82 | 83 | 84 | # in cronjobs always do an exit 0 - even on errors - exit 1 only in case of real panic 85 | exit 0 86 | -------------------------------------------------------------------------------- /www/perl-lib/SMT/Error.pm: -------------------------------------------------------------------------------- 1 | package SMT::Error; 2 | 3 | use SMT::Utils; 4 | use Apache2::Const -compile => qw(:log OK SERVER_ERROR NOT_FOUND); 5 | use JSON; 6 | 7 | # 8 | # Apache Handler 9 | # this is the main function of this request handler 10 | # 11 | sub handler { 12 | my $r = shift; 13 | # only /connect pages get json response errors 14 | if ($r->prev() && $r->prev()->uri() =~ /\/connect\//) 15 | { 16 | $r->content_type('application/json'); 17 | if ($r->path_info() eq "/401") { 18 | # tell the browser the error 19 | $r->log->error("Unauthorized"); 20 | $r->status(Apache2::Const::HTTP_UNAUTHORIZED); 21 | $r->custom_response(Apache2::Const::HTTP_UNAUTHORIZED, ""); 22 | print encode_json( 23 | { 'error' => "This server could not verify that you are authorized to access this service.", 24 | 'localized_error' => "This server could not verify that you are authorized to access this service.", 25 | 'status' => Apache2::Const::HTTP_UNAUTHORIZED } 26 | ); 27 | } 28 | elsif ($r->path_info() eq "/404") 29 | { 30 | # tell the browser the error 31 | $r->log->error("Page Not Found"); 32 | $r->status(Apache2::Const::NOT_FOUND); 33 | $r->custom_response(Apache2::Const::NOT_FOUND, ""); 34 | print encode_json( 35 | { 'error' => "Page Not Found: Please contact your Administrator", 36 | 'localized_error' => "Page Not Found: Please contact your Administrator", 37 | 'status' => Apache2::Const::NOT_FOUND } 38 | ); 39 | } 40 | else 41 | { 42 | # tell the browser the error 43 | $r->log->error("Internal Server Error"); 44 | $r->status(Apache2::Const::SERVER_ERROR); 45 | $r->custom_response(Apache2::Const::SERVER_ERROR, ""); 46 | print encode_json( 47 | { 'error' => "Internal Server Error: Please contact your Administrator", 48 | 'localized_error' => "Internal Server Error: Please contact your Administrator", 49 | 'status' => Apache2::Const::SERVER_ERROR } 50 | ); 51 | } 52 | # tell apache engine that everything is OK to not print the HTML standard error page 53 | return Apache2::Const::OK 54 | } 55 | } 56 | 57 | 1; 58 | -------------------------------------------------------------------------------- /client/script/execute: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use SMT::Agent::Utils; 5 | use XML::XPath; 6 | use XML::XPath::XMLParser; 7 | 8 | sub jobhandler 9 | { 10 | my ($jobtype, $jobid, $args, $verbose) = @_; 11 | 12 | SMT::Agent::Utils::logger ("jobhandler for execute called", $jobid); 13 | SMT::Agent::Utils::logger ("execute runs jobid \"$jobid\"", $jobid); 14 | 15 | # check whether this handler can handle requested jobtype 16 | SMT::Agent::Utils::error ("wrong job handler: \"execute\" cannot handle \"$jobtype\"", $jobid) if ( $jobtype ne "execute" ); 17 | 18 | my $xpQuery = XML::XPath->new(xml => $args); 19 | eval { SMT::Agent::Utils::error("no argument section found for this job", $jobid) unless ( $xpQuery->exists('/arguments[1]')); }; 20 | my $argSet; 21 | eval { $argSet = $xpQuery->find('/arguments[1]') }; 22 | SMT::Agent::Utils::error("xml data is not parsable", $jobid) if ($@); 23 | SMT::Agent::Utils::error("too many argument sections found for this job", $jobid) unless ( (defined $argSet) && ($argSet->size() == 1) ); 24 | my $arg = $argSet->pop(); 25 | my @cmds = (); 26 | push @cmds, $arg->getAttribute('command'); 27 | my $cmdSet; 28 | eval { $cmdSet = $xpQuery->find('/arguments[1]/options[1]/command[1]') }; 29 | SMT::Agent::Utils::error("xml data is not parsable", $jobid) if ($@); 30 | foreach my $_n ($cmdSet->get_nodelist()) { 31 | push (@cmds, $_n->string_value()) if (defined $_n); 32 | } 33 | 34 | my $jobcommand = undef; 35 | foreach my $_c (@cmds) { 36 | if ( (defined $_c) && ($_c !~ /^$/) ) { 37 | $jobcommand = $_c; 38 | last; 39 | } 40 | } 41 | $jobcommand = '/bin/false' unless defined $jobcommand; 42 | 43 | #== run bash == 44 | my $command = "/bin/bash"; 45 | my @cmdArgs; 46 | push (@cmdArgs, "-c"); 47 | push (@cmdArgs, $jobcommand); 48 | 49 | (my $retval, my $stdout, my $stderr) = SMT::Agent::Utils::executeCommand ( $command, undef, @cmdArgs ); 50 | 51 | return ( 52 | stdout => ((defined $stdout) && $verbose) ? $stdout : '', 53 | stderr => ((defined $stderr) && $verbose) ? $stderr : '', 54 | exitcode => $retval, 55 | success => ($retval == 0 ) ? "true" : "false", 56 | message => ($retval == 0 ) ? "execute successfully finished" : "execute failed" 57 | ); 58 | 59 | } 60 | 61 | SMT::Agent::Utils::logger ("successfully loaded handler for jobtype \"execute\""); 62 | 63 | return 1; 64 | 65 | -------------------------------------------------------------------------------- /client/package/sysconfig.smt-client: -------------------------------------------------------------------------------- 1 | ## Path: System/SMT-Client 2 | ## Description: Configuration of SMT Client 3 | 4 | ## Type: string(patchstatus,softwarepush,update,execute,reboot,wait,eject,createjob,report,inventory) 5 | ## Default: "softwarepush patchstatus update inventory createjob report" 6 | # 7 | # List of allowed agents that can be called via SMT job queue 8 | # The jobs createjob and report will only run on an SMT server that acts as smt-client relative to SCC. 9 | # 10 | ALLOWED_AGENTS="softwarepush patchstatus update inventory createjob report" 11 | 12 | ## Type: string(patchstatus,softwarepush,update,execute,reboot,wait,eject,createjob,report,inventory) 13 | ## Default: "inventory patchstatus" 14 | # 15 | # List of jobs that are allowed to be created in a local SMT server from an upstream SMT server 16 | # 17 | # Very useful setting: "inventory softwarepush patchstatus report createjob" 18 | # Default setting: "inventory patchstatus" 19 | # To disable creating jobs, please remove "createjob" from the ALLOWED_AGENTS variable. 20 | # Alternatively set the flag "forwardRegistration" to "false" in SMT configuration: /etc/smt.conf. 21 | # 22 | ALLOWED_CREATEJOB_JOBS="inventory patchstatus" 23 | 24 | ## Type: string 25 | # 26 | # Proxy for https 27 | # 28 | #HTTPS_PROXY="https://proxy:8080" 29 | 30 | ## Type: string 31 | # 32 | # User and password for proxy 33 | # 34 | #PROXY_USER="user:password" 35 | 36 | ## Type: string 37 | ## Default: "/etc/ssl/certs/" 38 | # 39 | # Path to the trusted ssl certificate files 40 | # If empty a trusted certificate needs to be configured using SSL_CA_FILE. 41 | # 42 | SSL_CA_PATH="/etc/ssl/certs/" 43 | 44 | ## Type: string 45 | ## Default: "/etc/ssl/certs/" 46 | # 47 | # Filename of the trusted ssl certificate file 48 | # If empty trusted certificates are figured out by using SSL_CA_PATH. 49 | # Please do not define a SSL_CA_PATH if you want to use a single file by setting SSL_CA_FILE. 50 | # 51 | SSL_CA_FILE="" 52 | 53 | ## Type: string 54 | # 55 | # Certificate Common Name 56 | # Empty if you don't want to verify the CN 57 | # 58 | SSL_CN_NAME="" 59 | 60 | 61 | ## Type: string 62 | # 63 | # List of smt servers smt-client isn't allowed to connect to 64 | # Please use the fully qualified host name or fully quilfied domain name 65 | # if an entry starts with a dot (.) the whole domain is denied 66 | # Example: smt.foo .bar 67 | # 68 | DENIED_SMT_SERVERS=".novell.com" 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /apache2/conf.d/smt_mod_perl.conf: -------------------------------------------------------------------------------- 1 | 2 | PerlRequire "/etc/apache2/smt-mod_perl-startup.pl" 3 | 4 | ErrorDocument 401 /perl/errors/401 5 | ErrorDocument 404 /perl/errors/404 6 | ErrorDocument 500 /perl/errors/500 7 | 8 | 9 | SetHandler perl-script 10 | PerlResponseHandler SMT::Error 11 | 12 | 13 | # perl cgi mode 14 | SetHandler perl-script 15 | # PerlInitHandler Apache2::Reload 16 | PerlResponseHandler NU::RepoIndex 17 | 18 | PerlAuthenHandler NU::SMTAuth 19 | AuthName SMTAuth 20 | AuthType Basic 21 | Require valid-user 22 | 23 | 24 | # perl cgi mode 25 | SetHandler perl-script 26 | HostnameLookups On 27 | PerlResponseHandler SMT::Registration 28 | 29 | 30 | # perl cgi mode 31 | SetHandler perl-script 32 | HostnameLookups On 33 | PerlResponseHandler SMT::ConnectAPI 34 | 35 | 36 | # perl cgi mode 37 | SetHandler perl-script 38 | HostnameLookups On 39 | PerlResponseHandler SMT::ConnectAPI 40 | 41 | PerlAuthenHandler SMT::Client::Auth 42 | AuthName SMT-Client-Authentication 43 | AuthType Basic 44 | Require valid-user 45 | 46 | 47 | # perl cgi mode 48 | SetHandler perl-script 49 | HostnameLookups On 50 | PerlResponseHandler SMT::ConnectAPI 51 | 52 | 53 | 54 | # The /cgi-bin/ ScriptAlias is already set up in httpd.conf 55 | 56 | 57 | SetHandler perl-script 58 | 59 | # enable for testing Apache2::Reload 60 | #PerlInitHandler Apache2::Reload 61 | 62 | PerlResponseHandler SMT::RESTInfo 63 | 64 | 65 | 66 | SetHandler perl-script 67 | 68 | # enable for testing Apache2::Reload 69 | # PerlInitHandler Apache2::Reload 70 | 71 | PerlResponseHandler SMT::RESTService 72 | 73 | # disable for testing 74 | PerlAuthenHandler SMT::Client::Auth 75 | AuthName SMT-Client-Authentication 76 | AuthType Basic 77 | Require valid-user 78 | 79 | 80 | 81 | # vim: ft=apache 82 | -------------------------------------------------------------------------------- /client/script/report: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use SMT::Agent::Utils; 5 | use XML::XPath; 6 | use XML::XPath::XMLParser; 7 | 8 | sub jobhandler 9 | { 10 | my ($jobtype, $jobid, $args, $verbose) = @_; 11 | 12 | SMT::Agent::Utils::logger("jobhandler for report job called", $jobid); 13 | SMT::Agent::Utils::logger("report runs jobid \"$jobid\"", $jobid); 14 | 15 | # check whether this handler can handle requested jobtype 16 | SMT::Agent::Utils::error("wrong job handler: \"report\" cannot handle \"$jobtype\"", $jobid) if ( $jobtype ne "report" ); 17 | 18 | my $xpQuery = XML::XPath->new(xml => $args); 19 | eval { SMT::Agent::Utils::error("no argument section found for this job", $jobid) unless ( $xpQuery->exists('/arguments[1]')); }; 20 | 21 | my $argSet; 22 | eval { $argSet = $xpQuery->find('/arguments[1]') }; 23 | SMT::Agent::Utils::error("xml data is not parsable", $jobid) if ($@); 24 | SMT::Agent::Utils::error("too many argument sections found for this job", $jobid) unless ( (defined $argSet) && ($argSet->size() == 1) ); 25 | 26 | my $arg = $argSet->pop(); 27 | my @jobids = (); 28 | my $jobidSet; 29 | eval { $jobidSet = $xpQuery->find('/arguments[1]/jobid') }; 30 | SMT::Agent::Utils::error("xml data is not parsable", $jobid) if ($@); 31 | foreach my $_n ($jobidSet->get_nodelist()) { 32 | push (@jobids, $_n->string_value()) if (defined $_n); 33 | } 34 | 35 | # try to import SMT server modules to find out if we are running on a SMT server 36 | eval { 37 | require SMT::CLI; # for database connection 38 | require SMT::Job::Result; # request job results 39 | }; 40 | SMT::Agent::Utils::error("Report job can only run on a SMT server. Could not find SMT server installation. Error message: $@", $jobid ) if ($@); 41 | 42 | # connect to database 43 | my ($cfg, $dbh) = SMT::CLI::init(); 44 | SMT::Agent::Utils::error("Could not connect to the SMT server database. Error message: $@", $jobid ) unless defined $dbh; 45 | 46 | my $jr = SMT::Job::Result->new({ 'dbh' => $dbh }); 47 | my $resxml = $jr->getResults( [@jobids], undef, { asXML => 1, checkupstream => 1 } ); 48 | 49 | return ( 50 | stdout => '', 51 | stderr => '', 52 | exitcode => (defined $resxml) ? 0 : 1, 53 | success => (defined $resxml) ? "true" : "false", 54 | result => $resxml ? ("\n".$resxml) : undef, 55 | message => (defined $resxml) ? "Report job successfully finished" : "Report job failed." 56 | ); 57 | 58 | } 59 | 60 | SMT::Agent::Utils::logger("successfully loaded handler for jobtype \"report\""); 61 | 62 | return 1; 63 | 64 | -------------------------------------------------------------------------------- /client/script/eject: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use SMT::Agent::Utils; 5 | use XML::XPath; 6 | use XML::XPath::XMLParser; 7 | 8 | sub jobhandler 9 | { 10 | my ($jobtype, $jobid, $args, $verbose) = @_; 11 | 12 | SMT::Agent::Utils::logger ("jobhandler for eject called", $jobid); 13 | SMT::Agent::Utils::logger ("eject runs jobid \"$jobid\"", $jobid); 14 | 15 | # check whether this handler can handle requested jobtype 16 | SMT::Agent::Utils::error ("wrong job handler: \"eject\" cannot handle \"$jobtype\"", $jobid) if ( $jobtype ne "eject" ); 17 | 18 | my $xpQuery = XML::XPath->new(xml => $args); 19 | eval { SMT::Agent::Utils::error("no argument section found for this job", $jobid) unless ( $xpQuery->exists('/arguments[1]')); }; 20 | my $argSet; 21 | eval { $argSet = $xpQuery->find('/arguments[1]') }; 22 | SMT::Agent::Utils::error("xml data is not parsable", $jobid) if ($@); 23 | SMT::Agent::Utils::error("too many argument sections found for this job", $jobid) unless ( (defined $argSet) && ($argSet->size() == 1) ); 24 | my $arg = $argSet->pop(); 25 | my @actions = (); 26 | push @actions, $arg->getAttribute('action'); 27 | my $actionSet; 28 | eval { $actionSet = $xpQuery->find('/arguments[1]/options[1]/action[1]') }; 29 | SMT::Agent::Utils::error("xml data is not parsable", $jobid) if ($@); 30 | foreach my $_n ($actionSet->get_nodelist()) { 31 | push (@actions, $_n->string_value()) if (defined $_n); 32 | } 33 | 34 | my $action = undef; 35 | foreach my $_a (@actions) { 36 | if ( (defined $_a) && ($_a !~ /^$/) && 37 | ($_a eq 'open' || $_a eq 'close' || $_a eq 'toggle')) { 38 | $action = $_a; 39 | last; 40 | } 41 | } 42 | $action = 'open' unless defined $action; 43 | 44 | #== run eject == 45 | my $command = "/usr/bin/eject"; 46 | my @cmdArgs; 47 | push (@cmdArgs, "-T") if ( $action eq "toggle" ); 48 | push (@cmdArgs, "-t") if ( $action eq "close" ); 49 | 50 | (my $retval, my $stdout, my $stderr) = SMT::Agent::Utils::executeCommand ( $command, undef, @cmdArgs ); 51 | SMT::Agent::Utils::error ("eject failed", $jobid) if ( $retval != 0 ); 52 | 53 | return ( 54 | stdout => ((defined $stdout) && (defined $verbose)) ? $stdout : '', 55 | stderr => ((defined $stderr) && (defined $verbose)) ? $stderr : '', 56 | exitcode => $retval, 57 | success => ($retval == 0 ) ? "true" : "false", 58 | message => ($retval == 0 ) ? "eject successfully finished" : "eject failed" 59 | ); 60 | 61 | } 62 | 63 | SMT::Agent::Utils::logger ("successfully loaded handler for jobtype \"eject\""); 64 | 65 | 1; 66 | 67 | -------------------------------------------------------------------------------- /doc/yep-design-1.txt: -------------------------------------------------------------------------------- 1 | 2 | SMT Design 3 | ============================== 4 | mc@suse.de - dmacvicar@suse.de 5 | 6 | For reference to the product, see SMT PRD or contact 7 | visnov@suse.cz 8 | 9 | 1. Functionality: 10 | 11 | This software is able to mirror a selection of individual catalogs 12 | coming from NU services and yum repositories, and allows for grouping 13 | of catalogs under name, and assignement of devices to certain group. 14 | 15 | The catalog exposes a url which serves a dynamic repoindex.xml for 16 | consumption. The repoindex lists the catalogs belonging to the group 17 | where this device is assigned. 18 | 19 | In addition, a device could subscribe to catalogs directly. 20 | 21 | 2. Components: 22 | 23 | 2.1 Configuration 24 | 25 | Configuration and state data overlap. Decision to be 26 | made what belongs to the database and what to configuration. 27 | 28 | - repositories and catalogs to mirror 29 | - groups of catalogs 30 | 31 | Example (rails yml): 32 | 33 | ------------------------------------- 34 | mirror.yml 35 | 36 | nu.novell: 37 | url: https://user:pass@nu.novell.com 38 | type: nu 39 | catalogs: SLED10-SP1-Updates,SLE10-SP1-Debuginfo-Updates 40 | 41 | 10.3-update: 42 | url: http://download.opensuse.org/update/10.3 43 | path: /foo 44 | 45 | ------------------------------------- 46 | groups.yml 47 | 48 | group1: SLED10-SP1-Updates,SLE10-SP1-Debuginfo-Updates,10.3-update 49 | 50 | ------------------------------------- 51 | 52 | Catalogs coming from NU repositories need a query to the NU server to get their 53 | paths and targets. This information needs to be cached somehow. 54 | 55 | Listing of available catalogs for a set of mirroring credentials can be 56 | retrieved requesting https://nu.novell.com with basic authentication. 57 | 58 | 59 | 60 | .. more .. 61 | 62 | 63 | 2.2 Repository Server 64 | 65 | Web service that when called as: 66 | 67 | http://guuid@serverurl 68 | 69 | returns a repoindex with the appropiate catalogs for the group where that 70 | machine belongs. 71 | 72 | 2.3 Mirroring 73 | 74 | This component takes the configuration and downloads the selected catalogs from configured NU 75 | servers. 76 | 77 | The mirror component should read the repoindex of each NU service, and then read the 78 | repomd.xml of each catalog. It should download all metadata files and recursiverly also 79 | read metadata files which contains reference to other resources which have to be 80 | downloaded. 81 | 82 | 83 | -------------------------------------------------------------------------------- /www/perl-lib/SMT/Job/Constants.pm: -------------------------------------------------------------------------------- 1 | # 2 | # constants for SMT JobQueue 3 | # 4 | 5 | package SMT::Job::Constants; 6 | 7 | use strict; 8 | use warnings; 9 | 10 | use constant 11 | { 12 | # the status values 0, 4, 5 and 6 are interpreted as successful 13 | # so chained jobs will be delivered, the only difference is that attention should be drawn to the message 14 | JOB_STATUS => 15 | { 16 | 0 => 'queued', 17 | 1 => 'successful', 18 | 2 => 'failed', 19 | 3 => 'denied by client', 20 | 4 => 'warning', 21 | 5 => 'action needed', 22 | 6 => 'reboot needed', 23 | 7 => 'disabled', 24 | 25 | 'queued' => 0, 26 | 'successful' => 1, 27 | 'failed' => 2, 28 | 'denied by client' => 3, 29 | 'warning' => 4, 30 | 'action needed' => 5, 31 | 'reboot needed' => 6, 32 | 'disabled' => 7 33 | }, 34 | 35 | # Job type ID range 36 | # 0 - 511 : reserved for jobs shipped by vendor 37 | # 512 - 1023 : custom jobs added by user/customer 38 | JOB_TYPE => 39 | { 40 | # Maps JOB_TYPE ID to JOB_TYPE NAME 41 | 1 => 'patchstatus', 42 | 2 => 'softwarepush', 43 | 3 => 'update', 44 | 4 => 'execute', 45 | 5 => 'reboot', 46 | 6 => 'configure', 47 | 7 => 'wait', 48 | 8 => 'eject', 49 | 51 => 'createjob', 50 | 52 => 'report', 51 | 53 => 'inventory', 52 | 53 | # Maps JOB_TYPE NAME to JOB_TYPE ID 54 | 'patchstatus' => 1, 55 | 'softwarepush' => 2, 56 | 'update' => 3, 57 | 'execute' => 4, 58 | 'reboot' => 5, 59 | 'configure' => 6, 60 | 'wait' => 7, 61 | 'eject' => 8, 62 | 'createjob' => 51, 63 | 'report' => 52, 64 | 'inventory' => 53, 65 | } 66 | }; 67 | 68 | 69 | ## Constants for job data (may not be encapsulated into a hash like structure like above) 70 | ## 71 | # basic attributes: only primary keys and foreign key 72 | use constant JOB_DATA_BASIC => qw(id parent_id guid); 73 | # all attributes that are attributes (in the job XML repersentation) to the job and are not not a CData section or a XML snippet itself 74 | use constant JOB_DATA_ATTRIBUTES => qw(type name description status exitcode created targeted expires retrieved finished upstream cacheresult verbose timelag message persistent); 75 | # sub-elements of the job (in the job XML representation) that need special handling (CData, XML snippet) 76 | use constant JOB_DATA_ELEMENTS => qw(stdout stderr arguments); 77 | 78 | 79 | 1; 80 | -------------------------------------------------------------------------------- /devel-scripts/client-compare.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | use SMT::Utils; 6 | use Text::ASCIITable; 7 | use SMT; 8 | 9 | my $dbh = SMT::Utils::db_connect(); 10 | 11 | my $statement = ""; 12 | 13 | if ( $SMT::SCHEMA_VERSION == 1.00 ) 14 | { 15 | $statement = "select cl.GUID, cl.HOSTNAME, 16 | p.PRODUCT, p.VERSION, p.REL, p.ARCH, 17 | c.NAME, c.TARGET, c.LOCALPATH, c.CATALOGTYPE, 18 | pc.OPTIONAL 19 | from Products p, Catalogs c, ProductCatalogs pc 20 | Clients cl, Registration r 21 | where p.PRODUCTDATAID=pc.PRODUCTDATAID 22 | and pc.CATALOGID=c.CATALOGID 23 | and cl.GUID = r.GUID 24 | and r.PRODUCTID = p.PRODUCTDATAID 25 | order by cl.GUID, p.PRODUCT, p.VERSION, p.REL, p.ARCH, c.NAME, c.TARGET; "; 26 | } 27 | else 28 | { 29 | $statement = "select cl.GUID, cl.HOSTNAME, 30 | p.PRODUCT, p.VERSION, p.REL, p.ARCH, 31 | c.NAME, c.TARGET, c.LOCALPATH, c.CATALOGTYPE, 32 | pc.OPTIONAL 33 | from Products p, Catalogs c, ProductCatalogs pc, 34 | Clients cl, Registration r 35 | where p.ID=pc.PRODUCTID 36 | and pc.CATALOGID=c.ID 37 | and cl.GUID = r.GUID 38 | and r.PRODUCTID = p.ID 39 | order by cl.GUID, p.PRODUCT, p.VERSION, p.REL, p.ARCH, c.NAME, c.TARGET; "; 40 | } 41 | 42 | my $res = $dbh->selectall_arrayref($statement, {Slice=>{}}); 43 | 44 | my $t = new Text::ASCIITable; 45 | $t->setCols( "Client ID", "HOSTNAME", "PRODUCT", "CATALOG", "LOCALPATH", "OPT", "CT" ); 46 | $t->addRow( '---', '----------', 47 | '-----------------------------------------------------------------------------------------', 48 | '---------------------------------------------------------', 49 | '--------------------------------------------------------------', '-' ); 50 | 51 | foreach my $set (@{$res}) 52 | { 53 | $set->{VERSION} = "" if(!defined $set->{VERSION}); 54 | $set->{REL} = "" if(!defined $set->{REL}); 55 | $set->{ARCH}= "" if(!defined $set->{ARCH}); 56 | $set->{TARGET}= "" if(!defined $set->{TARGET}); 57 | $t->addRow( $set->{GUID}, 58 | $set->{HOSTNAME}, 59 | $set->{PRODUCT}." ".$set->{VERSION}." ".$set->{REL}." ".$set->{ARCH}, 60 | $set->{NAME}." ".$set->{TARGET}, 61 | $set->{LOCALPATH}, 62 | $set->{OPTIONAL}, 63 | $set->{CATALOGTYPE}); 64 | } 65 | print $t->draw(); 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /client/script/smt-agent: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | use warnings; 4 | use SMT::Agent::Constants; 5 | use SMT::Agent::Config; 6 | use SMT::Agent::Utils; 7 | use SMT::Agent::RestXML; 8 | 9 | if ( ! SMT::Agent::Utils::openLock("smt-agent") ) 10 | { 11 | SMT::Agent::Utils::error ("Cannot open Lock. Process still running?"); 12 | } 13 | 14 | # check if we run on an SMT server and if yes, check if we are allowed to run smt-client 15 | if ( -f '/usr/sbin/smt' || -f '/etc/smt.conf') 16 | { 17 | SMT::Agent::Utils::logger("Started smt-client on SMT server."); 18 | my $cfg = undef; 19 | eval { 20 | require SMT::Utils; 21 | $cfg = SMT::Utils::getSMTConfig(); 22 | }; 23 | if($@ || !defined $cfg) 24 | { 25 | SMT::Agent::Utils::error("Could not load SMT server configuration to find out if smt-client is allowed to run. Thus exiting."); 26 | } 27 | 28 | my $allowRegister = $cfg->val("LOCAL", "forwardRegistration"); 29 | if (!(defined $allowRegister && $allowRegister eq "true")) 30 | { 31 | SMT::Agent::Utils::logger("Not allowed to run smt-client on this SMT server. The configuration 'forwardRegistration' is disabled in the SMT server config: /etc/smt.conf ."); 32 | exit 0; 33 | } 34 | } 35 | 36 | 37 | my $jobid; 38 | my $breakloop = 0; 39 | 40 | my ($retval, $stdout, $stderr); 41 | while( (! $breakloop) && defined ( $jobid = SMT::Agent::RestXML::parsejobid( SMT::Agent::RestXML::getnextjob() ))) 42 | { 43 | # prevent command injection 44 | SMT::Agent::Utils::error ( "cannot run jobs with non-numeric jobid." ) unless ( $jobid =~ /^[0-9]+$/ ); 45 | SMT::Agent::Utils::logger ("running job $jobid", $jobid); 46 | ($retval, $stdout, $stderr) = undef; 47 | ($retval, $stdout, $stderr) = SMT::Agent::Utils::executeCommand ( SMT::Agent::Constants::PROCESSJOB, undef, ( $jobid ) ); 48 | # return values of processjob script: 49 | # 0 : success 50 | # 1 : error -> report error and exit 51 | # 8 : success but break the smt-agent loop 52 | if ( $retval == 0 ) 53 | { 54 | SMT::Agent::Utils::logger("job $jobid finished successfully, see job message for details"); 55 | } 56 | elsif ( $retval == 8 ) 57 | { 58 | SMT::Agent::Utils::logger("info: the smt-agent loop was stopped by job $jobid"); 59 | $breakloop = 1; 60 | } 61 | else 62 | { 63 | SMT::Agent::Utils::error("error: job $jobid exited with $retval. stdout: '$stdout' stderr: '$stderr'", $jobid); 64 | # implicit exiting 65 | } 66 | 67 | sleep (3); 68 | } 69 | 70 | SMT::Agent::Utils::logger("no jobs left. exit.") unless (defined $retval && $retval =~ /^8$/); 71 | 72 | if ( ! SMT::Agent::Utils::unLock("smt-agent") ) 73 | { 74 | SMT::Agent::Utils::error ("Cannot remove Lock."); 75 | } 76 | 77 | 78 | -------------------------------------------------------------------------------- /script/smt-sync: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | ############################################################################### 4 | ## Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. 5 | ############################################################################### 6 | 7 | use strict; 8 | use warnings; 9 | use FindBin; 10 | BEGIN { unshift @INC, "$FindBin::Bin/../www/perl-lib" } 11 | 12 | use SMT::Utils; 13 | 14 | use Locale::gettext (); 15 | use POSIX (); # Needed for setlocale() 16 | 17 | POSIX::setlocale(&POSIX::LC_MESSAGES, ""); 18 | 19 | my $exec = "/usr/sbin/smt-scc-sync"; 20 | my $cfg = undef; 21 | eval 22 | { 23 | $cfg = SMT::Utils::getSMTConfig(); 24 | }; 25 | if($@ || !defined $cfg) 26 | { 27 | print sprintf(__("Cannot read the SMT configuration file: %s"), $@); 28 | exit 1; 29 | } 30 | 31 | if ( $cfg->val('NU', 'ApiType', 'NCC') eq 'NCC') 32 | { 33 | print __("NCC is not supported in this version of SMT"); 34 | exit 1; 35 | } 36 | 37 | sub executeCommand 38 | { 39 | my $command = shift; 40 | my @options = @_; 41 | 42 | my $cmd = "$command "; 43 | 44 | # quote all the options, otherwise whithespace causes problems 45 | foreach (@options) 46 | { 47 | $_ =~ s/\'/\\\'/; 48 | $cmd .= "'$_' "; 49 | } 50 | 51 | #print "execute '$cmd'\n"; 52 | if ( ! -e $command ) 53 | { 54 | die "$cmd command not installed\n"; 55 | } 56 | return system($cmd); 57 | } 58 | 59 | my $ret = executeCommand($exec, @ARGV); 60 | exit $ret; 61 | 62 | # 63 | # Manpage 64 | # 65 | 66 | =head1 NAME 67 | 68 | smt-sync - sync from customer center 69 | 70 | =head1 SYNOPSIS 71 | 72 | smt-sync [--help|-h] [options] 73 | 74 | =head1 DESCRIPTION 75 | 76 | Wrapper for smt-ncc-sync or smt-scc-sync depending on the configuration. 77 | 78 | 79 | =head1 AUTHORS and CONTRIBUTORS 80 | 81 | Duncan Mac-Vicar Prett, Lukas Ocilka, Jens Daniel Schmidt, Michael Calmer 82 | 83 | =head1 LICENSE 84 | 85 | Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. 86 | 87 | This program is free software; you can redistribute it and/or modify it under 88 | the terms of the GNU General Public License as published by the Free Software 89 | Foundation; either version 2 of the License, or (at your option) any later 90 | version. 91 | 92 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 93 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 94 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 95 | 96 | You should have received a copy of the GNU General Public License along with 97 | this program; if not, write to the Free Software Foundation, Inc., 675 Mass 98 | Ave, Cambridge, MA 02139, USA. 99 | 100 | =cut 101 | 102 | -------------------------------------------------------------------------------- /devel-scripts/testcases/test1/machinedata.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.11 2 | -- 3 | -- Host: localhost Database: smt 4 | -- ------------------------------------------------------ 5 | -- Server version 5.0.67 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!40101 SET NAMES utf8 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `MachineData` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `MachineData`; 23 | SET @saved_cs_client = @@character_set_client; 24 | SET character_set_client = utf8; 25 | CREATE TABLE `MachineData` ( 26 | `GUID` char(50) NOT NULL, 27 | `KEYNAME` char(50) NOT NULL, 28 | `VALUE` blob, 29 | PRIMARY KEY (`GUID`,`KEYNAME`) 30 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 31 | SET character_set_client = @saved_cs_client; 32 | 33 | -- 34 | -- Dumping data for table `MachineData` 35 | -- 36 | 37 | LOCK TABLES `MachineData` WRITE; 38 | /*!40000 ALTER TABLE `MachineData` DISABLE KEYS */; 39 | 40 | INSERT INTO `MachineData` VALUES ('4f6d81cabd5343548dda08f425b0ceea', 'host', ''); 41 | INSERT INTO `MachineData` VALUES ('f7ef7ef5a8be4884991a9f7b153515f9', 'host', ''); 42 | INSERT INTO `MachineData` VALUES ('65f411b03c4e4009867c316a798b960c', 'host', ''); 43 | INSERT INTO `MachineData` VALUES ('abcd1', 'host', ''); 44 | INSERT INTO `MachineData` VALUES ('abcd2', 'host', ''); 45 | INSERT INTO `MachineData` VALUES ('abcd3', 'host', ''); 46 | INSERT INTO `MachineData` VALUES ('abcd4', 'host', ''); 47 | INSERT INTO `MachineData` VALUES ('abcd5', 'host', ''); 48 | INSERT INTO `MachineData` VALUES ('abcd6', 'host', ''); 49 | INSERT INTO `MachineData` VALUES ('abcd7', 'host', ''); 50 | INSERT INTO `MachineData` VALUES ('xyz1', 'host', ''); 51 | /* INSERT INTO `MachineData` VALUES ('', 'host', ''); */ 52 | 53 | /*!40000 ALTER TABLE `MachineData` ENABLE KEYS */; 54 | UNLOCK TABLES; 55 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 56 | 57 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 58 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 59 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 60 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 61 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 62 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 63 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 64 | 65 | -- Dump completed on 2009-06-09 11:28:44 66 | -------------------------------------------------------------------------------- /devel-scripts/testcases/test2/machinedata.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.11 2 | -- 3 | -- Host: localhost Database: smt 4 | -- ------------------------------------------------------ 5 | -- Server version 5.0.67 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!40101 SET NAMES utf8 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `MachineData` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `MachineData`; 23 | SET @saved_cs_client = @@character_set_client; 24 | SET character_set_client = utf8; 25 | CREATE TABLE `MachineData` ( 26 | `GUID` char(50) NOT NULL, 27 | `KEYNAME` char(50) NOT NULL, 28 | `VALUE` blob, 29 | PRIMARY KEY (`GUID`,`KEYNAME`) 30 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 31 | SET character_set_client = @saved_cs_client; 32 | 33 | -- 34 | -- Dumping data for table `MachineData` 35 | -- 36 | 37 | LOCK TABLES `MachineData` WRITE; 38 | /*!40000 ALTER TABLE `MachineData` DISABLE KEYS */; 39 | 40 | INSERT INTO `MachineData` VALUES ('4f6d81cabd5343548dda08f425b0ceea', 'host', ''); 41 | INSERT INTO `MachineData` VALUES ('f7ef7ef5a8be4884991a9f7b153515f9', 'host', ''); 42 | INSERT INTO `MachineData` VALUES ('65f411b03c4e4009867c316a798b960c', 'host', ''); 43 | INSERT INTO `MachineData` VALUES ('abcd1', 'host', ''); 44 | INSERT INTO `MachineData` VALUES ('abcd2', 'host', ''); 45 | INSERT INTO `MachineData` VALUES ('abcd3', 'host', ''); 46 | INSERT INTO `MachineData` VALUES ('abcd4', 'host', ''); 47 | INSERT INTO `MachineData` VALUES ('abcd5', 'host', ''); 48 | INSERT INTO `MachineData` VALUES ('abcd6', 'host', ''); 49 | INSERT INTO `MachineData` VALUES ('abcd7', 'host', ''); 50 | INSERT INTO `MachineData` VALUES ('xyz1', 'host', ''); 51 | /* INSERT INTO `MachineData` VALUES ('', 'host', ''); */ 52 | 53 | /*!40000 ALTER TABLE `MachineData` ENABLE KEYS */; 54 | UNLOCK TABLES; 55 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 56 | 57 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 58 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 59 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 60 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 61 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 62 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 63 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 64 | 65 | -- Dump completed on 2009-06-09 11:28:44 66 | -------------------------------------------------------------------------------- /devel-scripts/testcases/test7/machinedata.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.11 2 | -- 3 | -- Host: localhost Database: smt 4 | -- ------------------------------------------------------ 5 | -- Server version 5.0.67 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!40101 SET NAMES utf8 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `MachineData` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `MachineData`; 23 | SET @saved_cs_client = @@character_set_client; 24 | SET character_set_client = utf8; 25 | CREATE TABLE `MachineData` ( 26 | `GUID` char(50) NOT NULL, 27 | `KEYNAME` char(50) NOT NULL, 28 | `VALUE` blob, 29 | PRIMARY KEY (`GUID`,`KEYNAME`) 30 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 31 | SET character_set_client = @saved_cs_client; 32 | 33 | -- 34 | -- Dumping data for table `MachineData` 35 | -- 36 | 37 | LOCK TABLES `MachineData` WRITE; 38 | /*!40000 ALTER TABLE `MachineData` DISABLE KEYS */; 39 | 40 | INSERT INTO `MachineData` VALUES ('4f6d81cabd5343548dda08f425b0ceea', 'host', ''); 41 | INSERT INTO `MachineData` VALUES ('f7ef7ef5a8be4884991a9f7b153515f9', 'host', ''); 42 | INSERT INTO `MachineData` VALUES ('65f411b03c4e4009867c316a798b960c', 'host', ''); 43 | INSERT INTO `MachineData` VALUES ('abcd1', 'host', ''); 44 | INSERT INTO `MachineData` VALUES ('abcd2', 'host', ''); 45 | INSERT INTO `MachineData` VALUES ('abcd3', 'host', ''); 46 | INSERT INTO `MachineData` VALUES ('abcd4', 'host', ''); 47 | INSERT INTO `MachineData` VALUES ('abcd5', 'host', ''); 48 | INSERT INTO `MachineData` VALUES ('abcd6', 'host', ''); 49 | INSERT INTO `MachineData` VALUES ('abcd7', 'host', ''); 50 | INSERT INTO `MachineData` VALUES ('xyz1', 'host', ''); 51 | /* INSERT INTO `MachineData` VALUES ('', 'host', ''); */ 52 | 53 | /*!40000 ALTER TABLE `MachineData` ENABLE KEYS */; 54 | UNLOCK TABLES; 55 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 56 | 57 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 58 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 59 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 60 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 61 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 62 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 63 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 64 | 65 | -- Dump completed on 2009-06-09 11:28:44 66 | -------------------------------------------------------------------------------- /devel-scripts/testcases/test8/machinedata.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.11 2 | -- 3 | -- Host: localhost Database: smt 4 | -- ------------------------------------------------------ 5 | -- Server version 5.0.67 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!40101 SET NAMES utf8 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `MachineData` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `MachineData`; 23 | SET @saved_cs_client = @@character_set_client; 24 | SET character_set_client = utf8; 25 | CREATE TABLE `MachineData` ( 26 | `GUID` char(50) NOT NULL, 27 | `KEYNAME` char(50) NOT NULL, 28 | `VALUE` blob, 29 | PRIMARY KEY (`GUID`,`KEYNAME`) 30 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 31 | SET character_set_client = @saved_cs_client; 32 | 33 | -- 34 | -- Dumping data for table `MachineData` 35 | -- 36 | 37 | LOCK TABLES `MachineData` WRITE; 38 | /*!40000 ALTER TABLE `MachineData` DISABLE KEYS */; 39 | 40 | INSERT INTO `MachineData` VALUES ('4f6d81cabd5343548dda08f425b0ceea', 'host', ''); 41 | INSERT INTO `MachineData` VALUES ('f7ef7ef5a8be4884991a9f7b153515f9', 'host', ''); 42 | INSERT INTO `MachineData` VALUES ('65f411b03c4e4009867c316a798b960c', 'host', ''); 43 | INSERT INTO `MachineData` VALUES ('abcd1', 'host', ''); 44 | INSERT INTO `MachineData` VALUES ('abcd2', 'host', ''); 45 | INSERT INTO `MachineData` VALUES ('abcd3', 'host', ''); 46 | INSERT INTO `MachineData` VALUES ('abcd4', 'host', ''); 47 | INSERT INTO `MachineData` VALUES ('abcd5', 'host', ''); 48 | INSERT INTO `MachineData` VALUES ('abcd6', 'host', ''); 49 | INSERT INTO `MachineData` VALUES ('abcd7', 'host', ''); 50 | INSERT INTO `MachineData` VALUES ('xyz1', 'host', ''); 51 | /* INSERT INTO `MachineData` VALUES ('', 'host', ''); */ 52 | 53 | /*!40000 ALTER TABLE `MachineData` ENABLE KEYS */; 54 | UNLOCK TABLES; 55 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 56 | 57 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 58 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 59 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 60 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 61 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 62 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 63 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 64 | 65 | -- Dump completed on 2009-06-09 11:28:44 66 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.05-3.02/400-fix-index-names.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Clients change ID ID int(10) unsigned NOT NULL; 2 | call smt.drop_index_if_exists('Clients', 'ID'); 3 | CREATE UNIQUE INDEX IF NOT EXISTS Clients_id_uq ON Clients (ID); 4 | ALTER TABLE Clients change ID ID int(10) unsigned NOT NULL AUTO_INCREMENT; 5 | 6 | call smt.drop_index_if_exists('Clients', 'idx_clnt_sysid'); 7 | CREATE INDEX IF NOT EXISTS Clients_systemid_idx ON Clients (SYSTEMID); 8 | 9 | call smt.drop_index_if_exists('Subscriptions', 'idx_sub_product_class'); 10 | CREATE INDEX IF NOT EXISTS Subscriptions_product_class_idx ON Subscriptions (PRODUCT_CLASS); 11 | 12 | call smt.drop_index_if_exists('Catalogs', 'NAME'); 13 | CREATE UNIQUE INDEX IF NOT EXISTS Catalogs_name_target_uq ON Catalogs (NAME, TARGET); 14 | 15 | call smt.drop_index_if_exists('Catalogs', 'CID_SRC'); 16 | CREATE UNIQUE INDEX IF NOT EXISTS Catalogs_catalogid_src_uq ON Catalogs (CATALOGID, SRC); 17 | 18 | call smt.drop_index_if_exists('StagingGroups', 'NAME'); 19 | CREATE UNIQUE INDEX IF NOT EXISTS StagingGroups_name_uq ON StagingGroups (NAME); 20 | 21 | call smt.drop_index_if_exists('StagingGroups', 'TESTINGDIR'); 22 | CREATE UNIQUE INDEX IF NOT EXISTS StagingGroups_testingdir_uq ON StagingGroups (TESTINGDIR); 23 | 24 | call smt.drop_index_if_exists('StagingGroups', 'PRODUCTIONDIR'); 25 | CREATE UNIQUE INDEX IF NOT EXISTS StagingGroups_productiondir_uq ON StagingGroups (PRODUCTIONDIR); 26 | 27 | call smt.drop_index_if_exists('Filters', 'CATALOG_ID'); 28 | CREATE UNIQUE INDEX IF NOT EXISTS Filters_cid_sgid_type_value_uq ON Filters (CATALOG_ID, STAGINGGROUP_ID, TYPE, VALUE); 29 | 30 | call smt.drop_index_if_exists('Products', 'PDID_SRC'); 31 | CREATE UNIQUE INDEX IF NOT EXISTS Products_productdataid_src_uq ON Products (PRODUCTDATAID, SRC); 32 | 33 | call smt.drop_index_if_exists('Products', 'PRODUCTLOWER'); 34 | CREATE UNIQUE INDEX IF NOT EXISTS Products_pdl_verl_rell_archl_uq ON Products (PRODUCTLOWER, VERSIONLOWER, RELLOWER, ARCHLOWER); 35 | 36 | call smt.drop_index_if_exists('Products', 'idx_prod_product_class'); 37 | CREATE INDEX IF NOT EXISTS Products_product_class_idx ON Products (PRODUCT_CLASS); 38 | 39 | call smt.drop_index_if_exists('ProductExtensions', 'pdid_extid_unq'); 40 | CREATE UNIQUE INDEX IF NOT EXISTS ProductExtensions_pdid_extid_uq ON ProductExtensions (PRODUCTID, EXTENSIONID); 41 | 42 | call smt.drop_index_if_exists('ProductMigrations', 'pdid_migid_unq'); 43 | CREATE UNIQUE INDEX IF NOT EXISTS ProductMigrations_srcpdid_tgtpdid_uq ON ProductMigrations (SRCPDID, TGTPDID); 44 | 45 | call smt.drop_index_if_exists('RepositoryContentData', 'idx_repo_cont_data_name_checksum'); 46 | CREATE INDEX IF NOT EXISTS RepositoryContentData_name_cksum_cktype_idx ON RepositoryContentData (name, checksum, checksum_type); 47 | 48 | CREATE INDEX IF NOT EXISTS ProductExtensions_pdid_extid_src_idx ON ProductExtensions (PRODUCTID, EXTENSIONID, SRC); 49 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.06-3.03/400-fix-index-names.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Clients change ID ID int(10) unsigned NOT NULL; 2 | call smt.drop_index_if_exists('Clients', 'ID'); 3 | CREATE UNIQUE INDEX IF NOT EXISTS Clients_id_uq ON Clients (ID); 4 | ALTER TABLE Clients change ID ID int(10) unsigned NOT NULL AUTO_INCREMENT; 5 | 6 | call smt.drop_index_if_exists('Clients', 'idx_clnt_sysid'); 7 | CREATE INDEX IF NOT EXISTS Clients_systemid_idx ON Clients (SYSTEMID); 8 | 9 | call smt.drop_index_if_exists('Subscriptions', 'idx_sub_product_class'); 10 | CREATE INDEX IF NOT EXISTS Subscriptions_product_class_idx ON Subscriptions (PRODUCT_CLASS); 11 | 12 | call smt.drop_index_if_exists('Catalogs', 'NAME'); 13 | CREATE UNIQUE INDEX IF NOT EXISTS Catalogs_name_target_uq ON Catalogs (NAME, TARGET); 14 | 15 | call smt.drop_index_if_exists('Catalogs', 'CID_SRC'); 16 | CREATE UNIQUE INDEX IF NOT EXISTS Catalogs_catalogid_src_uq ON Catalogs (CATALOGID, SRC); 17 | 18 | call smt.drop_index_if_exists('StagingGroups', 'NAME'); 19 | CREATE UNIQUE INDEX IF NOT EXISTS StagingGroups_name_uq ON StagingGroups (NAME); 20 | 21 | call smt.drop_index_if_exists('StagingGroups', 'TESTINGDIR'); 22 | CREATE UNIQUE INDEX IF NOT EXISTS StagingGroups_testingdir_uq ON StagingGroups (TESTINGDIR); 23 | 24 | call smt.drop_index_if_exists('StagingGroups', 'PRODUCTIONDIR'); 25 | CREATE UNIQUE INDEX IF NOT EXISTS StagingGroups_productiondir_uq ON StagingGroups (PRODUCTIONDIR); 26 | 27 | call smt.drop_index_if_exists('Filters', 'CATALOG_ID'); 28 | CREATE UNIQUE INDEX IF NOT EXISTS Filters_cid_sgid_type_value_uq ON Filters (CATALOG_ID, STAGINGGROUP_ID, TYPE, VALUE); 29 | 30 | call smt.drop_index_if_exists('Products', 'PDID_SRC'); 31 | CREATE UNIQUE INDEX IF NOT EXISTS Products_productdataid_src_uq ON Products (PRODUCTDATAID, SRC); 32 | 33 | call smt.drop_index_if_exists('Products', 'PRODUCTLOWER'); 34 | CREATE UNIQUE INDEX IF NOT EXISTS Products_pdl_verl_rell_archl_uq ON Products (PRODUCTLOWER, VERSIONLOWER, RELLOWER, ARCHLOWER); 35 | 36 | call smt.drop_index_if_exists('Products', 'idx_prod_product_class'); 37 | CREATE INDEX IF NOT EXISTS Products_product_class_idx ON Products (PRODUCT_CLASS); 38 | 39 | call smt.drop_index_if_exists('ProductExtensions', 'pdid_extid_unq'); 40 | CREATE UNIQUE INDEX IF NOT EXISTS ProductExtensions_pdid_extid_uq ON ProductExtensions (PRODUCTID, EXTENSIONID); 41 | 42 | call smt.drop_index_if_exists('ProductMigrations', 'pdid_migid_unq'); 43 | CREATE UNIQUE INDEX IF NOT EXISTS ProductMigrations_srcpdid_tgtpdid_uq ON ProductMigrations (SRCPDID, TGTPDID); 44 | 45 | call smt.drop_index_if_exists('RepositoryContentData', 'idx_repo_cont_data_name_checksum'); 46 | CREATE INDEX IF NOT EXISTS RepositoryContentData_name_cksum_cktype_idx ON RepositoryContentData (name, checksum, checksum_type); 47 | 48 | CREATE INDEX IF NOT EXISTS ProductExtensions_pdid_extid_src_idx ON ProductExtensions (PRODUCTID, EXTENSIONID, SRC); 49 | -------------------------------------------------------------------------------- /db/schemas/mysql/2.07-3.04/400-fix-index-names.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE Clients change ID ID int(10) unsigned NOT NULL; 2 | call smt.drop_index_if_exists('Clients', 'ID'); 3 | CREATE UNIQUE INDEX IF NOT EXISTS Clients_id_uq ON Clients (ID); 4 | ALTER TABLE Clients change ID ID int(10) unsigned NOT NULL AUTO_INCREMENT; 5 | 6 | call smt.drop_index_if_exists('Clients', 'idx_clnt_sysid'); 7 | CREATE INDEX IF NOT EXISTS Clients_systemid_idx ON Clients (SYSTEMID); 8 | 9 | call smt.drop_index_if_exists('Subscriptions', 'idx_sub_product_class'); 10 | CREATE INDEX IF NOT EXISTS Subscriptions_product_class_idx ON Subscriptions (PRODUCT_CLASS); 11 | 12 | call smt.drop_index_if_exists('Catalogs', 'NAME'); 13 | CREATE UNIQUE INDEX IF NOT EXISTS Catalogs_name_target_uq ON Catalogs (NAME, TARGET); 14 | 15 | call smt.drop_index_if_exists('Catalogs', 'CID_SRC'); 16 | CREATE UNIQUE INDEX IF NOT EXISTS Catalogs_catalogid_src_uq ON Catalogs (CATALOGID, SRC); 17 | 18 | call smt.drop_index_if_exists('StagingGroups', 'NAME'); 19 | CREATE UNIQUE INDEX IF NOT EXISTS StagingGroups_name_uq ON StagingGroups (NAME); 20 | 21 | call smt.drop_index_if_exists('StagingGroups', 'TESTINGDIR'); 22 | CREATE UNIQUE INDEX IF NOT EXISTS StagingGroups_testingdir_uq ON StagingGroups (TESTINGDIR); 23 | 24 | call smt.drop_index_if_exists('StagingGroups', 'PRODUCTIONDIR'); 25 | CREATE UNIQUE INDEX IF NOT EXISTS StagingGroups_productiondir_uq ON StagingGroups (PRODUCTIONDIR); 26 | 27 | call smt.drop_index_if_exists('Filters', 'CATALOG_ID'); 28 | CREATE UNIQUE INDEX IF NOT EXISTS Filters_cid_sgid_type_value_uq ON Filters (CATALOG_ID, STAGINGGROUP_ID, TYPE, VALUE); 29 | 30 | call smt.drop_index_if_exists('Products', 'PDID_SRC'); 31 | CREATE UNIQUE INDEX IF NOT EXISTS Products_productdataid_src_uq ON Products (PRODUCTDATAID, SRC); 32 | 33 | call smt.drop_index_if_exists('Products', 'PRODUCTLOWER'); 34 | CREATE UNIQUE INDEX IF NOT EXISTS Products_pdl_verl_rell_archl_uq ON Products (PRODUCTLOWER, VERSIONLOWER, RELLOWER, ARCHLOWER); 35 | 36 | call smt.drop_index_if_exists('Products', 'idx_prod_product_class'); 37 | CREATE INDEX IF NOT EXISTS Products_product_class_idx ON Products (PRODUCT_CLASS); 38 | 39 | call smt.drop_index_if_exists('ProductExtensions', 'pdid_extid_unq'); 40 | CREATE UNIQUE INDEX IF NOT EXISTS ProductExtensions_pdid_extid_uq ON ProductExtensions (PRODUCTID, EXTENSIONID); 41 | 42 | call smt.drop_index_if_exists('ProductMigrations', 'pdid_migid_unq'); 43 | CREATE UNIQUE INDEX IF NOT EXISTS ProductMigrations_srcpdid_tgtpdid_uq ON ProductMigrations (SRCPDID, TGTPDID); 44 | 45 | call smt.drop_index_if_exists('RepositoryContentData', 'idx_repo_cont_data_name_checksum'); 46 | CREATE INDEX IF NOT EXISTS RepositoryContentData_name_cksum_cktype_idx ON RepositoryContentData (name, checksum, checksum_type); 47 | 48 | CREATE INDEX IF NOT EXISTS ProductExtensions_pdid_extid_src_idx ON ProductExtensions (PRODUCTID, EXTENSIONID, SRC); 49 | --------------------------------------------------------------------------------